Landscape Material Tutorial - Adding Tessellation (Unreal Engine 4)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I and welcome to the third part in this video tutorial series the last two parts recreated a landscape material that now looks like this as procedural puddles and as I has different materials that we can blend between if you haven't watched the first two parts I recommend you do so I'm going to put links to them right here in this part we're going to add tessellation and displacement to this material you where though that there's going to be an expensive material once you add translation to it it's only do this if you're aiming for high-end graphics and if you know that your user base can handle it would I recommend on doing and then what we are doing in our game saying is we have two versions of the landscape material one with translation and one without it and we use two one with translation only on Ultra settings so let's get right to it opening up our landscape material that we created in the last two parts by the way you can add tessellation in almost the same way to all your materials the only different thing that we do for the landscape material is you're going to make the distillation based on the camera distance let's get to that later so looking at all material the first thing we got to do is we got to change some of the material attributes so click in an empty space go to your settings to your details panels scroll all the way down just like now we want to enable tessellation so what you took P and triangles a neighbor crack three free displacement now we're ready to go let's at the moment we have material attributes a neighbor so let's just able that real quick it's all the way up here because we're going to need or were displacement notice later multiplier so make our material work the same way I did before you're going to need to break these results right in Raik material attributes now we're going to have to rewire this so base color metallic Acura roughness bits of color even though we're not using it maybe you are normal and ambient occlusion round here you don't need the other ones we're not using any pixel depth offset and we're going to get our word displacement and dysplasia multiplier from different values let's moved it over here and let's give it a comment output so that we know what's going on here now let's add the distillation first for the distillation what we need is our camera position because we want to have the distillation let me go into wireframe regime you want to translation if we look at the grid of the landscape you want it based on the camera position because what unreal usually does with translation it just takes the object in distance to the actor to repossess and sources lighting in if we do this to landscape it's going to translate all the way back there and if you have a bigger landscape than if' it's going to be a million polygons it's going to be insane so we don't want that you only want to just laid it around the camera and then they can circle or something so in a distance to the camera not the whole object so going back here we're going to get our camera position it is also to get our our absolute word position now we are going to do is we're going to take our camera position and subtract the absolute word position and this we are going to use with a vector length node which basically if you look into the node a basic just takes the distance now what we want to do we want to add some some control over this so at the moment we basically have a a distance from our camera position to an absolute word position and now we're going to take the free vector and we're going to subtract from it oh and really quick make sure you're inputting this into the free vector as well so this abstract let's create a scalar parameter by pressing and holding one and clicking on empty space in the canvas let's put that into our B so this we're going to convert to a parameter and call it the offset and a value of series okay so what this parameter is going to do is and with this we can control from the camera position if we want to offset the translation effect so if we don't want it to happen right around the camera but maybe a little bit before that or further back that's what that parameter is going to end up doing you might don't even either if you have like a first person game or something you don't need it but I think it's kind of handy to have so and then we're going to divide this and we're going to divide it with another scalar parameter look at in here and let's come to do another parameter and let's call this fate distance let's give it a value like a thousand or something so this is the actual meet this is the really important parameter because this is going to define and how far the tessellation is going to going to affect the landscape so that's almost it let's clamp this value just to make sure it stays between 0 and 1 and what I like to do instead of just plugging this into our slash multiplier make sure let me move this over a bit I like to use this as a alpha for alert so ad alert no put it in the Alpha and add two more scalar parameters convert them to parameters and this one has a default value of 1 nope and this 1 of 0 let's give them name first so this one it's going to be the farm distillation this one is going to be the mere distillation actually type this there we go and set this one 0 this 1 1 so now we also have control over how much of tesla's you want going on ok we have that radius now right which is a thousand at the moment and in this thousand units we're going to have full tessellation set at 1 and behind that we're going to have 0 but now that we have these parameters we can actually increase even in the far distance the distillation or decrease it right around the camera if you don't want to have the full effect that's what these are for let's group them let's select all of them and add the group for them let's call it tessellation there we go and now we can use this value let's comment this so that we know what's going on and let's put our translation multiplied made a small error which is the farm and the new translation and these are backwards so let's rewire them so the forward distillation has to be beer and near distillation has to be a we going to apply it and it's going to compile again okay the material is compiled and look in our view put it should look something like that of course only if you enable wireframe which is great because it's exactly what we want so we get nice tessellation near the camera and in the distance you don't get any which is what we want opening up our material instance we can now start to find you in this effect to our lacking so going down here to our tessellation effect if fade distance and with this we can change how far into the background our tessellation is going to affect the landscape of course we have to forward to solution with which we can increase or decrease the tessellation in the distance and we have to new translation which allows us to affect this Latian in this faith distance so let's put them back to one and zero and of course we have the offset which allows us to shift this effect put that back to zero save this and now add some extra height information because at the moment it isn't really displacing anything right it's so flat so let's go in here and let's move this tessellation down a bit because we're going to need some more space let's move the output over here what we're going to do is we're going to take two height and multi Prada with our vertex normal inward space so what this would end up doing this is actually the only thing we need we could put it right in but I like to do a little one one or two extra steps to this so looking at one of the textures in our material we quickly open one up like this one for example and we want to look at the height map information remember it's in the green channel and we have white and black areas that kind of show us how high or far down the vertex should be and at the moment when doing it this way it's just multiplying the vertex normal on it we're just going to push everything up so going from the this height it's only going to get pushed up which is going to cause some issues if you have like persons walking on this and stuff their feet are going to start to intersect with the environment a lot because it's only going to get pushed up so what we want we want the white areas to get pushed up and the black areas to get pushed down and so we're going to do we're going to do this a little bit different we're not just going to multiply it it like that what we're going to do is we're going to use this one so our height wrestled and we're going to use it as alpha for lerp off a follower and then we're going to create a scalar parameter with the value of one and parameter all this one there right now what we're going to do is we're gonna log between this one and a 1 minus of it there we go and we go by this with the vertex normal so now we're actually taking a black-and-white image and use this on that value actually this can be zero and we should up and down is this an alpha product and then multiply our vertex normal with it and now this could go into world displacement however what I found is that with our display ssin kind of already our translation is going to stop somewhere around here right and it's going to fade out at the moment is not really fading out now we can see it like there it's it's fading out Khanum and we're too full displacement value in this area it's going to look really off because it's going to try to do the same thing it zoomed right here over here would weigh less polygons so let's do something else let's take this value right here and multiply it or lerp from our two slash multiplier which is a value between 1 and 0 right so we're kinda controlling this effect with our two slash multiplier and now we're going to take this and put it in our world displacement so as the translation grows weaker in the distance the displacement is also growing to grow weaken let's give this a comment call it this placement and also just notice that I'm still spelling translation wrong this is a double arrow right so let's add that real quick horrible okay there we go now let's apply this compile it and once we're done compiling we can see if we actually did everything correct so our materials compiled and now let's check a log isn't doing anything at the moment that's because in our material instance we still need to set our height value on I actually forgot to put that into that tessellation group but whatever so going in here we can now adjust the height of our displacement there we go that's looking nice let's go back let your words that's way too strong obviously let's try something like 15 it looks kind of nice so let's actually everything now we have translation on armature and it's in and it's and it changes depending on the distance our camera so it's only group where the camera is closed and it stops over there and we can control this faith distance and we can also adjust the tessellation of the background foreground and so on so I guess that's it for this tutorial um sorry if my quality isn't too great or old mic broke down and this one is a replacement so I'm not sure how this gonna sound and yeah let me know if you have any more questions of course like and subscribe if you liked this video and if you want to see more of them and it really helps us out if we know that you guys enjoy these videos and the next video is going to be a tutorial about our moss and rocks shader that we uploaded a few weeks ago people really seem to dig it so we decided to make a tutor about that one can expect it actually probably some sometime around the end of this week maybe you start off next week so yeah there you have it hope this works for you if not let me know in the comments that's it for this video see you bye bye [Music]
Info
Channel: Lukas Kölz
Views: 75,207
Rating: undefined out of 5
Keywords: Unreal Engine, Gamedev, Tutorial, Landscape, Material, UE4
Id: W1MRDXUWID4
Channel Id: undefined
Length: 17min 30sec (1050 seconds)
Published: Mon Dec 19 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.