Generate normal from vertex paint?

Hello,

I want to create a wall covered with plaster on which I could use vertex painting to show the bricks underneath. So I created a simple material but I have some trouble to create a sense of depth between the plaster and the bricks where they blend. Take a look:
df2c3a60b157bcf1b6c1f1419dc3721d896713fc.jpeg

As you can see on the example above, the blending between the plaster and the bricks is flat. I tried using the node PerturbNormalHQ and managed to get some kind of bump effect:
9370f2cb93a86a866d824fd0b93afbcbea42ffed.jpeg

As you can see, there is some kind of pixelated effect which cause some flickering from the distance. Unfortunately, I have no idea how to fix this. Close up:
b130ae7c28b16ea743171bf7bb44d0a330fdb53b.jpeg

I also tried using the node “NormalFromFunction” but I didn’t manage to get any decent results since there is very little information on this node.

Here is my material:
6cb04b71fae789bf2c052e83da1db7008d820153.jpeg

Close up:
01a1438649195ccea8b789c1ca163a5cf2986f15.jpeg

So basically what I want to do is to create a normal from the vertex color information. Does anyone know how to achieve this? or maybe how to fix my issue with the PerturbNormalHQ?

Thank you very much.

You can try sticking the result of the Alpha for the Lerp between the plaster and brick into a NormalFromHeightmap Node for a normal map with rounded edges at the corners of the transition from plaster to brick.

I tried NormalFromHeightmap node but it does not work because the height map input only accept TextureObject nodes. :frowning: Thanks for the suggestion.

This is exactly the type of thing I spent a lot of time trying to get right in gears. The best bet it to use a companion normal map that goes along with the heightmap you are using for your blend modulation.

For example if your height blend texture is photoshop clouds, try converting them to a normal map using the nvidia filter or xnormal or knald. Then when you have a nice blurry normal of the height, you can sample that normal inside of your material along the intersection. Probably need to boost the strength of the normal to make sure it doesn’t get less intense near the flat bits etc. This method isn’t perfect but it is about as close as you will get without perturb normal or something like it.

The same technique works for many advanced blending techniques. For example, you can make some custom blend normals for snow as it falls on rock that makes the snow have a rounded pillow like appearance by creating a blend modulation texture that is based on a blurry version of the rock displacement and then a normal made from that blurry texture, and then overlaying that blur normal at the edge using some material defined parameters for the length, intensity and power of the edge blend.

Thanks so much, it was so simple I didn’t even think about it! It works much better now. :slight_smile:

Looking good!

Another trick you can use for another quality boost if you can afford it is to create an AO like darken outline along the intersection. If you get a nice wide distance gradient along the inside edge and then modulate that using either the height or AO texture of your bricks and then tweak the resulting strength just right, it can add some very realistic effects. Without it the stucco can appear to float in places but that is probably nit picking.

Good idea, it does look even better with AO. Thanks for your advice! :smiley:

Sorry for ressurrect this, but this material is very awesome.
Can you share with us you material blueprint to achieve this result?
Thanks!!

Hello! Well there was already some screenshots of the graph attached on my previous posts. If it can help you better, here is the project file for the material : BricksPaint.rar - Google Drive

Use the red channel for painting
Red 1 = Stucco
Red 0 = Bricks

Sorry to bump this thread again but I just wanted to say what an amazing result this shader produces and thanks for sharing.

I am trying to break down this shader and really understand what is happening.

  1. What is the purpose of the Blurred height map that is then turned into a normal map? What does that add compared to just using the Noise normal texture map for break up of the transition?

  2. Also I can’t figure out why you used those MF_passthrough nodes?

Any direction would be greatly appreciated.

Thanks again.

Hello!

  1. The blurred normal map is there to boost the detail in the transition. It allows to keep some of the brick shape in the damaged parts by blending it with the noise normal map. Depending on the situation, it would probably be better to make a good normal map for the transition part (something like a heavily damaged brick instead of a basic tiling noise). Or at least, make a single normal map from the tiling noise and the blurred bricks instead of blending them in the material editor (for memory purpose). The reason I did this here is simply because I was not really satisified with the tiling noise alone but I was too lazy to make a better normal map (and the brick normal was too sharp so I just blurred it in Photoshop).

  2. The PassThrough nodes are used for organizing the graph and are just there for readability purpose. Since there is no “reroute pins” like in the blueprint editor, I made material functions for each input type and just connect them directly to the ouput. (I don’t know if reroute pins have been added in the material editor since then.)
    16672-reroutenode2.png

Hello!

Sorry for bumping this old thread but I’ve been frequently receiving requests to allow access to download the project files from the old Google Drive link.

So I decided to convert the project files for newer versions of Unreal (4.26 and 5) and made it available to download here:
https://www.artstation.com/marketplace/p/9arwA/

Hope it will be helpful!
Étienne