Advanced Vertex Painting Techniques
Вставка
- Опубліковано 2 січ 2025
- Today we have a look at how we can use Vertex Painting to create Material Blending and how we can add detail with Noise and Heightmaps.
If you want to learn more about Materials in Unreal Engine check out my new course here:
tharlevfx.gumr...
If you have any questions about Game Art VFX or the Unreal Engine then email me: tharlevfx@gmail.com
Or you can find more tutorials on my website: www.tharlevfx.com
or check out my work on the Unreal Marketplace:
www.unrealengi...
or follow me on Twitter: @tharlevfx
If you'd like to support the channel then follow me on Patreon: / tharlevfx
This is the best tutorial on vertex blending I came across.
thanks!
Absolutely
Dude, this was exactly what i was looking for! Nice tutorial, step by step with visualization of every level of detail you added in. I will test it now in my project, but im sure, it will make it definetly more realistic now. Thanks man!
Amazing tutorial on vertex blending! Thank you!
Awesome!
@tharlevfx You're videos are so good, love the way you start off super simple then add complexity, makes it so much easier to digest. Keep up the good work Sir!
Great Content as always Tom. The edge noise trick is really useful, will definitely be using that one.
Duuuudee!!!! Great tutorial.
I cover vertex painting and landscapes in more detail in my materials course, available on Gumroad
Hey there, love your videos, as someone interested in learning more about materials your channel is gold. I would love to see a video regarding layered materials and your thoughts on the system. Feels like a bit of an untapped part of the engine as far as training goes. I've got the basic idea down but seeing something more advanced would be awesome. Keep up the great work!
Thank you so much mate. Absolutely awesome stuff and way in which you explain it is great.
Hey, is there a way to add drop shadow or ambient to this vertex paint mask?
you can use some shader math to calculate an edge normal from the heighmap, which will give you a shadow effect, based on lighting. similarly you could create a darker AO pass layer and then use the same mask logic to paint where that is placed.
i cover this in more depth in my paid material courses
Your tutorial are great ! You cover most of things really simply and your tutorial are easy to follow! You literally are a life-saver for people starting Unreal Engine!
Thanks a lot for doing that.
Keep continuing your content we appreciate it ;)
Great tutorial, thank you very much!
Thank you, I was looking for something like this and it does help a lot.
Fantastic work, as usual Tom. This solution works for my stuff too, so result!
Really nice content...
you deserve more views.
Fantastic stuff!
you are really good sir, thank you for sharing this content!
I think we need to invert the height map before the heightlerp node so that the plaster stays in the brick joints rather than avoiding them.
Depends on what kind of brick wall you’re making - both things can happen
Highly Appreciated. thank you, Sir, Subscribed
Excellent work learned a lot from you really appreciate these tutorials
I am using Unreal Engine 4.27.2 and How come in your Material fuction view (16:08), The CheapContrast (S) is missing. Why is that? Also, at (16:49) You took the MF_AddNoiseToGradient's result and plugged it into Transistion Phrase (S) outlet, When I did that, it caused an Error. (My Vertex Color was plugged into Gradient (S) aswell). What is causing my error? Thanks if you respond!
What does the error say? It’s probably a function input without a default, that happens pretty often
Thank you very much for this thorough tutorial! Followed everything exactly, material function working as expected, however when I try to integrate it into my master material it says I have compilation errors in my material and I can't quite figure out what's causing it... has it maybe sth to do with me using the alpha channel of my vertex colors..? Maybe it's also because I'm plugging the results of my MF directly into the Alpha of my BlendMaterialAttributes? 🤔 (Also very sorry if this is a dumb question, I'm super new to UE!)
Yeah, it’s probably a data mismatch between vectors and scalars somewhere. You should check out my material course on gumroad if you’re just starting out in ue5
@@tharlevfx damn, I most definitely should and will! Looks like a lifesaver :ooo thanks for all your in-depth content!!
Thank you for the great tutorial! It was super helpful.
Thank you tharlevfx, Good explanation. this is very impressive for my individual project. I was a bit worried to know how the vertex paint works in unreal.
Love your videos !! Thanks a lot
Is there a way to use more than R G B A in the painting. I am using RGB for tint colour and Alpha for the 2nd layer blending, I've run out of channels, any way to get more for things like dirt etc?
So yes and no. You can’t add more channels of data but you can use the same channel for more than one thing. You have to do a bit more math in your shader but you can divide a single data channel down to be 0-0.5 dirt and 0.5-1 wetness for example.
Generally I wouldn’t use full rgb for a tint. Just use a single channel and two fixed colours. So 0 would tint red, 0.5 no tint and 1 tint blue for example. This gives you less control but does free up two channels for other uses.
Hope that makes sense!
Hi , thank for the tutorial .
how do you create the paramter node transition and contrast . it seems that you clicked on a shortcut to create them but didn't notify witch one it is ?
Thank you
If you check the palette window on the right side of the ui it tells you all the keyboard shortcuts
@@tharlevfx thank you , i found it in fact , it's s+Left click
Thank you. Its very cool trick!
Wow! Thank you, this is exactly what i needed now))
amazing video, thanks
Is it possible to have a peeling wallpaper effect on vertex paint blending?
yes and no - you can only paint the surface that's there so you would struggle to get a fold of wallpaper to look like it's coming away from the wall and falling as geometry. You can definitely paint surface detail and normal information though for small bits of peeling.
@@tharlevfx how would one go about that then?
@@jayjaygolden5123 for a peeling wallpaper effect i would probably make a few bits of 3d mesh that look like folds of paper as they come away from the wall. Then i would set up vertex painting between the wallpaper and the under surface, with a nice transition for the underlay paper. Then after painting the surface i would place the 3d meshes around to make it appear that the wallpaper has peeled off in places in larger chunks. The combination of material and 3d mesh should hopefully sell the effect.
@@tharlevfx im wondering more aboyt the smaller normal mapped peels, how would you get those correctly placed at the edge of the vertex painted 'mask'
@@jayjaygolden5123 if you think of the mask as a gradient - where white is wallpaper and black is brick, for example, then you just need to place the wallpaper peeling part of the material where the gradient is close to white - ie,
0.9-1.0 wall paper,
0.75-0.9 peeling paper,
0.5-0.75 paper underlay,
0.2-0.5 peeling underlay revealing brick,
0-0.2 brick -
then how you control the gradient using vertex painting will give you the transitions between the different surfaces
Awesome tutorial, how would you add a normal to that inbetween blend so you get something like a flakey paint normal in between a brick/plaster?
There’s two options - you can use the vertex painted mask as a basis to generate a normal (check out my video on deriving normals in shaders) or use the same mask and a bit of math to isolate the middle grey where the transition is and blend in a third material for the normal there.
@@tharlevfx awesome thank you!
This looks great, thanks so much!
one of the best tutorials on this subject I have seen (!). Some Questions:
1. Why don't you use the "MayLayerBlend_StandardWIthDisplacement?". I understood this node allows us to blend between 2 MaterialAttribute's.
2. There is also a node called "HeightLerpWithTwoHeightMaps". In it the transitionphase (VertexColor Red in our case) gets inverted, than Height Texture 1 gets added, than +1 to get A.
Now A-B gives you the Alpha where B is the Heighttexture 2 added to the VertexColor after its multiplied by 2.
I honestly do not understand the logic behind this math and im hoping you could provide some insights in this troubled Artist mind :P. In specific, why the 1-X on the VertexColor?
to answer my own question ;):
1. the matlayerblend_standardwithdisplacement is basically the same node as materialblend but its placed inside a material function instead of the node being hardcoded. This allows you to add or pull code from it. In this case the displacement/height has been added as an extra output in case your blending multiple layers which use height.
2. the heightlerpwithtwoheightmaps basically takes into account 2 height inputs so that you can blend the second texture using more variation, which can add more break-up when painting. You can use a grunge texture or the height from texture 2.
Thanks for the tutorial, is very useful!
How about if you would like to define height values to the different materials? for example 0 to the bricks and 0.5 to the plaster/paint to have a normal map gradient on the edge of the plaster/paint? I don't know if I make any sense ...
So you can pack multiple painted layers into the same colour channel - it gives you a bit less accuracy though. But basically you paint a and b together, then that blend with c etc.
there’s also the perturbnormal node that can generate a normal from your heightmap for things like edges between the layers
Does the orientation of the gradient change depending on the direction you paint? Because in the example it goes from 0-1 horizontally.
Yeah that’s just the example - the gradient you paint is however you want
Thank you!
Thanks for the tutorial, How do I blend 3 textuers with 3 height blends on it.
For example: Brick, plaster and Dirt.
You just need to do the same setup twice with different vertex colour channels
@@tharlevfx Thank you :)
How to mix between landscape materials, material instances and such ?
Or for example master materials, let's say like the ones in Rural Australia nonlandscape materials and materials instances.
I'd love to see tutorial on this.
Thanks.
You can’t blend between different materials/instances I’m afraid. All the blending logic needs to be in the one material.
If you mean hiding seams between meshes - check out runtime virtual textures
Very Helpful, keep up :)!
Great Video, Thank You...
I wonder if you could help me?
I have a problem, before I watch this video I accidentally painted one mesh and now every single Material in the Entire engine🤦♂️ has a stain on it. How can I change it back?
There’s an option in the vertex painting menu to revert vertex colours to imported mesh. And I think the same option if you right click on the mesh in the content browser
Thanks for replying 😀 but that did not work. It's driving me mad 😂 every material has black dots all over them
And when I move anything in the editer the black dots flash and move 🤦♂️
@@jamiefurey564 does the mesh have nanite enabled?
@@tharlevfx no, I am using UE4. Could it be something to do with lighting?
how do i vertex paint and save it in ue5
thank's for the video! is there any way that you can save the blend as a texture/material? and use it to different mesh? thank you!
you can't save you vertex painting out as a texture unfortunately - you'd need to do a different setup with render targets for that. you can save the vertex painting of a mesh to the mesh itself so that it becomes the default painting for all instances of that mesh. it should just be a setting in the vertexing painting tool palette iirc.
@@tharlevfx thank you for your fast answer, I really appreciate it. The idea was that I want to have nice environment walls but with vertex paint, you need a lot of geometry, so I was thinking just to create a high-poly for the vertex paint and then apply the same material to the low poly mesh. Don't know if that I explain correctly
@@alintapordei7514 you don't need that high poly a mesh if you use the world space noise technique from this video to add additional detail between the painted vertices. also each mesh is probably going to want to be individually painted so i dont think there's much benefit to trying to save your painting. you can bake to vertex colours in things like maya which could be useful in your pipeline, depending on the scene you're trying to make - if you really want high detail control, just use a texture mask instead of the vertex painting - then you can paint a few variations in something like painter and just change the texture parameter in the material instance. it'll be a more expensive shader but you'll get per pixel control over your blending. - hope that makes sense!
@@tharlevfx it makes sense, just I wanted to do something a bit fast inside unreal and don't use other software, because I have some repetitive environment and don't want to spend a lot of time making it :). Thank you again for your response :)
Hi, your explanation was fantastic, but i have a problem when i try to apply vertex painting to a BP prefab nothing happens it only works with static meshes, is there anyway i could implement vertex painting with BP also?
You can import a painted mesh but that isn’t really suitable for this dynamic painting. I’m not sure unfortunately, I think no but I’ll have a look and get back to you if I find a way
@@tharlevfx actually I found the solution, before I was using the old method of converting my selection to BP, which converts the static meshes into Children of the root component, and that makes vertex painting impossible, so you actually need to create the BP from scratch and have a static mesh component that's not a child class.
@@marconapolitano2821 ah nice - good to know!
Can I use POM with vertex painting?
Yeah for sure.
Hi quick question is height lerp usable with POM?
I’ve not used POM much but it should be yeah
@@tharlevfx Might I ask?, why do you not use POM? Is it not worth using? Is there any other way to use dynamic material with height? Thanks in advance!
@@korakot2003 firstly I’m a vfx artist and POM is usually an environmental thing so it’s not usually my decision.
Secondly it can be quite expensive to use and often looks bad from shallow angles so the results are variable.
When it works it’s amazing but there’s times it definitely doesn’t.
These days I would probably start with tessellation and deformation with nanite for similar details, but as always it depends on your project.
@@tharlevfx Thank you!
I didn't understand the world displacement part. Anyways, how can you paint with a third material using this technique? I was thinking maybe another vertex colour channel (lets say green), but i dont know how to combine that in. I tried using two BlendMAterialAttributes Nodes, but that did not work
That’s the right techniques - use red to blend the first two together then another channel, say green, to blend a third.
@@tharlevfx i did that using two blend nodes, but the result was a blank shader
thanks
how about the paint texture?
What about the paint texture?
@@tharlevfx people always show vertex painter tool but next tab is paint texture. I tried but UE4 crash as soon I draw something . Do you know how it works?
@@fran.fernandez so in theory you can paint texture masks in unreal but I’ve never used it. I’ll try it out in a future video maybe!
yeah nice, I tried the edge noise setup, and it constantly crashes when opening the Material Function
Sorry about that - there’s nothing particularly complex happening in the function so I’m not sure what could be causing the crash
@@tharlevfx ah, my wording wasnt very nice, sorry mate, I have no clue what happened. I will try again. maybe its a 5.3 thing
for example I will add a worldalignedblend "SNOW" at the end of blendmatattrib how can I do that? Lerp and HeightLerp doesn't work.
if you're painting between materials then you need to either use BlendMaterialAttributes or Break and MakeMaterialAttributes so that you're only blending the right thing each time. If you want to paint flatter normals then just lerp between 0,0,1 and your normal map and paint a mask for the Alpha - 0,0,1 is a flat surface so you can paint how much influence the normal map has.
@@tharlevfx Hi thanks, I didn't use breaks or make this time and just directly dotted them in the material I think that's only work for me /for now. thanks man! btw your tips is really awesome, saves my life in game dev.
awesome tutorial, ammm for some reason I can not get the same result as the function(MF_addnoise), I made the same structure but im getting a linear gradient, any clue?
check your function inputs - the default preview is a gradient but that should be able to be overridden by whatever noise you plug in to it
@@tharlevfx Thnks Sr. you rock
@@tharlevfx I'm teaching myself Unreal engine because my son is into it as part of his college course and I want to understand what he does. I was generally able to copy your instructions very well but like Mr. Media I'm getting an error with my MF_AddNoise function. Sorry if I seem ignorant but what do you mean exactly to check the function inputs? Also is that a TextureObject expression at the lower left? I used the T_Default_macrovariation sample but now in the texture sample it shows plain white and not the texture? I'm guessing I did something wrong there?
@@fernandobaquiran6837 the function is set up with inputs that allow you to change the data that you're passing into the function. the default i set up was just a simple gradient so you can see the effect working, but you want to be able to override that with whatever data you need.
TextureObject and TextureSample aren't the same thing - an Object is just a reference to a texture file directly, a Sample looks up the colour data in a texture, via uv's, and returns the RGB values - you can convert one to the other by the right click menu. Hope that helps!
@@tharlevfx thanks for the quick reply! Yes it helped. Now I'm going to try to continue the part where you said more materials can be added. Do you have a video about that?
Thank you so much ;-)
Nice tutorials. In all your videos I feel you are really zoomed out which makes things a bit hard to read. In unreal looks fine but would definitly be easier to read if you zoomed in 0.33x more
Thanks for the feedback - I try and remember to record in hd rather than 4K now so hopefully things are a bit easier to see in my later vids
Hi tharlevfx,
I have a question for you. Actually I asked it yesterday here in the comments, but for some reason it has disappeared. I hope it's just a youtube bug, so I'll ask it again if you don't mind.
I'd like to add one feature to material blending which I believe make its even more realistic and believable. Basically it's kind of a slope on the edge between two materials, showing a difference in height for the brick and the plaster layers. Hope you can imagine what I'm talking about. Could you please explain or make a tutorial on how to achieve that?
Thank you!
Yeah I got an email about the comment but couldn’t find it. You need to have a look at Pom and generating normals in the shader to get a nice edge between the surfaces - I’ll add it to my list for future videos!
does anybody else get an error when plugging the material function into base color?
What does the error say?
@@tharlevfx Missing function input "NoiseTexture"
@@itzjeo5585 then it sounds like your function is missing a texture input. In the input settings there’s a option for Use Preview as Default - if that is set it will use what’s in the Function unless you overwrite it
11:30
reallycool
one vid for 4.25 be great seems there's a little difference
I've just discovered your channel and it's awesome ! Currently learning level design with UE4 and your tutos help me so much ! May I ask your something sir ? I found another video tutorial which seems similar to this tuto, especially the end with the edge noise trick. The vid is here : ua-cam.com/video/rumECnGptgw/v-deo.html Though, his settings are differents. Just look around 10min. Then the result around 17min is just like your (the nices variations on the edge). Problem is that his video freeze like hell. I don't understand english 100% perfectly so without the video, I can't get what he does, sadly... Does his method tell you something ? Have you another tuto more similar to what he does on your channel ? I'm very curious about this thing ! It's like he does the same thing that you (a bit more customisable maybe ?) but with multiple RGB channels and some colorful noise texture (you use them in your vid called "Unreal Shader Math 101", notably) but really, I can't get what he does exactly... :-(
Thank you again for all your work. Really appreciate this ! +1 subscriber !
Actually, the guy has a similar tuto but also the exact same pilosity... I've just noticed that, hahaha ! Just kidding... :-D