4: Materials Layers - Next-Gen Landscape Material in Unreal

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi i'm back with the second part of the material section of my god tier landscapes uh tutorial series on youtube uh so this is gonna be a direct follow-up to the last video which uh if you haven't watched you don't need to watch you need to make sure you go and watch the first two videos in the uh in this playlist uh in order to get a landscape and to get the splat maps you need in order to follow this tutorial but if you're an intermediate level or you've worked a little bit of landscape materials before the last video really is just an introduction for beginners to how we might start to think about setting up a landscape material and to be honest uh the way that i set the material up in the in the previous video that's pretty much the way that most of the materials that you can get on the market placement set up they just take it a lot further make it a lot more complex um and you end up with this big sprawling network of nodes that seems completely impenetrable to newcomers and we're not going to do any of that we're going to create a material that's way more powerful or equally as powerful as some of the best landscape water materials you can get on the marketplace but you're going to understand it and it's going to be set up in such a way that you can easily go in and modify and make huge sweeping changes in a matter of minutes i hope to ram the point home by the end of this video that making landscape materials isn't as complex as you might imagine it to be or nor is it as complex as it once was and that's all thanks to the brand new material layers workflow that exists inside of unreal previously in the last video if you followed along it takes a really really long time to go through and to set up all of the names of the parameters and then if you want to make a change to the way the material works and you want that change to apply to every layer let's say you want to add some macro variation let's say you want to reduce the specular shine on the landscape you have to go through and do that on every single layer individually that that means creating a new parameter that means naming the parameter that means assigning the parameter to a group so that it's easy to find it when you're working inside the material instance wouldn't it be great if there was a way to just set up a single layer to do that one time and then to have that be a reusable function that you can reuse throughout your material instance without having to go and create the the names for each layer individually and wouldn't it be great if inside of the material instance if you wanted a new layer you don't have to go back to the master material and set it up in inside of the node graph you just hit a little plus icon to add a new layer to the stack like in photoshop and it automatically creates a material for you and does and and you can set up the blending however you want entirely inside of the material instance well thankfully that exists uh some material layers and that's what we're going to dive into now so let's begin this is the material that we created last time uh it already looks pretty good and you could you know reduce that tiling by blending in a few different layers but it would take a lot of time to go and do that if you were using the traditional method in previous versions of unreal dating back to i think 4.24 or 4.23 you had to go into the project settings and you had to enable you had to search something called serial layers and you had to enable the material layers i can't remember it was in the project settings or it was in the editor preferences i imagine project settings but if you don't find it there have a look at the preferences if you're in an older version of unreal and you had to go and you had to actually enable the material layers feature so right now all in the editor preferences you can find the example layers and blends switch here which will uh just make that workflow a little bit more intuitive and i believe that this will automatically be tipped and set up already so as a 4.27 and possibly 26 there's no need to go and enable the layers and blends they're already set up by default so i'm going to click on the landscape and i'm going to navigate to where this landscape beginner is set up and we're just going to create an entirely new master material we're going to call this m landscape gobt here because that's the silly name i gave this series on youtube and we're gonna do the same thing that we began with last time which is we're gonna turn on use material attributes so we get rid of the mate material attributes there and now we're going to search for a node called layers and you can see that we find a node called material attribute layers i'm going to name this landscape layers and this is kind of a bizarre node it doesn't really behave like any of the other nodes and and this is effectively what allows us to take full advantage of uh this and this new material paradigm we don't really have to do much else inside of the master material itself uh so you can see that with this selected we've got this little layers drop down and by default we have no layers because we haven't created any layers so we need to go ahead and set up a basic layer function that is going to be the basis of all of the layers that we use on this so we're going to make it once and then that's going to be the layer that we use everywhere so i'm going to make a new folder and i'm going to call this obture landscapes and i'm going to move that away better here and now inside of here i'm going to right click again and this time i'm going to go and create a material layer so this gets the little like the same icon as a function because it is in essence a function but it's a function with a couple of special inputs and outputs so i'm going to type ml for material layer i'm going to call this landscape basic so this is going to be a basic landscape material and you'll see i'm not going to close next i want to open and you're going to see with this open we get the input material attributes and we get the output material attribute so basically it can take in a material and it can pass out a material and then we have this set material attributes which currently doesn't have any attributes being set so that's not what we want to do what we want to do is we actually want to set up all of the layers that this that is going to comprise our uh our basic material landscape and basically comprises some a single landscape layer so i'm going to click the center attributes i'm going to click i'm going to click plus here one probably four or five times and that's going to bring up all of these layers now i know that we don't need to set the metallic so we're going to ignore that we're going to we're going to delete that one we we do want to set respect but we do want to set the roughness we do want to create a normal as well and we possibly want to pass through an admin inclusion but tell you what yeah so for the time being that's what we're going to do we're just going to keep it to those five layers and i'm going to create a texture parameter texture an actual texture sample parameter 2d i'm going to call this one color with the english spelling i'm going to create roughness i'm going to create the normal i'm going to create ao as well now there are lots of things that we could do to optimize this material such as packing our textures but that's going to be the subject again of a future tutorial so and there's plenty of resources about it online which i'll make available in the description too so i'm just going to select all of these notes and i'm going to do the same thing that i did last time when the textures were not displaying correctly on the landscape i'm going to preempt that issue occurring again and i'm going to set the sampler source to shared wrap setting it to shared wrap increases the number of texture samplers that we're allowed to use inside of unreal uh inside of a single material from i think it is 15 or 16 up to uh it might be i think it's over 100 i can't remember exactly how many but it greatly increases the number of individual textures you're able to use in a single material like this and i'm just going to hook the color into the base color i'm going to have the r output there of roughness i'm gonna hook in the normal ambient occlusion again just for the r channel and then i'm just gonna hold s and click to create a specular value and by default i'm gonna leave that on point one now let's leave it on point five since that's the uh since that's what it defaults to if you don't plug anything in so we've created this now we need to make sure that the sampler types are set to the correct sampler type so this normal currently is set to color so i'm going to set the uh the default normal to be uh bass flat and normal that changes the sample type to normal and then for the ao and the roughness i'm going to change that to white square texture since that is uh going to for the roughness make it fully rough and for the ao i mean no ao so this is kind of our blank setup in a sense of a single landscape layer i'm going to apply i'm going to save we're going to go back to this uh landscape layers the actual master material where we've put our landscape layers node and then for the for the for the layer asset you're now going to see we get this ml landscape basically created i'm going to plug that in there and that's you can see the output has changed so so that's what it's displaying by default it's displaying that basic layer that we set up in the function so at this point i'm going to create a material instance from the landscape material master material so i'm going to create material instance we're going to call that mi gt landscape and i'm going to pull that over and plug it in on into the landscape materials slot on the train we're going to lose all of that lovely texturing that we set up before let me just get this okay so that's not a problem we're going to open up the material instance now and you're going to see that in the details panel which is where we were previously working with the old material to change all the parameters we get nothing apart from a few default presets including the m underscore landscape underscore god tier which you can see here so what we've got now which is where we're actually going to work is this layer parameters drop down uh up here and you can see that we've got this background layer that we set up inside of the master material it's called background so this is the first layer that gets spawned but we also get if we open this up access to all of those parameters that we defined inside of the material layer and not only that we can click this little plus icon here to create a new layer we can sample that same material layer and you can see that it's taking a little while to compile the shaders here as it gets everything set up under the hood and then if we expand that drop down we get access to those same texture parameter values and scalar parameter values that we define in the material layer but they're not going to override those for the background these are just to be clear these are two entirely different layers it doesn't matter that the parameters are named the same in here and this is really powerful this is how we go from having a really static inflexible and slow workflow when creating landscape materials to being able to iterate on the fly in seconds rather than minutes or possibly even hours so okay we can go ahead i'm going to name this layer grass here because it's useful to remain organized and then i'm going to create another two layers too i'm going to create the sediment layer and i'm going to create the rock layer and then inside of here i'm just going to have to hook up each of those and once they're all hooked up you're going to see that the same parameters exist inside each of those layers but this isn't all that the landscape material layers work for asks of us if you have a look under the each layer you're going to see that you have a layer asset you also have a blend asset and the blend asset is really important it's not it doesn't define the look of a single layer itself but it's an asset which defines how that layer gets blended in so if you remember if we go back and have a quick little look at the previous material we're using this node called blend material attributes and then we're plugging in a layer sample uh in this case sample rock into the blood material attributes there and if we follow the chain back up it's just going from the main material attributes that's the a input this blend material attributes and wherever there's uh this sample grass it blends in b which is grass and we're going to do the same thing but we're going to do it inside of this new material creation paradigm we need to create an outset called material layer blend i'm going to call that mlb and we're going to call this last layer i'm going to jump inside of this double clicking it and by default it's already set up pretty much everything for us we just need to input one thing you can see it says it's handily named bottom layer top layer and output there and we just need to define the alpha so how we're gonna define the alpha you might have guessed it we're going to just take a sample grass in fact i'll search in here and i'm gonna type in landscape layer sample there we go sample none i'm going to change that to grass and now i'm going to plug that into the alpha there and hit apply save i'm going to go back into the material instance i'm going to close the old material because it's just up there floating and i'm going to get it out of my out of my taskbar because it's uh taskbar is that the taskbar bookmarks and it's just in the way um so now on this layer called grass i'm going to go where it says none down here and you can see we've got a bunch of layer blends by default but we want to use the new material air blend brass layer so i'm going to plug that in there okay no by default we're not going to see any change and that's because we haven't defined the layers look different in any way at this point so in order to do that i'm going to go back i could just plug in the textures but before we do that i'm just going to add a functionality to the material layer that i i know all of the layers need to have and that is the ability to tint the texture so i'm holding i'm going to hold m on the keyboard and click to put down a multiplying v on the keyboard and click to put down a vector i'm going to call this tint by default the tint is going to be white that is no tint at all i'm going to multiply that in there and then i'm going to hit apply i'm going to hit save and if we go back to the material instance and in the grass layer go down we see there's a new vector parameters drop down with the tint parameter available there and i'm going to make it red so in theory i should see that applying to the terrain now why am i not seeing that applying to the train well you could be justified in thinking that it's because we haven't assigned a blend layer to each of these layers above this and they're higher than this layer in the stack so perhaps not having a blend layer is equal to filling the terrain with that material so it's not that even though that is a logical conclusion to come to so what happens if we go into the viewport again and let's press shift two to jump into the landscape editing mode we're gonna see that we've got these question marks next to each of the layers uh in the panel here so what does the question mark mean does it mean that the layer no longer exists well let's have a little look let's go and have a look in the visualizers and look at the layer debug and press r g and b and we can see that all of the layer information is still there so we've still got the layers we didn't lose those somehow so what is the problem well the problem is the fact due to a slight kind of peculiarity of how the material layer system is set up if you don't reference the uh if you don't reference the landscape layers inside of the master material the top level of the material itself then the landscape is not going to know that they exist and it's going to give you this little question up so it's not going to know where to apply those lanes so how do we get around this we've set up our layers samples inside of the blend assets themselves now this is perfectly logical and intuitive unfortunately it doesn't work so we're gonna have to do something that's a little bit less logical a little bit less intuitive well it's still logical and i'll explain to you why it works but but it's not a conclusion that you might just arrive at quickly uh so i thought about this for a little bit how are we gonna actually get the the data and we're going to set up a layer so let's let's just do that first of all let's declare these layers inside of here now okay we've got them into our in our master material the main layer and we've also got them declared inside of each of the layer blends and um we somehow need to replace the reference to this we need to pipe it directly from the master material through the landscape layers so that it comes out and we can use it inside of the blend layer so how do we do that okay well we're going to have to abuse a certain aspect of how the material uh material sets up we're going to have to take advantage of custom customized uvs so customized uvs are just like uv channels in essence if you imagine you have a static mesh uh it's you have the uv channel zero which is where you store you you which correlates to your texturing information if you're just using baked lighting you might have another uv channel which you use for the light maps but you can actually have up to i think unrealized you have seven or eight different uv channels and each of those can contain custom data so we abuse that in a lot of different ways we abuse that to create wind that's how speech tree handles its wind as it stores custom data in the uvs uh it's how you use you use pivot painter pivot painter one stores uh information relating to the pivots in the uvs but we can actually uh use these uvs to carry any sort of data and you're going to see if i just do a quick make material attributes am i going to get any of those no we're not going to get them here so what i've got to do is actually i'm going to go as set material attributes now remember that's the same thing we did inside of the material layer itself set material attributes and the set material attributes is just like a make lay make material attributes except it allows you to be a little bit more selective about which ones you override so it keeps things neater that's all we're using this for um but it also allows us to add a few attribute types i'm gonna add two and i'm gonna use the uv channel one and uv channel two okay so we've got these two node inputs which by default won't do anything unless we make them do something and what we're going to do is we're going to use those to carry this data these layers that we've set up in the master material the main material and they're going to get channeled into the landscape layers first of all they're going to get channeled into the landscape basic as that's the very first base layer and that's going to get sampled here in this input material attributes so this is a function input which is going to take these material attributes that we pass through here this then gets carried forwards and we're setting the layer parameters the specific layer parameters base color specular atlas normal ambient exclusion but at this stage we're not overwriting those customized uvs which are getting channeled through so they get preserved we take them through to the output material attributes now after this output material attributes we're going to jump inside of the material layer blend and you're going to see we've got this input bottom layer and input top layer so what these inputs carry over is they carry over this output material attributes that comes from the layer itself so if we just go through that all once more we start by setting up the customized uvs which contain our layer data so customized uvs are two channels each so that means we can plug the grass and the rock into uv one the sediment and another into ub2 and however many we want to add then we pass that into the landscape layers inside of the first landscape layer that gets carried over we set the material layer attributes but preserve those uvs they get passed as an output of that layer into the blend layer where you can access them both from the bottom and the top now if we were to do a get material attributes in here you're going to be able to pull out whatever you want you could pull out base color metallic and if you were to pull out the base color from the top and the bottom layer they would be different but because we're never overriding those customized uvs we could pull out the customized uv from either of these layers and it's going to be that same layer info that we set up in the master material so let's go ahead and see if that works first of all i'm going to go back to the master material and i'm just going to make another node called make float 2. so this is making a two-dimensional vector okay like texture coordinates it's just two dimensions but in this case we're going to use it to pass through our layer weights so i'm going to pass that there into the uv one and i'm going to make another one for sediment and leave the y empty for now uh x and y isn't really relevant to what we're doing it's just the name of the channel if you imagine we had a vector parameter you have the r g and b and essentially x y and z is the same as rg and b it's just a different different label okay so we're passing these through here and we need to make sure that these are actually going into our landscape layers so after we have set up all of this inside of the master material we're going to jump through uh we don't need to do anything inside of the material layer as that is only responsible for setting up the layer specific parameters like texture information but we are going to go into the material layer blend what we're going to do is for the material layer blend grass first of all we're just going to check which pin contains the grass so it's simple sample grass goes into the first float value of customized uv one okay so if we go back into the material layer blend grass we've pulled out the customized uv one and now we're gonna use a node called break float two components and this is gonna bring out the r and the g so bizarrely in here when we make the float 2 it refers to it as x and y when we come through here refers to it as r and g these two channels are the same r is corresponds to x and g corresponds to y i don't know why that naming convention isn't consistent okay so right now where we're using this sample grass instead we're just going to pipe the x or the r out of the break out float two components into the alpha in place of that and now what happens if we hit apply let's jump back out and jump out of the landscape mode jump back inside and what i was expecting to see is i was expecting to see this grass layer info become populated so why hasn't that happened let's see what we're missing out i suspect that it's just a peculiarity of how the uh of how the the uh material layer systems work so i'm just going to go ahead and apply and save the uh the landscape uh master itself as well to be doubly sure and there we go there you have it now that we've saved the master material itself we can see that we're no longer getting a question mark for each of those layers okay but we're still not seeing anything on the terrain so why is that well let's just go back into the material layer blends and fill out both the rock layer and the sediment layer as well uh in a similar manner to the way in which we've done the grass layer so i'm going to copy this into the rock i'm going to double check in the mass material the rock is indeed in the second float value of the first uv channel and then i'm going to make sure that i'm getting the material attributes from the top layer although it doesn't matter whether i get it in the top of the bottom and then i'm going to override the rock there too and then we're going to copy this one more time into the sediment and this time we don't want to get the uv channel one we want to get the customized uv2 and we're going to get the r the first float value of the second uv channel okay we're going to hit apply we're going to hit apply and then i'm just going to press ctrl shift and s to save everything now we jump back in here let's go back into the material instance and quickly set up a blend layer for each of these we're going to set up the sediment we're going to set up the rock and let's apply a different tint to each of these layers and there you have it we've now piped the layer information from the master layer we've passed that through the custom uv channels into the landscape layers node it gets passed through each layer where we set up the other parameters that define the layer itself before finally being handed into the blend where we then extract the corresponding layer information and use it to drive the blend and although that takes a little bit of a setup now that puts us in an amazing position and the amazing position that we're in is that we have this new material instant setup where we can go in and define different textures and other various parameters relating to how we want the terrain to look so let's quickly plug in all of the textures for each of those layers and there you have it we've set up each of those layers and they uh they have the textures applied um and we need to do a little bit more work now because the tiling the tiling scale is clearly wrong and we're going to take the terrain material just a little bit further and this is where we're really going to see how this layered setup has been a massive boom for us in terms of the time it takes to iterate on the terrain so in in in no in no particular order the things that we're going to look at now just in this latter half so we're going to deal with how do we reduce this appearance of this tiling here we're going to introduce some sort of macro variation color to each of the layers we're going to get rid of this really glossy looking terrain um because in real life terrains don't look anything like that um they become very very rough as they get further and further away it's more towards grazing angles um so we're gonna look at how we can combat that and make it look a little bit more physically correct and what else are we going to do um i think that will probably just about do us for this session maybe we can create a quick slope based blend as well to add to uh to sort of additively adjust each of those layers so okay first of all let's jump in and see what we can do about adding some more variation into the uh into the into each of those layers to reduce the appearance of tiling and to make it look a bit bit better from further away so okay first of all we need to add the ability for us to control the amount of tiling at each of those layers so what i'm going to do is i'm going to go inside of the material layer basic asset and i'm going to create a landscape coordinates node and we know that our landscape is 4033 by 4033 i'm going to apply a little multiply node i'm going to hold m and then left click down to put down on multiply hold s and click i'm going to type in mapping scale there by default i'm going to set that to 1. and then we're going to take that output and we're going to plug it into each of these okay great so now we have the ability to control the amount of tiling but that's only part of the picture when it comes to how do we reduce the appearance of tiling because with this control we're only going to be able to make it look from one certain distance anyway let's have a look let's apply that and set it to a scale that feels kind of ripe from let's say far away to begin with go back into the material instance and let's change that mapping scale a little bit shall we we wait for each of these layers to compile okay i'm going to set the mapping scale to i'm going to go to a layer that i can actually see the difference on to begin with there we go 10. that's already starting to feel a lot better so i'm going to do i'm going to do 10 for each of those layers to begin with okay so i'm i think that's looking reasonably good from far away it's a it's interesting there's some variation i haven't spent a lot of time picking the perfect textures or authoring the perfect textures and that's definitely going to be the subject of some future tutorials um what i'm really interested in is just how can we create kind of like a convincing impression of a natural terrain in as little of time as possible so now now that we're in zoom this close uh now i'm going to zoom in a little bit closer and obviously it starts to fall apart at this distance and i'm going to quickly go and place down a cube uh so that we have a good sense of like so we have a reference for the scale of a person i'm going to set it to 1.8 meters that's the houdini access for up the axis for up there axi axis i never know how to say that word and i'm going to do 0.5 on each of the other channels just to give us an idea of a person and if we were to fly into the uh sort of fly in position ourselves inside of the cube at roughly head height you can see this is where we get and the drain's looking all right from far away although it's still a bit well i say bit i'm much too specular um but then when we look at it up close it's it's clearly falling apart so okay that's going to be the next thing we deal with how do we add in the detail texturing and since in this case i've done the macro textures first how do we plug in some detail textures to ensure that it's looking good up close now a popular way of doing this is to actually blend between the two using a lot based over distance and i'm not really a fan of this approach because it um i don't know what the correct phrase would be but it breaks the um coherency of the scene i how how do i explain that a little bit better if you actually replace the texture information based off of how close you are then then it's no longer in any way you could no longer in any way argue that it's physically based um you could you you you're you're actively switching between the two textures and as you when you're when you're here and you're you're you know looking at train from afar it's going to look completely different to when you're looking in close down here and if you were to fly the camera forwards and backwards between those two and you would see those textures changing even you can make the blends look really subtle but if you actually just switch the textures uh it's uh it's going to be there for people who are looking for it and i'm what i'm what i'm more a fan of is a technique that i discovered from a blog about world of tanks and how they handle their landscape blending is i'm actually just going to modulate the colors by by using another texture that i'm going to blend in to this and we're going to create some controls that allow to allow us to define how much we weight each of those layers and it's not going to change over distance we're going to find the values that work both close up and both far away so let's go in and have a good look at setting that up we're going to go inside of our ma of our material layer and the first one that we're gonna we're gonna worry about the one which in my my opinion is the most important is color we're gonna create that detail map for the color so i'm gonna call this detail color and i'm gonna create another multiply here i'm going to call this detail mapping scale and by default we're going to put that on to 10. so 10 times the default of the other no you know what i'm going to put the other default to 10 because that's what we've settled on in the material instance and i'm going to set this one to 100 so this one is 10 times higher frequency detail than the other i'm going to apply that into the uvs there and now if we were to apply this we could just replace the material but it's just that all that's going to do is completely overwrite it so what we need to do is we need to come up with a way of blending so how are we going to blend well um if you remember i mentioned that world of tanks blog they outlined a really nice way to do blending between colors unreal does have its own detail texturing that you can use but i'm going to show you how we can set up our own so the way i'm going to do that is we've got our macro color here and we've got our detail color here well we're actually going to convert this to a texture object so okay i'm going to go it looks like i have to just make a new one from scratch i'm going to create a texture object parameter i'm going to call this detail color i'm going to set the default to be the same as the the non-detailed default come on why are you not letting me do that so sometimes if you hit this little icon and then you try to apply it like that it's not actually going to do anything so what i need to do is i need to make sure that i've got the content browser visible select that texture and then apply it there there we go and then we're going to just turn this into a regular texture sample oh that's a font sample texture sample so this is no longer going to be a parameter okay so if you remember the difference between a sample and an object is that the sample uh is looking at the object and then it's converting it into a format that the material editor can use elsewhere to do further operations on the texture object is simply a reference to disk but we do need is simply a reference to the file but we do need to sample it at some point so we're going to have to use a sample anyway so we're going to create a single texture object reference and we're going to create two texture samples which both sample the same texture okay so this is a little bit of a wasteful way of of doing this but it creates a nice result and i think it's going to be worth exploring it see what kind of look we can get and then we're going to plug the same tiling factor into both of these uvs here okay so we've got our detail texture and then we're sampling it twice with the same tiling factor now what we're going to do is we're going to grab one of these sorry just one and we're going to change the mip value mode i can actually yeah there's one thing i need to remember to do which i need to set these all to shared wrap so we don't run into that texture limit restriction but then we're going to select one of these samples and we're going to make sure that the mid value mode is mip bias so mip bias if you're familiar with how mit maps work is mipmaps let's go to a texture and actually have a look at it we can have a look at the different mips for this texture we have our one our main texture that we've imported which is a certain resolution the mipmaps are simply lower res blurrier versions of the same texture and we compute these for real-time graphics because it's more memory efficient to load up the smaller textures and also because uh it reduces the appearance of aliasing on objects far away and aliasing is an artifact you get when you have high frequency detail that is higher frequency than the number of pixels on the screen so it starts to create a shimmering kind of effect so that's why mid-maps exist but we're going to take advantage of the fact that we have both a sharp version of a texture and a blurry version of a texture we can sample both at the same time so we've created a mip bias and you might realize now that we've done that that if we create a scalar parameter value and plug that into the bias here we can actually control how blurry the texture is so let's have a little look uh have a look at this one okay so the tiling factor but for just for the sake of viewing this in the viewport i'm going to disable the uvs for now so you can see this is our sharp version of the texture now if i switch to the other one and plug back in the bias and we start to ramp up this bias you're going to see that we start to create a really blurry version of the same map okay so let's plug back in the uvs okay so what's the point in doing all of this well the point in doing all of this is that we want to get the detail from this map but we want to get the color from the global variation map and if we add both of these maps together then it's going to produce quite an ugly result so i'm just going to show you what that would look like before we actually take advantage of this biased mip version here so for the time being we're just going to see what that looks like we're just going to add together the unmip biased version unmet by sample of the texture with the default texture i'm going to see how that looks so i'm looking at it in the uh in the edited viewport now and uh i realized that i've still got the uh the layer tinted above the the sediment layer tinted which is which is kind of uh distracting me from looking at the result a little bit and it's actually also very noisy normal so i'm going to add in another control to the layer before proceeding to which is i'm going to add in a control that allows us to control the normal intensity and uh we're going to put in the node flat and normal i'm going to call this parameter flatten normal and uh by default i'm just gonna put this onto one actually no i'm gonna put it in here on one i'm gonna do that in the materials so by default it's going to be off what flat normal does is it just weakens the contribution of the normals and a value of one is completely off so i'm to do that for each of the layers just so that we can see while we're working the influence purely of the base color and the yoyo and the other knots but but normal is the one which is kind of getting in the way of being able to judge for ourselves how that's looking so okay so adding those two together and you can see you can see that the result we get is uh just very bright and uh mainly what we're getting actually is the higher frequency texture showing through without much of the under other layer kind of contributing to the end result so why is that well the reason for that is because the brighter of the two textures is always going to be the one which is more visible so what i'm going to do for the time being is i'm actually just going to apply the same texture at two different scales to each of those layers and that's going to help a little bit but and and you see if we go if we go into the uh to the is this the grass i think that that is i'm not sure what that is that is the sediment okay so we go into the sediment you can see we've got some some sharper more defined details in there and we've also got these kind of big splodgier details for the for the larger terrain but uh but yeah no it's it's it's not particularly clear it's over brightened the texture we don't really want to make the textures brighter like this we want the overall intensity to look the same so but we want to get those details anyway so the way that we do that is we before adding in the high frequency version of the texture we subtract the blurred version of the same texture like so there you go you can see that although we're getting quite a lot of uh a lot of specular information which is kind of washing out the scene uh we've got the higher frequency details being very clearly displayed on the terrain so i'm just going to get another little cube and chuck them down here 1.8 always always always it's the vein of my life being using two softwares with different up axes okay but if i zoom out now you can see we're getting that nice macro scale variation that we had to begin with but if we zoom in we've also got some texturing information that is on a more appropriate scale for user now i'm just going to tweak those mapping scales and the bias a little bit to try and hone in on the look of the landscape a little bit more closely so i'm going to set the mapping scale of the detail texture to a thousand there we go and i'm going to set that for each of those layers as well so let's go up to the the moss one here and put the detail mapping scale to a thousand for you as well there it is and uh then let's go up to the let's ignore the rock for now because it's only over there on the horizon anyway we can't see it and uh what we can do is we can actually tweak the bias of the uh of this texture of the of the blurriness so the lower the bias there you go the the so if we make the bias really low we're not going to actually get any of that detail in there and the higher the bias we make the more we make the bias high like this the more of the details from the underlying texture that we can blend in the different kind of scale so as a value of one or two or three this is only going to pick out the smallest details but as we make this higher we can get some of that nice variation that we want i'm thinking a value of a value of six is looking quite nice for us there but what i don't particularly like is that all of the layer layers um sorry all of the spectral information and roughness and normal information is actually only happening on a macro scale so i'm going to go ahead and inverse the mapping scales of those two terrains and i'm going to flip around the uh the texture coordinates so that these are all of the detail textures and this new one that we're introducing is actually the macro texture so the way i'm going to do that is i'm actually just going to grab the mapping scale and flip them over like so and then i'm going to hit apply right so now you can see we're getting the specular information uh on the smaller scale um we're still getting that macro color variation when we zoom out now it doesn't look quite right and the reason for that oh it's actually partially because i haven't assigned the correct texture to one of the material layers so let's have a look at what that's going on there um looks to me like it's the background layer is showing up through some of these other layers so i noticed as well that despite not having a weight supplied to it the background layer is still clearly showing up through all of the other layers so the background layer is in if we go back to the material instance you can see it's the one which doesn't actually have any material air blend assigned to it it's just the one which exists as a kind of foundation and material and it's the one which we assigned in the landscape uh in the master language landscape material as a background the background needs to exist but you don't get to control where it's applied it's applied everywhere so we want to go ahead and recreate the same kind of setup we had in our beginner landscape where we just have a blank layer as our default layer so okay how are we going to do that it's quite simple we're going to go to the folder where we created our other material layers and we're going to create a new material layer i'm going to call this ml none if we jump inside ml none have a little look this is already doing everything that we need it to do which is it precisely nothing then we're going to go back to the parent material the master material and where we assigned that basic layer we're actually going to assign that none layer so by default we get this black sphere now apply and save jump back into this viewport that hasn't worked so we need to go to the material instance and make sure that this indeed is also so you see even though we changed it in the master material it hasn't actually updated the background layer used inside the instance yet so i'm going to hit this little yellow icon to reset the default just going to set that to none we're gonna have to wait a second while this compiles and now you can see that we've lost that erroneous layer so if we zoom out a little bit you can see that we're not getting any massively noticeable tiling which is great and also if we zoom in down to one of our little cubes here you get a period where the texture that the mac protector appears a little bit blurry but as we get closer you can see that we have the nice uh high frequency detail that you want to see as a player so that's great now with this macro texture that's scaling across the entire map there it looks good from far away although i mean we're not really using the appropriate textures as mentioned before so you could you could get a lot closer by having a more appropriate macro variation texture with less contrast uh with uh less sharply defined features and then you would no longer see these kinds of like weird blurry grass strands which are clearly way larger than they should be as you zoom far away and that's going to work a lot better okay so we've got high frequency detail we've got detail far away now we need to deal with this weird specularity this super glossy terrain material so you what you could do so you could go into the layers and you could just go to that specular control and let's let's go and turn that down this is going to get you part way there i'm going to go to each of those layers it's going to get you partway there but it's not really the whole picture there's something else we need to do first before we jump back inside the material to do what i plan to do next we're going to turn off the flattening of the normal so that we actually get some normal contribution back in our scene there we go and uh yeah we've we've got our normal detail back so the ground's gonna look a lot better now um but what we need to do to get rid of the specularity is we need to go into the material layer and we need to compensate for the fact that the terrain as you look at it at a grazing angle is going to appear rougher and rougher and rougher and rougher do you imagine that we have a terrain that looks like this it's just an abstraction you might see some light that bounces off when when you're standing here or like let's say here when you stand here you might see some light which bounces down at a grazing angle let's say or let's say here and into your eye and that's what that's what we call a specular reflection and you're going to get a few of those up close due to the reflections of sort of smooth objects in the ground blinking right back towards you but as you get further and further away the angle that it would be required to the angle that would be required for that to bounce into your eye gets smaller and smaller and smaller and smaller and there's more and more detail to the point where where you might have a few glints up close and a nice reflection there far away it's going to be basically the appearance of a fully rough matte material so the way that we're going to do that kind of distance based influencing of the specularity is we're going to use or right angle based in essence we're going to use a node called fret for an l and we just preview that fresnel node you can see that it's it's finding the angle of the of the object we're looking at and then it gives us a uh a black to white kind of uh ramp black being um if i say black it's light gray if i change the exponent into zero that's going to become uh no bass reflect action sorry if i change the base reflect faction in there then we're going to see that it's a zero value of zero on uh on those angles which are more perpendicular to the viewer um and then those which are at grazing angles are gonna be one so we're going to take a lot out of this and we're going to plug the output of the fresnel into the alpha and then we're going to make the b input that is the no we're going to take the a input that's going to take our specular value so that is the values closer to black like so and then we're going to um set the b input to zero so that's going to take the fresnel down to the specularity down to zero and we're going to plug that into the specular now you can see that this appears mostly white there isn't actually a huge amount of difference between when we look at the raw specular value of 0.5 and the alert of an alert that's lurking between 0 and 0.5 so we can change the influence of this fresnel by then creating another uh spec scalar parameter and we're going to call this uh let's call this fresnel specular exponent let's call it that it's not really a correct name but we'll go for that anyway we can see that the default oh it doesn't actually tell us what the default of the x1 is so by default we're going to leave that on zero no we're not we're going to take it up to 0.5 one two five okay because the higher it gets the more the white contributes so we're gonna go for a lower value and there you go i think i'm quite happy with setting that to the value of 0.1 default value for the spectre of 0.5 i'm going to stop previewing there and now we're going to hit apply and see what happens to our terrain okay that's more like it it's still not perfect um we're getting quite a bright specular reflection uh and the specularity is actually still a little bit uh a little bit higher than i would like it to be so i'm gonna go into each of those layers now let's go into the material instance i'm going to minimize that viewport because it's not really very useful i just want to see inside of the game viewport itself and uh we've got the specular exponent so let's see what we can do for each of these layers i have a i have a feeling that our nun layer might be contributing a little bit here because the default value for specular is 0.5 so just to be sure that's not the problem i'm going to go in here and i'm going to set the specularity of that layer to zero and see if that fixes the issue okay so there we go that's dealt that's dealt with that issue there and you can see we've now got a much more matte much more match result which i'm a lot happier with i'm going to raise the right angle there two okay cool so uh that's starting to look a little bit better you're going to notice that the the because of the high frequency and um sort of not appropriate textures we're using that the terrain it looks a little bit weird when you're in this kind of middle distance but as mentioned before that can be helped by using a better selection of macro textures but you can see when we zoom out a little bit further this is starting to look you know pretty pretty good at least i think so and uh if we zoom in close as well it's starting to look reasonably good up close just a bit too contrasty in that kind of middle distance region okay so uh so what next well i think i'm probably going to be pretty close to leaving it there for today as this is kind of a great foundation or material now that you could uh you could take take on take a bit further apply some some better textures too and then start thinking about things like scattering grass as well um so yeah i really think that at this point the the the material itself is a really solid foundation and the next stage to start making it look a lot better would be really to start picking a few different better better textures and once we've once we've done that we could uh you know come back to the material and refine it even further so the last thing that i will do before uh before kind of clocking off is i'm going to introduce a little bit of automated slope-based blending into this terrain material as well so if you remember all the way back in in lesson two um i mentioned that we didn't need to create a layer mask based off of the slope inside of houdini because the capacity to do that inside of unreal already exists it's very easy to do so the final thing we're going to do is we're going to go to where we've created our material layer blends and we're going to create a new material layer blend i'm going to call this one mlb slope i'm going to open up that material layer blend and for the alpha for this one we're very simply going to create a slope mask i'm going to set the full off power set the contrast and by default if i set the falloff power to one set the contrast to zero you can see it's going to pick out the uh it's going to pick out the top most and we actually don't want to pick out the top we want to pick out just the uh just the side regions so what we're going to do is we're going to do a one minus on that result that we get there and then as we increase the falloff power decrease the fall of power yeah as we decrease the falloff power and increase the contrast let's go to 0.2 0.3 this allows us to sort of pick off pick up the slope angles that we want this this let's texture and since we've made these parameters we can just modify those in the instance at the end of the day so i'm going to assign that in there to the blend material attributes we're going to jump into our material instance there it is we're going to add a whole entire new layer i'm going to call this slopes we're going to set this to the material landscape basic same as the other layers and we're going to set this to be that new mlb slope that we created it's going to hit save once we've done that i'm gonna wait for it all to update there we go so that's now applying everywhere but if we go into the blend if that's not sorry that's not applying anywhere at the moment but if we go into the scalar parameter here and let's start playing around with these values okay all right now let's actually define the layer itself uh we need to go to where our textures are stored let's get that same icelandic cliff texture that we were using previously apply the uh by the color textures apply the normals by the roughness there we go and uh that's it for today um i hope that you've seen how easy it is you could add as many of those different slope blended layers you could have directional blended layers just by changing the angle of that slope uh you know what let's let's just go ahead and do that as well uh just to prove how easy it is we're going to go into the material blend layer and we're going to change the uh the angle um so what's the default angle it's zero zero one so we wanna keep that at zero zero one and plug that in there and hit apply we've updated the slope functionality to now have additional controls for us i'm going to delete the i'm just not going to delete them so i'm just going to close these other tabs so that i can see what i'm doing a little bit more easily close the slope as well because we've done all we need to do in there and now with just the material instance open we're going to add a layer called snow because why not every landscape looks better with snow so we're going to create an ml landscape basic i'm going to create a new slope blend and we're going to change the angle this time so i'm going to make sure that it's visible by default so i'm going to make it a bit more have a bit more influence still compiling shaders there we go so now this is applying it's currently applying everywhere basically everywhere um but i'm going to change the angle so that it's no longer sort of um sort of oh is that not there we go so okay that was weird uh you have to minimize and re-maximize to make sure that actually takes effect that checkbox so right now uh blue is is up in unreal that's the z-axis so we don't want it to be up we want it to just be sideways in one direction maybe the other direction okay not working or maybe that's because the full of power is too great so let's just change that there we go 0.1.5 and we're starting to get some sort of nice directional effects happening on the terrain now assign a specific texture to that there so have i got anything appropriate let's go with the rocky soil rather than rather than snow we'll call this like a maybe the sandstorm recently came through here [Laughter] [Music] i think i'm going to position this layer beneath the slopes so i can just do that and just drag it down there and that after i save now means that this rocky layer is always going to show up on top of those so that new dirt layer we added or snow if you wanted it to be snow is now going to show up it's going to be overwritten by those steep slopes and uh that's that's probably it for today um [Music] just let's oh let's go with that all right we're done finally um all right so thank you so much for your time uh for for watching this video and uh i hope that you found it useful i hope that you uh can see the how powerful this material layers kind of paradigm working with landscapes is um it will make your workflow a lot faster uh i promise if you're not familiar with working this way yet i would highly recommend adopting it uh yeah that's it for today so next time um we might be looking into not gonna make any promises because i haven't made my mind up yet but we might look into how you can actually make textures or mix different textures to create some slightly more appropriate large scale macro textures for terrains uh or we might look at the uh the scope like sorry we might look at having a uh ex expanding the making like a background so like if you imagine this is your playable environment uh might look at how you can extend that off uh infinitely in or or not infinitely but extending off the horizon so that it looks like you uh you you kind of have you're actually situated in the real world and it's uh you know it doesn't just end and you don't have to use too many fake tricks so we'll be going back a little bit to using real world height map data um using lower res data extending it further away and blending that into this uh this high resolution data that we have for the playable area thanks so much thanks again for watching um if you find this kind of content useful uh then please like and subscribe please share the content around i'd love to be able to make more of it um and uh yeah it's i'm really enjoying it and then i hope to uh and i'm loving all the comments thanks so much to those of you who've uh already liked and subscribed and i'll catch you next time bye
Info
Channel: UNDINI
Views: 58,260
Rating: undefined out of 5
Keywords: God-Tier Landscapes Part 4: Unreal Material Layers - Not just another Terrain Auto-Material, Got Tier, Landscapes, Terrain, Unreal, Unreal Engine, Material Layers, Materials, Layers, Auto-Material, Landscape Material, Realistic Terrain, Houdini
Id: bNCZHlmKfE4
Channel Id: undefined
Length: 57min 3sec (3423 seconds)
Published: Mon Jan 10 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.