Vertex Painting Height Based Puddles + Nanite Tessellation | Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video is about adding puddles and weathering effects based on height data and vertex color so let's do it you can download the project file for this video on my patreon the link is in the description I'm going to add the puddles on top of the material we created in the previous video I recommend you watch that too and if you're not familiar with any of the notes I use in this video check out the material notes playlist on my channel let's move the alpha nodes down here to make some room I want to add the puddle nodes here add a set material attributes node we need five elements base color specular roughness normal and displacement I'll add two constant three vectors and three constants a default Vector 3 for the base color a constant value of 0.35 for the specular default specular is 0.5 water is a slightly less specular a constant value of zero for the roughness a blue color for the normal it acts as a flat normal and finally a constant value of 0.5 for displacement 0.5 is the default value values lower than that create holes and values more than that create bumps so if you want a smooth surface for the puddle displacement should be a constant value and 0.5 is a good starting point add a named re root and name it paddle here we should add another blend note so duplicate this one connect the puddle to the B input the output of the previous blend to the a input and connect it to the main material node now let's create the alpha down here in the alpha section duplicate the height L function and connect the B channel of the vertex color node to its transition phase input now we can use the B Channel when vertex painting to paint the puddles add a parameter run it through an absolute node and connect it to the contrast input for height texture one I'll use the noise texture from the starter content it's here I've added it in the previous video so let's add its name reroot here clamp it between 05 and 1 I don't want it to have very low values multiply it by a parameter name it height multi multiplier paddle set the default value to one and connect the multiply node to the high texture one input now set the group of these new parameters to height for height texture 2 I'll use the resulting height map from here drag out of the alpha output and add a named reroot I'll name it Alpha 3 up here connected to the alpha input on the blend node and save the material let's go ahead and vertex paint the puddle select the Mes in the level and go to the modeling mode on the left select the attributes section and click on paint vertex colors vertex colors are white by default so set the paint color to Black and enable only the blue Channel set the material mode to original material to see the materials in the scene adjust the brush size and start painting the puddle [Music] click on accept and now we can see a very bad looking puddle on the ground there are a number of things wrong with it I'm going to address them one by one by the end of this part the puddle will turn from this to this the most important thing is that we completely losing the ground information under the puddle puddles don't work like that we should add them to the existing m material so first we should get the material under the puddle then we should blend them together the material is the one we have blended with the puddle to get its individual components we can use the get material attributes Noe I want the base color the roughness the normal and the displacement connect them like this and add a named reroot for each of the out [Music] puts now add the named rear Roots down here we want to blend them with the puddle let's start with the base color convert the vector 3 to a parameter and multiply it by the blend base color now use this as the puddle base color let's set the default color to a low saturated Brown I'll convert the roughness constant to a parameter and multiply it by the blend roughness let's save the material and check the result now it looks more like a puddle next there's the displacement issue everything in the puddle area has become flat it doesn't work like that the water accumulates in some places it has a certain depth and the things that are taller than that stick out it's not happening here based on the pattern we see on the ground some of these stones and rocks should stick out of the water so let's get back in the material the default displacement of the puddle is 0.5 so anything with a displacement more than 0.5 should stick out I'll use the if node to achieve that connect the blend displacement to the a input and set the B value to 0.5 also connect the blend displacement to the a greater than b input and connect the 0.5 constant to a less than b connect the if node to the displacement input here now where the displacement is less than 0.5 it will use the 0.5 constant so it will be flat and where the displacement is more than 0.5 it will use the blend displacement so it will keep the displacement of the surface below save the material to see how it looks and now we can see some of the stones and debris on the ground are sticking out of the puddle it's looking more and more realistic the parts that are sticking out should have different properties than the part that is covered by the puddle right now only the displacement is different so we should use the same if Logic for all of these duplicate it four times one for each of the inputs connect the if nodes to the set material attributes node and let's start from the top which is the base color if displacement is greater than 0.5 use the blend base color and if it's less than 0.5 use the multiplied one I forgot we should connect the blend displacement to all the if nodes this is what we're comparing with 0.5 for this specular if a is greater than b use the default specular which is 0.5 and if a is less than b use the new specular for the roughness I'll multiply the blend roughness by 0.7 before connecting it to a greater than B I want its roughness to change a little bit connect this multiplied roughness to a less than b the blend normal should be connected to here and the flat normal should be connected to a less than b save the material to see the result it's becoming better and better next I want to add some more parameters to better control the base color but before getting to that make sure to like this video And subscribe to the channel also join our communities on telegram Discord and Facebook you can ask questions or answer them share your work in progress and more if you're interested in supporting the channel and downloading the project file for this video check out my patreon the links are in the description when a porest surface becomes wet its color becomes more saturated and slightly darker so here after the blend base color node I'll add a the saturate node and the multiply node connect them like this the saturate well the saturates colors but if we use a negative value it increases is the saturation so I'll use a constant value of - 0.4 for the fraction and I'll set the B value of the multiplied to 0.6 to make it darker let's L between the default blend base color and the darker saturated one for the alpha I'll add a parameter and name it surface porousness run it through a saturate node before connecting it to the alpha input now when this parameter there is zero the surface below the puddle won't change as it happens with nonporous surfaces such as metals and if it's set to one the color of the surface below the puddle changes as it happens with porest surfaces like Natural Stone I'm going to add two more LPS the first one I will use to lurp between the color and the result of the multiply node the default Alpha is fine for this one it Blends the puddle color with the surface beneath it and makes it appear muddy I'll use the other one to L between the multiply node and the result of the lp make sure the multiply is connected to the a input for the alpha I'll add a scalar parameter run it through a saturate and connect it like this it will control the opacity of the puddle when it's zero the puddle is seeth through but as I increase it we'll see more of the color select all these notes and press C to comment them the b stands for the channel we used to where text painted let's save the material to check it in the level and I forgot to set the group for the parameters so select the parameters and set their group to paddle B and save again open the material instance now we have the puddle section down here I can change the color and the roughness increase the opacity to make it look muddy or decrease it to make it look clear around 0.4 looks good we can also control the surface porousness it's better visible when the opacity is set to zero and finally we can control the overall height of the puddles with these two height parameters up here the default value of Z for height contrast looks good these black areas are are just artifacts because virtual Shadow Maps don't update as we change the height if I look away and look again they go away right now the puddle displacement is set to 0.5 and has a constant depth it covers the surface beneath it only to a certain degree even if we increase its height like this the default 0.5 value looks the best but what if we want its depth to be more than the height of these Stones let's go back in the material in the displacement section multiply the 0.5 constant by parameter and name it displacement multiplier set this group to puddle and is default value to one saturate the result add it to a named reot and connect it to the B input on all the if nodes also connected to the a list than b input here save the material and open the material instance now when I increase the parameter the water level rises and when I decrease it the water level goes down it looks good only to a certain degree though if I keep increasing it it breaks the effect that's why I prefer to use the default 0.5 value it's handy if I want to flood the whole surface a high height multiplier value like 80 and displacement value can flood the mes the material could also be set up with one if note we would have to use two set material attributes one for the blend material and one for the puddle the noes used are exactly the same as above and the material wouldn't be any cheaper it's just another way to do it I just wanted to show it to you right now puddles can form on any angle if I rotate the mesh we can see that even when it's vertical the puddle is there puddles only form on flat areas so let's make it so we can use the vertex normal in Vol space node to achieve that first mask its B Channel we only need the normals in the Z Direction then raise it to the power of 128 if I preview The Mask node and then preview the power node we can see that the white color is limited limited to the flat area on the top now if I multiply this by the alpha of the height LP node we can limit the puddle to form only on flat areas let's multiply it by 1.1 just to make sure all the values reach one and then saturate it now we should connect it to the alpha 3 named re root save the material and now as soon as I start rotating the mesh the puddle disappears now let's add Ripple to the puddles to mimic the effect of wind right now the normal of the puddle is a simple blue color it's flat in the starter content textures folder if I search for water we see this normal texture I will use this to add movement to the puddle so add the texture and make some room in the puddle section bring the blue color next to it and connect them to a LARP node add a parameter for the alpha and name it wind repel normal strength when the parameter is zero it will use the flat normal and as I increase it it will use the normal texture in this case I won't use the saturate note because I want to use values less than zero and more than one to change the normal strength connect the lp to a named reot name it puddle normal and connect it to the if note like this now we can add the nodes for the normal I'll add a panel node and connect it to the uv's input for the speed I'll append two constant values and connect them like this based on the texture the riels should move in the v Direction so let's convert the second constant to a parameter and name it wind repell speed set the default value to 0.1 for the coordinate I'll duplicate my function from up here this parameter will be wind repel size duplicate it and name it rotation set the default value to zero for this one set the group for all the parameters and save the material let's check it in the level but before that I forgot to set the default normal strength to one save again we can see some movement on the water but it doesn't look good let's decrease both the size and the speed of the wind repelled to 0.05 now it looks better we can also change the rotation and the normal strength to add more detail and variation to the Ripple I'll duplicate the texture and add it on top of the other texture but with different UV settings select the texture the Panner and the function and duplicate them this one I want to be a smaller and move faster with the different rotation I'll multiply the wind repel size by 0.33 and connect it to the size input add 75 to the wind Ripple rotation and connect it to the rotation input and multiply wind reple speed by 1.5 I'll use a constant to set it to 0 and 1.5 and connect it to the speed input to blend these two normal textures we should add their R and G channels and multiply their B channels add an append many note to combine the channels together and connect the RGB output to the lurp save the material and go back in the level now it looks [Music] better and finally let's add the weathering effect it's great for adding extra details on surfaces to achieve this I'll change the base color the specular and the roughness and we should add it to the material before blending it with the puddle so make some room between these blend notes disconnect them for now and add a get material attributes and the set material attributes in between them connect them like this we should add the weathering effect here add three elements on both of them base color specular and [Music] roughness add a named rot for each of the components here I'll name these blend two so I don't confuse them with the named re Roots we used for the puddle [Music] down here next to the puddle section this is where I'll add the weathering notes so first add the blend named re Roots we created above multiply the specular by 0.8 and connect it to a LARP node connect the specular to the a input we'll set up the alpha later do the same with the roughness but this time multiply it by 1.2 I want it to get a little rougher most of the change will be on the base color so drag out of it and add a desaturate note I'll desaturate it by a fraction of 0.3 multiply it by constant three and convert it to a parameter this will control the tint of the weathering effect let's set the default value to something that is obvious when we add it we can change it later from the material instance add a lurp connect the base color to the a input and the multiply to the B input let's add three named reroots weing base color [Music] weathering a specular and weathering roughness now let's create the alpha duplicate the height lurp and all the nodes connected to it down here change the parameter name to weathering we don't need the Alpha and the clamp connect the B channel of the vertex color node to the transition input for height two texture I'll invert the resulting height map from here and connect it I inverted it because the Ving starts from the top not the bottom like the puddle drag out of the alpha output and add a named re root this is Alpha weathering let's use it as the alpha for the SLS and looks like I've mispelled weathering okay connect the weathering named re roots to the set material attributes like this now save the material to check it in the level in the material instance we can change the weathering height and contrast as you can see it starts from the top of the stones and goes all the way to the bottom the default value of zero is good for the contrast but we can increase it to better see where the effect starts and where it ends let's set the weathering Color Group and save the material again down here in the weathering section we can change the color let's add another parameter to have more control over the effect multiply the alpha by a parameter before connecting it to the named rear root name the parameter weathering amount set it group to weathering default value to one and let's run it through a saturate before connecting it to the multiply save the material and now we can control the weathering amount when it's zero we won't see it and as I increase it we see it again a combination of all these parameters give us a good level of control over the final result click here for more unreel stuff and thank you so much for watching like this video subscribe and join our community is on telegram Discord and Facebook if you have any questions leave them in the comment section below so see you in the next one
Info
Channel: Hoj Dee
Views: 7,486
Rating: undefined out of 5
Keywords: 3d, cgi, unrealengine, unrealengine5, ue5
Id: B2FqzZ5W9BU
Channel Id: undefined
Length: 28min 9sec (1689 seconds)
Published: Fri May 17 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.