How to Vertex Paint in Unreal Engine 5 - UE5 Beginner Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
learn to create an action game in a real engine 5 at unfgames.com if you want to learn more about vertex painting in a real engine 5 then this video is for you you will learn the theory behind vertex painting then we will create a material from scratch and show you how you can activate this feature and moving on we will create a nice material that blends really nicely with your textures then we will see how you can modify quick cell 3d assets to add more variation to the original versions and finally you will learn how to save time by using quicksilver blend master materials let's start by showing you the theory behind vertex painting so let me go here to the green plus icon and i can go here to the basic and go to shapes and drag up drag a cube here let me move it up just like this okay so let's understand what is vertex painting if i go here to the select mode you will see that you have the option for mesh paint okay and what this does is allows you to paint here vertex color information inside your mesh so what do i mean by this well if i go here to the paint tab you will see that i have a bunch of options to paint now before showing you how you can paint here i want to you to understand how vertex information works if i go here to the wireframe i can check that here i have different vertex in my model right each vertex will have some information in this case you can have like vertex color information which is stored in a r g b and alpha okay like each value will have uh a range from zero to one the red will be from zero to one the green will be from zero to one and so on so just like textures is very similar to textures vertex also have their own information so to understand this a little bit better uh i'm going here to put out 4 to check the lead mode and instead here in by default it will be off i will go here to the rgb channels and you will see that my mesh turns white and the reason is by default this mesh has all the values to one the red has a value of one the green has a value of one and the blue channel has a value of one and also the alpha let's work on the three of those let's ignore the alpha for now so what i'm gonna do here is to paint everything black so i'm going here to this swap paint and erase colors and then i will go to fill and now you will see that my mesh turned black so what can i do with this if i strap the paint again i can paint in white so what do i mean by this so i can check here to check which channel i want to paint for example i want to paint a red channel i can just click here and the harder i click the more painting i will have right the the more value right i can start with a very low value and i can go crank it up until i have a solid red color let's go what happens when i paint the green channel here of course you will see green let's paint blue here there you go so now you have different channels so what you can do is to basically see each channel individually how it looks like i want to check only the red channel the green channel or the blue channel okay or i can check all the channels to check the vertex information now i can actually paint both of them so for example i can paint like red and green and i will have yellow i can paint red and blue i can have like this kind of pink color and i can have like green and blue and i can put this cn color something like this now what happens when i paint the three of them is it becomes white now this happens because all the values are turned into one red is one green is one and blue is one so each vertex here will have a value from zero to one okay so zero if it's black and one if it's white and for example this will be for the red channel and the green channel will also have another value from 0 to 1 and so on and so on from all the rest of the channels now this is the way you can visualize vertex colors and now that we know how they work we're gonna go to the materials to show you how you can use this in your favor because these ones are really important where you want to show different information in your mesh maybe you want the red channel to be like a brick the green channel can be like a wood texture the blue channel can be like puddles it can be anything you want actually so now that we know the basic theory behind the vertex painting information let's go and create some materials where we can do something with it so now we will create a very basic material for our cue now we will go here to the content drawer and i will right click and select a material and then name it like m basic vertex something like that and then just double click on this and i can just drag and drop here and now if you're pretty new to materials we have a complete material tutorial i will put a link in the description and also up here should be something but now i just want to show you like with right click you can move around and basically you can connect different things here we're gonna make it very simple we're not gonna touch anything of this so what i'm gonna do is to create a color okay so i will create the color maybe put a parameter vector parameter there you go you can also press a v if you want to create a vector parameter and i will call this color okay i will put something like uh something like this okay and i will put it here click apply and now what i can do is to go here to my map overview control space and then right click and then create a material instance let's just put it like this and drag and drop this one here now you will see that i have my pink cube here but because this is a parameter i can actually change the values here with them instance so i can just come here i can go to color and change this color to whatever color i want so what else we need to do well we need a way to tell unreal that we want this color only to be applied with vertex information okay so how can we do that well we can go to vertex color there you go and this is the vertex color data so what i can do is to use this as a mask and then combine these two to basically paint on my mesh so what i will do is to create a linear interpolate node pressing l here and the alpha will be one of these nodes here for example i can drag the red here and i need two values on the v side i will have my color that i want to change okay and on the a side i will have the base color so i will rename this color as the top color and i will ctrl c and ctrl v and rename this as the base color and i will put something different something like green so i will put something like this and then i will put this on the base folder let's hit apply and there you go now you see that something's going on here and let's take a look at our material so if we take a look at our vertex information here or material instance uh let's change that top color to something like this okay and the base color maybe we can put it black so it can be easier to to see what's going on now let's take a look at the vertex painting as you can see if we if i go to mesh paint i have more vertex here right so what i can do is paint here and because i decide in my material that only the red channel will be able to modify this color if i paint for example the green channel and let me go here to the color view mode and press off if i paint here green nothing will happen if i increase the strength and the size you will see that nothing will happen the same with blue and the same with other channels that are not red however if i paint right here you will see that i have my channel here and i can go here i can continue to paint red here and there okay so how much now what else we can do with this well we can actually decide in the material instance which vertex channel we want to change when we paint and we can do this by using a channel parameter there you go channel mass parameter and we will call this like vertex channel by default it will be red so we will grab the rgb data from here this is will basically choose this data here okay basically everything uh the red the green and the blue channel and it will go here and you can see that here you can change this to green to blue to alpha whatever you want okay so let's put it on the alpha and let's click apply click save and now let's go back and see what happens if we change this vertex channel to green now you will see that only the green parts that are painted will be painted in pink and the reason is if we go to our rgb channels now this is a little bit hard to see when you put all the channels because the green is here and the green is also here but if you isolate them for example like the green channel you will see that the green channel is faint in these areas if we check the blue channel you will see that the blue channel is in these areas and of course if we go here to our vertex channel we can change to green to blue and now if we i turn this off you will see that now my paint it's actually applied into the areas of the blue channels and i can keep changing this until i decide what i want to do so for example i i press the green button i can go here and to erase things i can just press shift and you will see that i will erase some painting here some vertex information now one thing before we move forward is that this mesh here actually has some vertex to work on if you don't have any vertex to work on you won't be able to paint on it if you have very little then you will have a lot of influence so make sure your mesh has more vertex if you want to add more detail this is very important when working with vertex painting the next thing we're going to do is to see how we can add textures into this material here to make it a little bit more complicated so let's add some textures into this material so i'm going here to press ctrl space and then add and then add qxel content and here you can browse for any material you want for example you can type like rock and then select surfaces and then you can just select any one of those in my case i select a couple of those a layer beach rock and a eroded sandstone cliff you can do you can choose whatever texture you want in my case i will choose these ones just to illustrate how things will work with vertex painting so i will choose that layer beach rock click add and now you will see that i have my material here with my textures and let me go here to my eroded samsung cliff click add and now you will be able to have it in your content browser if you want something else just to use come back here like grab this one put click download and it will download and you can also select the quality for media medium quality it's more than enough uh so that's what i chose and then you can just press add okay so let's go back here let's check the map overview and now by choosing control space we can just import uh these textures into our material here we put it in our content okay so we can double click on this and now what we can do is to replace these colors by using the textures okay so what i will do is put this layer beach rock as a base so i will drag all of this and i will put it here okay and instead of having this base color what i will do is to have a material here so how can i do this well i can delete this one i don't need this anymore okay and what i can do is to create a make material attributes and now that you have this you can just grab the base color here which is the color of your texture you can drag the normal map here and the mask you can drag each channel to the right one if you don't know which one is the right one you can double click on this and select individual channels here for example this is the angular occlusion how do i know this uh you will see like it has shadows here you can check how the it looks like the texture has some shadow information if you check the green one is a roughness uh texture is how shiny uh or how rough it will be and then the blue one is the height map which is the height information the dark parts are parts that are more in-depth and the white parts are closer to the surface okay so combining the three of those you have this weird color so we can just select the red one here the green one goes to a roughness and the blue one we're going to use in the future okay let's delete this color and now what we're gonna do is to drag the other textures here and we're gonna create a material like this okay so what we can do is to ctrl c here and ctrl v and then drag this one here drag the normal and then drag the roughness d sorry the roughness goes to the green the red goes to the ambient occlusion and the blue one we don't need it right now now if you try to put this one here you won't be able to blend these two because this only blends one attribute and you have like more than one attribute in a material so instead of using the alert mode we're going to use something different and it's called material uh blend is standard okay and we can do this here and now we can put the base here which is a rock and then the sand we're gonna put it in the top and now instead of using uh this lerp mode we're gonna delete this and drag this wire here to the alpha and then how we can com connect this one we can click here in any part of our graph which is empty and then go here to the material attributes and click check use material attributes and connect this one here and just like this we have connected all of them okay so let's try it out so we have our material here let's go back to the mesh paint and go to paint and check the rgb channels and as you can see we're having some of them like different colors let's just try to paint everything black okay so let's go here let's i press ctrl space to get my instance here in my content browser and let's just choose the red channel as our main channel for vertex painting okay so what we can do is to basically paint some color here and you will see that you have the red channel happening so if i turn it off you will see that you have your sand here and what you can do is to basically paint here and this is great because now when you paint here you are actually painting the sand let me just move this one here and i can just continue to paint in the red channel and now you can blend two different values now you can see that i'm a little bit limited by the amount of vertex that i have this is why it's a good idea to basically have a mesh with more vertex colors so what you can do is go here to the modeling tools and maybe you want to select a box or a cylinder anything is fine let me choose a ceiling there because i really like uh how materials look on cylinders i can change the radius something like 90 something like that and then you will see that i can have height subdivision so i can put something like 10 for example this will give me a lot of vertex here that i can have on my scene i can click here and complete and now what i can press ctrl space and drag my material instance here as you can see when i create one mesh automatically all the channels are white so what i need to do is to go to the mesh paint go to paint and erase the color here by putting the fill in the black and you can see that my uvs are a little bit too big we will fix this later in the in the future but for now we we can just go here and start painting and as you can see because i have more vertex colors sorry more vertices to work with i can have more control over where i want my paint if i didn't have enough vertex colors then just like this mesh one painting will cover a lot of space in my mesh so you want to make sure you have enough vertex you don't necessarily need to have thousands of vertex to paint you just need a a handful of those so you can have results now uh let me fix the uvs really quickly so you can have a better view of this texture here let me go here to my uvs go to the layout put a transform here and scale it to do maybe three something like that yeah maybe four looks like a nice uh size so now it looks a little bit better it's more of a has a nicer size so i can go here to my mesh paint and i can continue to paint on the red channel right so um what we can do now because these parts have uh basically they have a smooth transition it's like uh if you check the vertex colors let's put the red channel here you will see that my red channel basically it's having uh let me press shift to delete as i continue to uh paint here you will see that i i have a smooth transition here from uh black to a darker red and then the brighter red color so this is a little bit unnatural and in order to fix this we can do a height blend to make our textures feel much better so let's improve the blending of our material let me press shift 1 to have a bigger space and now let's go to our material here let's go here to the material we create now this alpha it's giving us a very smooth result which is okay but it can be better so what we can do is to basically create a height lerp let me press tab and put height and then you will see that i have a bunch of options i want to choose a height alert let me click on this and now you will see i have a bunch of options here the first two are basically the colors i don't really need them because i'm not going to get the results from here i only want the alpha okay so what do do i need i need a transition phase which is basically uh what is deciding where is this height left it's going to happen so in my case i want to use this channel here the next one is i'm going to use a height texture so in my case i want to use the rock texture so i can use these values to decide where i want to put my sand okay so let me put this one here and now what i have here is the contrast so i will press one to create as uh a parameter and then right click to convert it to a parameter to create a scalar value and then convert it to a parameter and then i will call this uh vertex paint contrast i don't know maybe red okay and let me put the value to let me put the value to to start out and just by doing this let's go back to the alpha and replace this with the new height alert let me move this a little bit so it can be a little bit more organized and now that i have this basic setup let me hit apply and now this will make your material a little bit more heavier in terms of instructions but it will have a nicer result so now i don't have any contrast but you can see something's going on here uh it's a little bit different so what i can do is increase the contrast here i can put 1 2 i can put 50 if i want or i can put minus one to invert the result and i can i can put something like one and now when i paint here you will see that when i paint and i have very low strength let me reduce the size as i continue to paint here i will paint first on top of the valleys okay and then eventually it will go to the darker values here which is great if you don't like this result you can actually invert this texture by putting a one minus and then connect it sorry let's let's move this here and let's connect this one to the high texture and now look at this now the texture is here and if i hit apply now we'll have basically a different result i will start um basically from the from the valleys i can just click here to paint let me paint some red values here and increase the strength a little bit there you go and maybe this is something you want because you instead of using the peaks you want to use the valleys and this part is very obvious you can see that the sun first starts at the bottom here and then as you keep painting of course you will have like more results and this gives you a very natural result where the sand starts in the at the body spheres and as you continue to add more and more painting and it has no choice but to cover also the peaks of the texture so by painting like this even if you don't have much vertex colors you will feel that you have a lot of details like for example in this part we only have one vertex here and this is what is driving basically almost the whole colors in your in this area if i paint here you will see that i can start adding more values here and if i just paint here i will basically decrease the values but you can see how this height loop really helps you to have a much nicer result when you do your vertex painting and if you have like results like this you know vertex painting it's all about like uh like the finesse of the thing so you can start painting like here in this area and as you can see i cannot paint here because i don't have any vertex here i will need more resolution this is where it comes very handy and now i can put like the sand in this area and the same can be done here i can press shift to delete some of them and the idea is to have a little strength here and just little by little start painting you don't want to paint like strength like one otherwise you will have a result like this and you don't want that you you want to paint little by little here so you can have a much nicer result so let's see what other applications you can use with the vertex painting in my case i have imported a mesh from quixote mega scan so you can go to bridge but you can find any mesh you want i just find like this columns here these pillars can be a very nice choice to showcase what you can do with the vertex painting and also i download this fourth stone wall okay so i already have them in my content browser and it they come in different pieces and i have my ford stone wall here so what we will do is to change the material of this nanite mesh so that you can have more variations so let's start by checking the material instance it comes with like all the mega scans assets they come with a very standard material and you can check the default material that comes with the mega scans here okay this material you can't find here in mega scans preset you will find the different materials here it comes automatically every time you import the material in this case this is the default material okay so it's using this material here so we're going to modify it we're going to use the same method we did uh when showcasing this cliff with the sand but this time we're going to use bricks so we're going here to my content browser and then go to the mega scans services let's grab these textures here okay i drag them here and then put them here now because this material can have a lot of structures just to make sure select all of them and from the assembler source we will select shared wrap this will allow us to have more textures in our material so now what we will do is to create a simple material just like we did before we can just come here and then press tab and type make material attributes and then we will go to the base color connect this one here the normal map here and that i mean occlusion and the roughness here one thing i want to add here is the tiling but maybe we will do this in the future when we check our texture so now we need to blend this asset using the vertex color information so let's go here and put a vertex color okay let's use the red channel for now uh just to make things more simple and we will go to height lerp just like we did before and we're gonna put the transition phase here and the high texture uh maybe we can use the height from um this texture here uh like all the materials they come with they come with this material here you can check the the roughness uh the green channel and the blue channel okay but we we could use this one just for now so let's put the high texture here and the contrast we will press 1 to create a scalar parameter and then convert it to a parameter so we can use it in the instance we will call it um vertex painting contrast okay and we will put one now because this is a very big material we want to organize ourselves a little bit so let's create a group let's select all these structures okay and maybe just select one and here in the group sorry because this is not a parameter you don't need to do this here let's put the group here and put the vertex painting okay and i think this is the only parameter we have okay so let's just leave it like that and what we will do is to blend between these two so we will put a material blend standard okay so the base material of course will be the material we have and the top material will be this one so let's grab this one here and this one we can just put it here so it doesn't really bother and then put the alpha here okay let's click here and now we will see what happens with our material now you can see that all my mesh turned out to be the material that we just had here and the reason is by default all the you know um all the meshes have a value of one so what we can do it's go here to mesh paint okay and then go to paint and let's fill all the channels to black let's fill it just like this and nothing will happen because nanite doesn't support pert inter instance vertex channels so what we can do is apply and this will change the mesh original vertex colors so that all the meshes that are going to be imported here then we'll have the black vertex painting okay so it's finished and now you can see that this part turned back to normal so what i need to do is to do the same for this part i'm going here to mesh paint then go to paint here and fill it with black and apply continue and i will do the same for the rest of the assets here okay so i applied my vertex painting into my meshes so what i can do is to go to my mesh paint here and go to paint and now i can paint white here and i can start painting here so i can let me go to my rgb and you won't be able to see anything because you know nanai doesn't support per intense instance vertex painting but just to showcase something really fast i'm going to paint here a lot okay and now that i have this um i'm doing i'm just going to click apply continue and let's see how it looks like okay so it's finished and you can see that our vertex painting is working however it looks a little bit funny because basically um the tiling is not right so we're gonna fix it we're going here to my material and let's press u to get a texture coordinate let's press m to multiply and let's press one to change the tiling so right click here convert parameter and this will be my vertex tiling and i will put by one by default so i will just go here and then i can just put this connect this one in the uvs and then click apply and now what i can do is to go here to my main material and let's make sure this one is also in the group of vertex painting otherwise it will be very hard to find there you go and now you can do something like four or three or five something something like that and you can start painting now this is not a prettiest result but it shows basically what you can do with some vertex painting here so what i will show you is how you can actually paint it here if i double click on this one i can disable nanite and click apply changes and i don't really recommend you to do this because it's a very heavy mesh but once you finish painting your mesh um you know it will start looking uh nicer so let's wait a little bit and then we will see how to paint the new mesh without night okay so it's finished now my mesh is here and now that i don't have nanite i can just go here sorry don't go to modeling mesh paint and let's just go here paint and because i have a lot of vertex basically it will be very very hard for me to paint so vertex painting actually gives you a lot of flexibility but if you have a lot of vertex uh then you know it's it's gonna be a little slow here so let me just paint here a little bit just like this paint the red channel okay let's paint again there you go now we start getting something there you go play it again okay so let's play the game here maybe we can increase the strength a little bit there you go you can shift click here i don't really want this around the result so we can just decrease the size and then just paint something like this i mean night meshes are not exactly good enough for um for painting i mean without nanite painting becomes like really a mess and just to illustrate this point let me just delete some of parts with shift to make it like more like this and then let's just let's just leave it like that and now what we can do is to basically go to the material instance here and change the vertex tiling here we can i i believe five is not enough we can put something like 50 no that's too much uh something something like that like 10 or 7 looks like a nice number and this is how you can basically uh add more detail but you know in my personal opinion uh i would rather use uh the high resolution version for this it will be uh it will have a much uh nicer result so let's see how you can add very quickly a very complex vertex material quick cell already provides some material for you to use and actually combine very different vertex channels so let's see how you can use it so if you go to bridge here you can add many texture for example i will add this one and here you will see that i have a bunch of textures i can use so in order to select the material instance i can just go to my folder here and i can press the filter tab and then i can go to materials material instance and now you will see that i have a bunch of materials here so what i can do is basically select the materials i want to use for my material layer blend so i can select this one and the order is important because it will determine the base the middle layer and the top layer and then i will select the sand and then i will select the grass okay now that i select all of those i can just go to bridge and here this little icon here i can just click on this one and you can create a material blend here now you can blend this like tree blend material test and it will create a material with this name and it will by default the destination pad will be here let's create a material blend and looks like nothing has happened but now you will see that i have a new folder here called blend materials and what i have here is basically a very very heavy material that uses all the textures that i have you can see here in my surface material you can see that i have basically all the material blends for uh different channels which is great so what i will do here is to show you how it works uh let me go here again and let me duplicate this one okay just press alt and click and let's duplicate this and let's remove them vertex paint let's put everything into maybe dark okay black but let's go and apply our material here there you go now by default of course it will have my top layer here okay then we have my middle layer and then i have my base layer so this material apparently is not using the white to get the information is using the black so what i can do is to paint here and instead of painting the black i will put the white one so let's see what happens when i paint the red i can use paint here okay let's let's go here and and paint more actually let's sorry let's paint black okay uh let's go here and as you can see i'm having some controls here okay let's see what happens when we paint green you will see that i have my mesh here now this blending is like we have before it's very unnatural this is why the material layer blend comes with some controls okay so if i put the base layer controls and the top layer controls i can use change the blend contrast and the falloff for example let me move this a little bit okay and let me have let me have more space and this one also it will move it just like this so now what i have is the blend amount i can put zero or one or two and just by changing this you can see what's going on here uh the contrast is one if we put zero it will be like super smooth if we if we put one it will be very nice so uh let me paint this right to see how it looks like and as i continue to paint you see that it starts painting from the bottom to the top and the same can be done with this one we can change the blend amount to five or maybe maybe that's too much uh 0.1 or 0.5 and then go to the blend contrast and put something like 2 or maybe put the blend amount to 1 and then the falloff to zero or just make it really really harsh just like this and then when i paint the green channel i can just paint here and also change the blend amount to tree and then you can just click achieve here sorry make it one and just paint it like this and you have like a much harsher result especially in these areas here okay it will look much harsher and for this one of course you can have your blend amount and paint the red one here and that's pretty neat now if you paint the blue channel here let's see what will happen uh basically i don't have anything here but you see you will see that you have use puddle layer and what this will use is the puddle and as you can see my blue channel here uh makes everything more glossy it's like it's like a puddle so it's basically an additional feature that you can have here if you want to put puddles in your game uh maybe that's a good way to do it uh you can press shift to remove the puddles just little by little and this is a very nice way to create material blends that you can have in your game and you don't really need to create it from scratch just like with it you can use quick cell master material for blend and this will give you some really nice results so we take a look at a lot of things uh you now you will know what vertex painting is how it works how you can create your own materials how to modify meshes and how to use quick cell master material to create a very complex layer material so if you like this video give us a like subscribe and remember let us know in the comments below which kind of video you would like to watch next and we will see you in the next one you
Info
Channel: UNF Games
Views: 50,991
Rating: undefined out of 5
Keywords: unfgames, unreal engine beginner tutorial, unreal engine 5 tutorial
Id: rn21tf4mcWo
Channel Id: undefined
Length: 48min 27sec (2907 seconds)
Published: Fri Sep 16 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.