Advanced Materials in Unreal Engine 5 | Realtime Subsurface Scattering (SSS) and Glass Shader

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi there everybody today we're going to be looking at how we can create more advanced materials inside of Unreal Engine such as glass and subsurface scattering so let's go ahead and get started on that first thing we're going to do is we're going to actually take a look at how this is set up properly so that we can get an understanding of how subsurface Works inside of unreal you can go ahead and select this object let's go ahead and take a look at the materials here and this right here is our jto material let's double click it and go into our node graph right here as you can see see we have this material right here that not only has subsurface scattering happening inside but also has a little bit of displacement so we'll be covering both of those Concepts right here so in the no network we can actually go ahead and go full screen this real quick we can see that we have our Shader right here which if we were to click on our Shader we'd actually see that this is a Surface Shader that is opaque and instead of just being the default lit which is the actual default option that you get right here this is set to sub surface profile now subsurface profile is unreal's new methodology of rendering a lot better subsurface than the standard subsurface model so if anyone wants to work with subsurface scattering then I would highly highly highly recommend that you use this subsurface profile setting instead of the classic subsurface now if we were to go down here in the subsurface profile we see that there's actually an option to be able to add a subsurface profile right here and what you can do is you can actually click on this and you can add whatever subsurface profile that you want let's say that we wanted to create our own subsurface profile how do we do that well as you can see right here there's actually create a new asset section we can go ahead and click this we can create our asset wherever we want to we just have to name our subsurface profile so we'll just call this one new and go ahead and save this and we'll see that we'll actually get a subsurface profile being loaded up here now you just have to double click this to kind of go into this profile and what we'll see is that we'll have a lot of settings right here for additional control on how you want want your subsurface to look like I tend to set the surface albo right here and we set that to White because we want to get the albo information from your color map next thing we want to do is we also want to change our mean-free path color and we can change this to whatever we want to right now this is set to the meanf free path color of most human skin and blood so this right here is the perfect value for anything that is an organic human or anything with sort of red blood in a way so you can kind of keep this at default we also have our mean-free Pat distance which which is basically the amount that the object is letting light through and as it's letting light through it's a control how much that light is going between the mean-free path color and going up to our diffuse color so this is where you basically control the mean free path distance the really important one to also note here is world scale because by increasing this you can actually let a lot of light seep through on a uniform way instead of just determined by the mean-free pth distance so if I were to crank this up all the way it would actually let a lot of light in through all the areas of your mesh rather than just the parts that you highlighted inside of your subsurface map so this is all the settings that we need to really change for the subsurface profile you probably don't need to mess with any of these other settings so if we go back right here to the material we can actually see how everything is constructed and show where this is connected to the node graph so right here we have our base color our base color information is just RGB and you plug base color to base color right here and you absolutely need to make sure that you plug in this base color information here because again we don't have a base color map inside of your profile so this is the main thing that's actually picking up with next up we have our packed map right here which is occlusion roughness and metallic so we have our R which is ma to our ambient inclusion and it goes right here and connects to that g which is mapped to our roughness Channel which goes over here and B which is mapped to our metallic Channel and goes over here and once you connect that you'll get most of the other properties of your material now next up we have our normal map which Unreal Engine thankfully actually detects normal Maps right out of the blue so what you have to do you just have to go ahead and take the RGB value and just plug it into normal and it should automatically detect that and give you all of your normal and height information next up this map right here is actually our subsurface scattering map this will determine which areas are going to have subsurface and which areas do not you can see right here that our subsurface scattering map is actually being attached to this opacity section in fact this is what controls the subsurface amount of our Shader and just like how opacity works the closer you go to zero means more light is actually being led through whereas if you go closer to one less light is being led through so in this case if you go up to White values it would actually be less subsurface the more you go down to Black it would actually become more subsurface so because this principle is actually the inverse of what is there inside a substance painter and if you didn't invert SE your map inside a substance painter what you can do is you can left click and search for the one minus node this is basically unreal's equivalent of an invert node so you can pretty much just take this convert it to here and then put it inside to opacity now for me I actually did the work of inverting this map right here so this is exactly the way that I want it to look so I don't have to do any sort of inversion but there's a tool right there that can help you if you need to do so next up we have this section right here where it says World position offset this is basically unreal's uh version of displacement and the cool thing about world position offset is that you can also animate this so if you were to plug in a Time node and if you were to interpolate within time you can actually make stuff like wavy water or ripples or any sort of material that actually moves and changes according to the world but for us we're just going to be using this for displacement so the way that we do this is we take our displacement map with the cracks and then I'm actually multiplying this with a vertex normal WS node what this does is that it takes all the vertex normal information from whatever mesh that we have and actually offsets it by the displacement right here and this displacement amount which I'm kind of bringing through with this multiply node right here so by connecting both of these together and then adding a multiply so that I can control the amount of displacement I can plug this all into the world position offset and if my object has enough geometry as we can see the sphere having you can see that there's actual displac happening on this mesh at a material Level wonderful so now that we understand how subsurface works and displacement works now we can go ahead and get started with creating a glass Shader so let's go ahead and do that I'm going to go ahead and exit out of this material right here and then we're going to go ahead and create a new material let's go ahead and left click create material and I'm going to call this one glassor mat we can double click this right here and we have ourselves our our classic Shader setup that is right here now there are three little steps you have to do to the Shader itself before we get to making our glass first up we're going to go over here and go to the blend mode which right now is set to opaque you want to change this to translucent because glass is technically a translucent material next up you can actually go ahead and select two-sided here although this is really dependent on how you want your glass to look like but by default let's go ahead and select two-sided and then we can check this off if we don't need to now we can scroll all the way down up until we get to the translucency section once we do this we can go ahead and put contact shadows in here and then the other thing we want to make sure we do is change our lighting mode from volumetric non-directional and we're going to change this to surface forward shading this will actually be the most expensive Shader calculation inside of unreal we want to keep it this way because we can actually get proper glass this way now the other thing you also want to do is you want to scroll all the way down right to the bottom I want to go ahead and set the refraction method from none to index of refraction now we can set this up and what this will do is that we'll actually be able to get this section right here which has refraction we can get this exposed so that we can actually plug this into the index of refraction of whatever translucent material that we want whether that be water or glass or anything like that we also want to go ahead and turn on high quality Reflections right here as well next up we can go ahead and actually create our material so that it's not looking all weird like this uh first up we're actually going to be able to create a float parameter and the way that you do that is you pretty much select any area right here and then press one and then click and then you'll get yourself a flp parameter we're going to go ahead and set our base color right here to something like 05 so let let's type that in here I'm going to plug this into the actual base color once we do this we're going to create another float parameter which we can press one and then click anywhere out here and we're going to set our specular to one once we do this we can plug this in here and then next up we're going to go ahead and create a roughness value so I'm going to go ahead and press one click again I'm going to set this to something pretty low so we're going toate this to 05 as well put this on the roughness and then now the main parameter that we're going to have to change is the opacity right here which I'm going to press one create another flp parameter and we're going to change this opacity to 2 once we select this we can go ahead and click and drag it onto the opacity and now we'll actually see that we have ourselves a nice little glass material and the cool thing is because of surface forward shading and because I have Ray tracing Reflections and translucency on we're getting a perfect glass right out of the box right here now we're not done yet though because there's one more parameter that we need to change which is the refraction right here so go ahead and press one and create a float parameter we're going to type 1.5 as our index of refraction which would be the value for glass if you were to make some sort of translucent water what you want to set this to is 1.33 but we're going to set this 1.5 for the glass go ahead and click this put this onto refraction and immediately you'll be seeing a lot better of a result and making sure that this Shader is properly reacting just like glass would so we can go ahead and save this right now and what we can do is we can actually go ahead and plug this material into our uh J toad right here and make him a Glass Toad so let's do just that go over to content drawer and then we have our glass material right here so we're going to click and drag it onto him as you can see we're pretty much getting a proper glass right there all ready to go now you might be wondering uh it looks a little bit kind of grayish right so what what do we do there but what we can do is we can do a couple things I can actually set this uh opacity value right here I'm going to set this to .15 instead and then the other thing I'm going to do I go ahead and save this again to get him a little bit more light passing through here but the other thing I can do as well is I can go ahead and turn this backdrop off because I think it might be giving us a false sense of how this is working so I can select this and then I can press h to hide it and as you can see we're getting proper refraction happen right here so yeah just like that we pretty much got realistic glass right here now let's say that your actual setup is not looking like this glass that you're seeing on screen it's probably because you do not have rate Trace translucency turned on in your settings and so the way to do that is you actually have to go to your post-process volume which if you don't have one you get by actually going up to Windows the place actors menu and if you type in postprocess volume you can go ahead and create one click it drag it into scene and then the most important thing to do for the post-process volume is making sure you go to the search bar and search for infinite and make sure that this is checked on so that this post-process volume is applied to the entire scene outside of the bounds of that box now that you do that you can actually control a lot of your render settings and stuff from your post-process volume and so what you want to do is you can actually search for translucency and you can see that you have a couple of settings right here that IM mediately come up the main thing you want to make sure that you check on is high quality translucent Reflections are turned on rate tracing transluc also include translucent objects make sure that's turned on and then this is the most important one which is translucency you want to set your type to Ray tracing instead of raster which if you see this raster setting right here this looks really really bad so you absolutely make sure that you want to have the ray tracing section so you're getting proper glass right here you can also set some extra settings right here I set my Rays to 15 and my samples to 9 and set my Shadows to area Shadows but you can set these to whatever you kind of want them to be uh either one should be fine uh when it comes to the Shadows but I like to keep it at area but this is kind of how you set up your translucency stuff to look proper inside of Unreal Engine now it is ideal to actually use something of pth tracing to actually do your glass so if you have a lot of glass in your scene this is going to look a lot more realistic compared to what You' get from Lumen but I do know that lum's look still looks very much like glass and it can still be used on a lot of occasions without having to switch to pth tracing and just like that we've pretty much finished creating glass and subsurface scattering which are two really complicated materials that you can make ins set of under Lon for some realistic results I hope youall learned a lot and thank you very much for [Music] watching
Info
Channel: Adithya Sathyanarayanan
Views: 2,061
Rating: undefined out of 5
Keywords:
Id: PkLR8OqPzCA
Channel Id: undefined
Length: 13min 57sec (837 seconds)
Published: Tue Oct 31 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.