Displacement Vertex Painting - Unreal Engine 5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody in today's video I'm going to show you how you can vertex paint different textures and blend them together perfectly you can add a lot of textures and you can blend your textures based on height map and in this video I'm going to show you how you can add this extra realism by applying the displacement map onto your vertex painting and this will give you this extra realism that you're working when you start vertex paint your mesh so let's get started and show you how the vertex painting can work with the displacement map if you watch my prev previous video you already know that my channel is demonetized so I've decided to switch to patreon becoming a patreon member you'll support me and this channel to keep evolving to keep creating more and more interesting videos besides that you'll have access to all the files that I've created from the start of my YouTube channel so right now you can download the water Shader you can download the auto material from my previous video if you didn't watch it go and watch it and you can have access to more in-depth videos about how the things work like the auto material the water Shader in few more videos and also you will have access to a VIP Discord server only dedicated to my patreon members where I am active most of the time so if you want to support the growth of this Channel and if you want to see more and more videos like this go to my patreon page enroll now and also you will have access to everything that I'm creating thanks everyone so let's start creating this vertex paint Shader the first thing that I'm going to do is I'm going to right click go to the material and click on the material this one I'm going to call vertex paint material paint material I already created it as you can see over here but we are going to create it from scratch I'm going to open it and I'm going to start by creating my texture coordinates in order for us that we can tile the UVS of the textures that we are creating so I'm going to hold one on my keyboard to create a constant I'm going to right click convert it to parameter and I'm going to name it UV scale size right by default I'm going to put 10 for my value and after that I'm going to multiply and I'm going going to multiply by texture coordinate so I'm going to right click texture coordinate and this will help us scale and tile our textures and after I did this I'm going to drag and drop over here and I'm going to find a name route and for the name route I'm going to name it texture coordinate texture coord coordinate all right so I'm going to comment this and this block will UV tell our textures all right I'm going to show it B so this is the first block that we're going to need to tell our UVS of the texture that we are going to import the next step is to use some textures I already downloaded few from quickel Mega scans and I'm going to use this uh Cobblestone over here so I'm going to drag and drop the Cobblestone over here and if you're searching for the exact textures I'm going to list the code in the description of this video the second thing that I want to add is a fresh snow so I'm going to drag and drop my fresh snow over here okay so we've added two textures that we are going to blend between so right now I've arranged my textures the first one is the Cobblestone the second one is my fresh snow again for the normal map Cobblestone fresh snow and for the Rd texture is the Cobblestone first and the second is my fresh snow so this is the initial setup right now we've created this texture coordinate I want to hook it up everywhere in the UV section so I'm going to right click texture coordinate keep in mind that this will control the tiling of our textures so connecting over here control c contrl v connecting over there and connecting it over here the next next step is to create the vertex C block so I'm going to right click search for vertex C and this vertex C block will tell us where we're going to paint right now what we have is we can input all the data from RGB and Alpha Channel or we can separate so at the moment you can blend in the red channel in the green channel in the blue Channel and in the alpha channel so those are the things that you can blend between and I'm going to show how you can blend between the red channel the can add the green Channel and from now on you can add the blue and the AL Channel if you want more complex Shader so the first thing is to reroute the red channel so I'm going to reroute and I'm going to name this air vertex color so this is my rear route for the vertex C red and I'm going to do the same for the green rear route and I'm going to name this G for green vertex power okay and I'm going to put on a comment on this block so I'm going to name it vertex col col node okay show the bubble and let me move it over here we are just using the rear rout so I'm just separating everything over here okay so now how we can start blending between those there is a note which is called height lurp you can blend by using the normal lurp which is the linear interpolation so what you can do by luring normal is you can connect this one and this one and the alpha channel will be using this channel for example if you want those two textures to lurp on the green Channel I'm just going to connect the green Channel over here all right if you want to lurp on the red Channel you're going to connect the our channel so right now we have a simple blend between those two if we start painting the red channel from zero to one in Alpha which means from black to white we're going to see this a little bit later we're going to start blend between this texture and this this texture but this is the simple method I'm going to show you how you can use also height to blend it so you can have this extra rism for the height blending we have a height lurp so I'm going to right click height lurp this one it's a little bit more complex but the result will be much much more good all right so for the a we're going to input this one and for the B we're going to put this this one the transition phasee is the channel that we want to paint on and in this one for these textures I'm going to paint on the red Channel and the height map is pretty important so how you can find the height map right now if I go back to my Cobblestone and if I double click on my rod texture let me just drag and drop it I'm going to search which channel includes height information so the green Channel doesn't include a height light information the blue channel it's not good enough and here in the red Channel which is our ambient occlusion we have good height information so we have dark spots over here and we have pretty good white spots over here and very good definition of the cobblestones so what I'm going to do is I'm going to use the red Channel and feed my height information so in order to do that I'm just going to go here and this is our Cobblestone Road remember red Channel is our height information and what I want to do is I want to inverse it because right now we're going to use the white and we're going to paint on the white and I want to create a vice versa of it and start painting the snow below the cobblestones so what I'm going to do is I'm going to use one minus this a note that inverse the channel and we are inversing the white and the black and I'm going to reroute this reroute and name it roll height map okay so this is what we are going to use for the height map and I'm going to feed it over here in the height texture okay and one more thing that we need to do is we need a contrast so I'm going to create a parameter which is a constant parameter converted and I'm going to name it contrast textures contrast the contrast itself will tell us how soft and how hard the textures will blend later on you're going to see this in action and I'm going to reroute this reroute I'm rerouting just for the sake of clean graph in our material and this will have the name of contrast and I'm going to name it textures contrast okay and now I'm going to connect my contrast over here to the contrast in this height lurp so right right now we have all the height lurp for the diffuse C for the obido we need to do the same for the normal and for the roughness occlusion and displacement okay so I'm going to select this one copy and paste it and I'm going to connect the normal map over here and the normal map over here so our normal map is ready pretty easy see when we've prepared everything to be rerouting how our lines are not Crossing and we have this clean readable graph over here pretty nice and for the rest again I'm going to copy and paste this one and here it will be a little bit more tricky because the first thing that we need is if I drag over here we have occlusion roughness and displacement so the red channel is our occlusion but I want my red Channel without the reverse so I'm going to connect my red Channel over here and clean everything look good and I want my red Channel over here this is our occlusion data the first one the red channel so I'm going to connect it to the ambient occlusion and the normal map will go to my normal map and the diffuse orido will go to my base car okay but we need two more height lurs which will be for the roughness and the displacement so I'm just going to duplicate this one I'm going to connect from here from here and here and I'm going to connect the green Channel over here the green Channel over here and this is our roughness let's connect to the roughness move this base note a little bit over here and I'm going to clean the connections so we can trace them and I'm going to have one more height lurp again connect everything over here and connect the blue Channel which is our displacement we start to get a little bit crossing over here but it's okay because we can track them pretty easily and this will go into our displacement here in our displacement so right now we have the setup to blend those two materials based on the red Channel let me save this and show you how this works so if I select my floor and this floor is a mesh it is not a landscape we are paintting in on a mesh not on landscape the vertex paint is working on mesh painting and not on landscape this mesh is created in Maya and I've intentionally smooth it up a lot so we can have a lot of vertices to paint so I can show you this smooth painting effect and let's apply the material onto our floor drag and drop our vertex paint material and right now if I play we have the snow over here covering our mesh now in order to paint paint go to the selection mode and change it to mesh paint go to the paint section I'm going to scale this a little bit and here you have the channels to paint on you have the size of the brush you can make the brush a little bit bigger you can have the strength how hard the brush is you can have also a fall off of the brush the most important thing is the paint color from the black to white it will say which texture we start painting onto our mesh and here the channel we've set up the Shader to be readable in the red channel so I'm going to choose the red Channel and let's start painting a little bit to show you how it works on the black we have the cobblestones let me just put my speed camera to a little bit less and you see that we can paint a little road over here let's say like that and let me show you if I turn down the brush and make the strength a little bit like that and I switch you can see that when we paint we are painting beneath the stones over here how the height map is working so right now we can have this amazing effect and we can fill up a little snow here and there to have great blending and of course this is controlled by strength over here how you want to paint it let me just create a little bit more space here let me show you the contrast parameter how it's working if I go here in the contrast and change it to four you can see that we start to have sharp edges if we go all the way up to 10 you can see this hard if I go all the way to 0.5 you can see that we have a little shall like uh Fade Out effect like transparency so from the contrast you can choose how hard it is blending if you want this hardness or if you want to make it a little bit softer put point2 and this is how you can vertex paint two colors right now we're going to add one more so I can show you how you can add more to this so let's add one more layer I'm going to go to selection save this so to add one more layer we already set up the green channel for it and it's pretty easy what you need to do is you need to copy the he lurp over here connect this one to a connect the result to the base C and right now I'm going to use my Mossy Rock and I'm going to drag and drop my MOS over here because I want to paint a little mous okay and what I want to do is I'm going to connect the mous over here so this Moss will start blending with those two textures and it will start popping out from the the green channel so I'm going to right click connect the green channel to the transition face and you can set up different High textures here if you want but I want my rad also to be dominant over here so I'm going to connect my rad to the high texture connect your contrast over here too okay and what we left is we need the texture coordinate to work also on this texture sampler so I'm going to connect it over here and see with all this rear routing that we've done everything looks so clean so readable pretty easy to work with Okay so we set up uh the new texture over here the mous and now for the normal map we're going to do exactly the same thing as we did over here texture coordinate connect it over here to the UVS copy those paste those connect my result over here to a connect this to B move this a little bit up and place this a little bit down so it's clean and connect this to my normal map and right now here I have a little bit trouble uh tracking those so I'm going to reroute those and I'm going to disconnect everything and I'm going to reroute later and now here we have to do the same triple normal luring for this one so the first thing is we need a texture coordinate connect it over here and I'm going to move it like that and I'm going to start duplicating each one of those so I'm going duplicate this one and I'm going to duplicate those three and I'm going to connect them over here rad height map and the contrast and remember we are painting in the green channel so I'm going to delete this one and add the green vertex Channel over here okay and right now the result you go here this is for our occlusion and our occlusion is red so I'm going to connect the red over here and right now in order for us not to make a big mess I'm going to reroute this and I'm going to name it from the result route AO final so this is our ambient occlusion final and I'm going to connect it over here to our ambient occlusion we're going to do the same for the roughness and the displacement so I'm going to duplicate this one and I'm going to use the connections from here connect this one to this to a and connect my green Channel over here this is our roughness we route roughness final go and connect your roughness final over here roughness final roughness final I'm going to give a default value for the specular and metallic of zero because I don't want this to interfere with my roughness and the final thing is I want to create the displacement so this will go into my B Channel this will go into a uh this my blue Channel sorry and I'm going to connect again the contrast the road height and the vertex C keep keep in mind that here in the height map you can control it by another different height methods that you want to blend maybe uh you're using this Moss as a height and I'm going to reroute reroute displacement final and I'm going to connect my displacement final here in the displacement final Okay so we've set up one more texture to pan on and we are using this uh texture sampler to feed our displacement to feed our roughness our ambient occlusion here you can use different High Textures in order if you want to blend differently than the cobblestones over here and here for the metallic and specular you can set up whatever you want if you have texture for the metallic and specular you can do the same with the height lurp and connect them too all right and now it should work and let's test this out now everything is covered in Green in our Moss so I'm going to go to the mesh paint I'm going to go to my paint going to go to the green Channel and I'm going to fill with white right so right now white is our Moss I'm going to change this to Black fill and we have our previous painting So if I want to start adding Moss I can choose the green Channel and I can go a little bit in the white section and I can start adding a little Moss over here beneath the cobblestones let's say I want here to have a little Moss a little M over here over here see how it Blends pretty well with your environment and of course you can add here in the snow I'm going to expand this and see how it works with the cobblestones and this is because the height map for blending between the Moss and the snow it is also the cobblestones you can change to whatever you want if you don't want to paint in the Cobblestone so here in the path change the height map uh depending on your snow and you're going to have this better result by blending it but right now I can blend this and if I go into my red Channel and start painting a little bit over here I can start painting a little Stones here going to my green Channel I can start painting some Moss jump into my red Channel let's paint some some snow over here jump into my green Channel and it is pretty fun guys so if I go here in the selection play it you can see that we have this nice blending between textures and everything is working perfectly but one thing that you don't see here is we don't have displacement and the displacement is not working by default so let me show you when I go into my vertex painting into my floor and the displacement is working with nanite so if I put nanite on enable nanite support and if I hit save then you can see that everything is blowing out and this is because of the magnitude so I'm going to go to my material I'm going to go to my vertex paint and you need to control your magnitude for your displacement so how to do that is select your base material over here and search for magnitude and I'm going to put 0.25 I'm going to hit save and now the displacement will work but the vertex paint texturing won't work all right the displacement is working but our vertex painting is not working at all how to fix that it is pretty easy if you know how to fix it it is very painful if you don't know this trick so let me show you the trick select your mesh go to the vertex painting go to the floor and the first step is to disable nanite when you disable nanite you are able to paint again on this mesh but once you enable it you are not able to paint so the workflow is as follows first paint your mesh over here however you want for example I want this and then go here and hit apply this will instance the vert.x C to the source mesh so it will embedd it into the source mesh and when I hit apply I'm going to override it with all the lods and right now the vertex cover is embedded into my source mesh and what I can do is I can just enable Nite and the displacement will start working so right now we have our displacement working with our vertex paint you can see that the C stores are popping out maybe it's a little bit too much so I'm going to tune this a little bit down go to material vertex paint search for your magnitude and do with 0.15 save it and now we have this little SLE effect and we have all the cobblestones pop out and we have also the snow po out a little bit more and right now if you don't find anything to look good and you need to paint again on your vertex mesh what you need to do is just go to the floor disable the Nite hit save and you're going to bring back your floor without the Nite go to your mesh paint go to paint select your channel and start painting over it so this is how you can utilize the Nite and the displacement also use the vertex paint onto your your mesh so this is pretty much how you can vertex paint and use displacement onto your vertex painting this is an awesome feature in Unreal Engine but it has this little trick to do in order to make it work thank you guys for watching this video and I see you in my next one and before I end up this video I want to let you know that I've created a blueprints master class for Unreal Engine 5 it is available right now on UD me so if you want to expand your knowledge and not just only create art pieces in un real Engine 5 but create some characters create some game logic my course is the perfect solution from beginners to intermediate and real ng5 users the course itself is 15 hours long and it has all the foundation that you need to Kickstart your blueprint knowledge in Unreal Engine 5 so if you want to keep evolving yourself Beyond just creating art in Unreal Engine 5 en roll now so I hope you enjoyed this video and if you want to support me and get access to all my files also to the auto material that I've created previously join my patreon page for $499 and with your pledge you're supporting me to keep creating amazing videos like this each one of you can make a big difference by supporting my channel so I can keep making those videos thank you guys for watching this video Happy game development I'm out
Info
Channel: CG Dealers
Views: 4,787
Rating: undefined out of 5
Keywords:
Id: Njz3Ei3w7TA
Channel Id: undefined
Length: 25min 20sec (1520 seconds)
Published: Mon Jan 08 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.