How to create an auto material for landscape - Unreal Engine 5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone how are you doing I hope you're having a wonderful day in today's video I'm going to show you how you can create this landscape Auto material to paint the landscape that we created in the last video so if you didn't saw that video I definitely recommend that you check it out so you can create your own landscape so if you do like this video please hit the like button and subscribe so you don't lose any new content let's start first we need to get the textures to use in the landscape so for that I'm going to use Mega scans so let's go here into the quickly add to the project quick of bridge so to use Quick of bridge you need to be logged in into your account so just logged in then you can go here into the home you can go to the surfaces then you can select a type here for first let's get a grass one on so let's go to the grass then I'm going to select this Mossy grass here just select it here you can select the quality that you want from low medium high or highest quality I'm going to leave as high then you can download after you download you can add to the [Music] project [Music] okay after downloading just hit add then the text will be added in in the folder Mega scans surfaces so I'm going to import the other ones here it's the same thing so I'm going to speed up this [Music] part [Music] okay so if you go to the content browser here you can find mega scans surfaces and here are the textures so for this one I grab a Mossy grass for the grass a cliff for the mountains here and a snow for the highest points on this terrain now we can start creating the materials because the material will have a lot of nodes I'm going to separate this into different material functions you can think of material function as a normal material but with an output that you can use inside another material you will know what I mean when you see it so let's start first let's go to the content browser here just press Contra space to open it let's go to content let and let's create a new folder let's call this materials then inside this folder I'm going to create a new folder let's call this landscape then inside this one I'm going to create a new folder for the material functions okay let's open it let's start creating the first material function this will be the graph so I'm going to create a material function for each layer in the landscape so let's right click here then go to material and material function let's name it MF for material function then grass and let's open okay so as you can see we have an output here let's rename the output name here to grass now we can start creating the material first let's grab all the texture for the grass so let's go in the content browser let's go to Mega scans surfaces the grass folder then let's grab all these three textures and drag and drop into the graph like so let me just organize this here okay so now I want to convert this texture sample to parameters so later we can change the textures if we want so let's start with the grass here let's right click convert to parameter and let's call This Grass alido then let's select this parameter in here in the group I'm going to type grass so I just created the grass group here and put this parameter into this grass group so later will be better organized let's do the same with the other textures so here in the normal right click convert parameter let's call This Grass normal and put into the grass parameter so I already typed it so we don't need to type again just select grass here then for the other one right click convert to parameter grass o r d this stands for ambient occlusion Rance and displacement because this texture already have the three Maps inside each channel here so that's why I'm name it like this okay so we have the textures here now we need a way to map this into the landscape with the UVS so we already have a note for that if you right click and type landscape you see this node landscape layer cords this is the UV for the landscape so I'm I'm going to grab this node and multiply so just hold M into the keyboard and left click then you have a multiply node I'm going to multiply this with a scaler parameter so just hold s and left click to create a scal parameter and let's name this grass tile size and let's default this to one and again let's select this and put into the grass group there we go and then we can connect this into the B value here into the multiplyer then the result we can put on all textures here the same result okay we are almost done now let's grab these values and make a material attribute with this so let's right click and type set material attributes in this node we can Define what information we're going to pass in to create a material so you can select this node go here into the attribute set types in this in this array add a new element and here you can Define what information you're going to pass so let's start with a base color let's add another one for the um the normal another one for the occlusion and another one for the roughness here so we're going to have all these four informations here that we have in the textures so to better organize things here I don't want to make like these long wires so what I'm going to do I'm going to create a named route right click and start type name route and let's name this obido and then then we can connect this results here this RGB into this and then in any part of the material you can just right click and type the same name alido and you have that information without connecting any any wire so this will be better organized so actually let's name this base color base color okay and here we have base color just connect here let's do the same with the normal so right click type name it route let's name this normal pick the RGB here and put here then here we can type [Music] normal let's go up here into the name it routes category [Music] normal let's do the same with ambient occlusion and the ambient occlusion is the art channel of this textures so let's add a name it route let's call this AO for I occlusion pick the r here but here then we can just grab this node here and for the roughness is the G channel so let's type a name it Reed let's call this roughness and pick the G Channel now we just need to grab the same Lo here roughness and put here and this is the material that we can go and put into the output here there we go we have the grass here as you can see so later we're going to come back here to make some changes to add more to this layer but for now it's okay let's just just continue so what I'm going to do now I'm going to do exactly the same thing with the other three other two layers for the cliff and for the snow I'm just going to of course change the name to snow and Cliff here in the parameters and change the the group here so I'm going to speed up this part later I come back with the results so let's go [Music] [Music] okay so I just finished creating the last material function it is the same as the grass that I showed you you the only difference here is that I changed the name this is Cliff albo Cliff normal and Cliff or Rd then Cliff tile size in the cliff group same thing same thing for the snow here we have the snow textures into the snow aito snow normal and snow or R Rd and here is noow tile size into the snow group so it it is the same as the grass just repeated to other textures so now we can start creating the main material that we're going to put into the landscape so let's start let's go here into the materials folder landscape here we're going to create a normal material this time so just material let's call this M Landscape and let's open this one let me talk this here okay so first things we need to to check this check boox here the used material attributes if you're not seeing this just click in this main node here and check this one so we're going to check it because in this node here we have the roughness base color the normal but we are already adding these informations here into the material functions for each texture so we don't need this here just check this so it's just one pin here for the material attribute okay now we can go here into the material functions just select all three of them and just drag into the the the main material here and as you can see we have the the the the material functions that we created with the textures here as you can see we have the output name here set it to grass and the is set to result that's because I forgot so let's do now let's go here into the no material function let's select the output and change the output name the for this two no then let's do the same for the cliff so let's select the output node and change this to gliph let's apply and save apply and save back to the main material if you just delete this and add again as you can see now we have the proper name now we need to create a way of blending these textures together based on slope and height so for that let's right click and create a word line blend node this node is basically the slope blend that we need so let's put this note to the side right now we're not going to use this for now so for this note to work we need to pass a blend sharpness and a blend bias so let's create a scal parameter for that so just hold s in the keyboard and left click to create a Scala parameter let's name this grass Cliff blend sharpness so grass Cliff because these are the textures that we're going to be blending together with this node so this will be the blend sharpness here then let's create oh my God let me rename this grass GFF blend sharpness then let's create a new Skillet parameter for the grass Cliff blend bias and let's put this in the blend bias let's also create groups for that so just select one and here in group let me create a group here maybe press Cliff settings just select the other one here and you can select that group there we go okay so basically this is this Loop this Lo blend now we need to use this values to blend this textures together for that we're going to use a node called blend material at attributes we need to use that node because the output of this functions are material attributes so we need to use a bland material attributes for that let's put the grass on the A and the cliff on the B and for the alpha this will be the with explicit normal this value here this is the alpha there we go we have the Blended result here now we need to put this into a layer in the landscape to do that we need to create a landscape layer blend node so just create this node and select it go here into the layers array here the layers list add a new one to that list then you can change the name here I'm going to name this Auto because this will be the AO material layer let's put this results here into that layer then the results of all layers here in the main material node there we go we already have the these two textures Blended here into the material into the landscape as actually let's apply and save let's come back here to the level and let's add the material to the landscape to do that let's go come back here into landscape folder and let's create a material instance for the material so just right click into this material and create material instance let's name this m Mi for material instance landscape so to put the material into the landscape just select the landscape select the material go to the Tails and hit this Arrow here into the landscape material there we go we put the material here and as you can see all the landscape is black now that's normal that's because we didn't create the layer info for that Alo layer that we created in the material so we need to create the layer info so just select the landscape here and here in selection mode we need to change that to landscape let's go to paint and as you can see we have the AO layer here to create a layer info just click on this plus icon here then weit Blended layer and save there we go we created an a layer info for that layer and as you can see all the terrain now is grass that's normal for now let's just come back here to the selection okay so we already added the cliff into the the plane but we are not seeing the cliff textures that's because this parameter are all zero we need to change that so but I'm going to change this in the instance of this material so let's just go back here into the lens Escape folder material instance landscape let's open this let me put this to the side here so we can see the landscape let me increase a little bit here there you go here in the grass Cliff settings that group that we created we need to enable these two parameters and we need to play with these values here so for that I'm going to put 20 for the blend bias and as you can see all the terrain now is that Cliff texture and for the blend sharpness I'm going to put Min - 40 and as you can see we already already have grass on the more planer Parts here but but in the more sloped parts we have the the cliff textures and they are blending together as you can see pretty cool of course you can play with this values so if you increase this the grass will be more pronounced as you can [Music] see just play with this values as much as you want to get what you want so but for now I'm going to leave this as minus 40 there we [Music] go okay now let's put the snow into this terrain too so let's save the material instance and close and let's go back to the main material here let me put this more to the side and let's work with this no now so for this no I'm going to create a height blend so to do that I need the absolute W position so just right click and type position and you find word position here I'm going to use the Z because I'm only interested in the the Z AIS the up and down axis as you can see here in the left corner here the Z which represents the up and down here so I'm going to put this into a smooth step this will basically be the the blend so we just need to pass a Max and a minimum value and actually the Z will be the value here now we need to pass a minimum and a Max for the for the blend here so I'm actually going to going to invert this value so I'm going to create a scal parameter so hold s and left click to create the scale parameter let's name this is no minan minan height for minimum height and this I'm going to actually put in the max height and I'm going to create another scaler but I'm the four is no Max height and let's put this into the minimum here and this is basically the the the blend for the height now we just need to use that value to blend this result here with this is no to do that let's create another blend material attribute let's put here then this no and Alpha will be the smooth step result here there we go and the of course the the results of the blade material this we're going to put in the layer outo here so let's apply and save let's go back here and as you can see all these are no now to work with this we need to of course change this parameter values let me put this first into a group so I'm going to select this and I'm going to type here is no settings so let's go to the other one and just select is no settings let's apply and Save now if we open the material instance let me put this to the side here we have the the these no settings here so let's enable this two and change it value so for the max I'm going to put 20,000 as you can see it already changed and for the minimum I'm going to put [Music] 6,000 there we go but it's inverted like the lower parts of the terrain is snow and the other parts the upper parts are the grass and the cliff I want this to be all the other the way around to do that let's go to the material landscape here let's close the instance we just need to change the order here so the results of this blend this will be into the B and this no will be in a there you go if we apply and save now it's the other way around as you can see now we just need to play with the values here into the material instance to to get the values that we want so I'm going to increase a little bit this one like let's put like 15,000 to see there we go I'm going to increase this to 50,000 okay and let's increase this a little bit to [Music] 20,000 20,000 actually there we go and as you can see now in the highest part of the terrain is snow and as we go down this are Chang into the grass and the clear texture there we go now we have the textures into the landscape with the correct blend but that's one final detail that I want to add here because as you can see if I'm far away from the mountains the textures are really small and we are not seeing the details of the textures this far away so I want to create a distance blend to increase the texture size size in the far mountains so let's do that let's go to the material function for the grass and let's create the blend distance here so I'll be showing you how you can create here in the grass one but it is the same in the snow and Cliff it is the same thing so let's start with the grass so first I'm going to change this parameter name I'm going to call it grass near tle side now because we're going to have the far one too so let's change this named rout to so this will be the near base colar then near normal near ambient occlusion and nearness there we go now we can select all this and press C to create a comment and let's call this near textures so it's better organized now what we need to do we need to select these textures here and let's duplicate it I'm just going to hit contrl C and contrl V here and this one will be the fart textures so let's copy this uh tile setup here let's copy this to let's change this parameter name to Grass far tile size and I'm going to decrease is this value to make the the textures bigger in the screen so let's put here I don't know maybe 0.1 we can change this later and let's just connect this into the UV of all textures and as you can see in the preview here this text this textures is bigger than this ones so it's what we want now we just need to create another name route for all this so let's let's right click and create a name it route let's call this far base color let's create another one for the normal so far normal another one for the occlusion so far AO let me just put here the r is the abusion and another one for the far gness let's put the G1 here and let's select all this and comment and let's let's call it for textures there we go now we need to create the blend so for this it's really simple because and already have a note for that already has a note for that that so let's right click and let's search for distance um distance blend this one in the MK here distance blend okay so here for this to work we need to pass a blength range and a start offset so of course we're going to create parameters for that so let's hold s and left click and let's create a parameter for the blend range so let's call the is grass blend range and let's default this to maybe [Music] 100 then let's create another one for the grass start offset let's default this to 1,000 these are just the default values so as you can if you overover the mouse here you can see the default values here so let's just put here and this is all we need this is already the distance blend so let's select this let's press C on the keyboard and let's call this distance blend there we go now we just need to use this value this distance blend value to blend between these two textures so let's just um delete this for now let me put this more to the side and for that we're going to use a lurp node for each one of these textures so let's create a lurp for the the base color here so we're going to put this distance into a named route too so it's more organized so let's create a named route let's call this distance blend distance blend let's put this here there we go now we can use this in in the lurp here so for that let's uh search for the distance blend that we created here the name and R distance blender this will be the alpha and we're going to blend from the near [Music] texture near base colar actually near base color and the far base [Music] color there we go this we're going to put into the base color we just need to do that for the other two so let's create another lurp here let's copy this distance blend to be the alpha and now we're going to blend the normal so the near normal in the a and far normal into the B and this is the normal let's do another one for the occlusion so near AO into the A and far AO into the B and this is the ambient occlusion and just one more forur the worth this let's create another lurp let's copy this one and let's grab the near roughness and the far roughness and let's put this into the roughness let's just put this two more to the side here and let's comment I'm going to call this Blends there we go let's apply and safe so this is basically the the distance done so we just need to do that into the other two here the snow and The Cliff it's basically the same so I I'm going to speed up this part but first let's see what this does in the landscape so let's come back here there you go as you can see we have the grass texture a little bit bigger and if we get close as you can see see now we have the smaller one so we have this nice blend so let's increase that so if we open the material instance here we have the the grass far tile size let me just put this to the side here so we can see the landscape so we have the grass file tile size and the grass near tile size here and where is the the other values let me go here I think I did didn't put this into yep so let's just select the blend range here parameter let's put this into the grass and the star offset into the grass group as well let's apply and save and let's go to the grass there we go we have here the values so let's just enable this for values here so for the blend range I'm going to put this into 3,000 as you can see it's a little bit far and for the the start of set I'm going to put this minus 5,000 there we go now we have the blend but it's a little bit far away as you can see so if we are here we can see all the details in the fart textures here as you can see so let let's just do the same with the other two the cliff and the snow so for that as I mentioned before it is the exact the same thing so I'm going to speed up this part so let's [Music] go [Music] [Music] okay so I finished creating the distance blend for the isnow and the cliff it is exactly the same as I show you in the grass material function we have a distance blend here let me go to this note to show you I have a distance blend here and a second set of textures for the smaller values here for the tile then the lurs to lurp between the near the and the far based on the distance blend here and I have this the same with the cliff so let's see how this affected the landscape and as you can see now we are seeing in the details of the texture even in the far mountains here but if I get closer this change to the near textures as you can see let me decrease a little bit here I think you can see the blend here from the bigger and the smaller texture as you can see now we just need to to change in the material instance so let's open in this let's start with the cliff one so let's enable the cliff blend range for tile near TI and start offet and I'm going to put exactly the same as the grass so for the blend range is actually 3,000 so let's put this there we go and for the fire tile is 01 okay the near fire tile is one and the rest start of set is 5 5,000 so let's put this minus 5,000 there we go now you can see that close we have the smaller textures but far away we have the bigger ones for the the cliff let's do the same for the snow here so let's go to the snow category here SN group let's enable this [Music] here and where is the blend here there no I didn't apply it there we go now we have the this no blend range here this no far tile there no near tile and start off set I'm going to put exactly the same as the others so let's put 3,000 in the blend range the far and the near tile let's leave as it is and the start off set let's put minus 5,000 there we go so now if we are close we have the smaller one but if we are far away we have the bigger one actually I'm going to increase this note a little bit so in the far tile size let's put a smaller number here let's put maybe [Music] 0.05 so it's a little bit bigger so let's save and close here and there we go we have the final landscape AO material [Music] done and of course we have a lot of repetitions in the textures as you can see here you can do some tricks to hide these repetitions you can maybe change the textures if you want with the parameters in the material instance and you can do some tricks inside the material to hide these repetitions but this video is already really long so I'm going to finish here so if you like this video please hit the like button and subscribe so you don't lose any new content and as always thank you for watching keep learning and have a great [Music] day
Info
Channel: NoWhere
Views: 1,539
Rating: undefined out of 5
Keywords:
Id: Ix8mD0Be-MM
Channel Id: undefined
Length: 40min 56sec (2456 seconds)
Published: Tue Feb 06 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.