Vertex painting with 8+ textures (How can I achieve this?)

Im very new to unreal engine and materials, I was wondering how could I vertex paint with 8+ textures? I know how to vertex paint with 3-5 textures but how is 8+ textures possible?

Textures I want to use:

  • Grass Ground
  • Grass with fallen leaves ground
  • Grass with rocks ground
  • Cliffs
  • Mossy Cliffs
  • Wet sand
  • Sand
  • Sand with rocks

Version 4.25.3

1 Like

Anyone have any ideas? I found out I need 12 textures to vertex paint

1 Like

You only have 4 vertex colors to use. Usually that’s one per texture.
if you want to use anymore than that you’ll have to work your own custom system using Frac to section off color values of the same channel above/below your preferred value.
its not impossible to pack in 12 different things given you have 256 shades of gray per channel you could potentially isolate. It’s just pointless because of the loss in performance.

So having 12 separate textures with normals and tessellation would cause performance problems? Is there a way I could have it and keep it optimized? Also how could I isolate colors for each texture?

I have no clue how to section off color values with Frac any ideas?, because this is not very good on performance is there a better way to paint 12+ textures on a mesh?

Painting 12 textures in a single mesh is bad. Period.

why don’t you just use an external 3d program to paint the object as you need / do you really need to be able to paint 1w textures on a single object at runtime?
its a bit past ridiculous.

frac and mod can help return integers/hard masks.

The base idea here is that you take the R from vector paint and you section it off. You can also use an IF statement.
values above X will display texture A, values below Texture B, values equal texture C.

Thats 3 texture per channel.

3x3 is 9, so that’s 9 textures you can use off r g b with IF nodes.
add 3 from alpha and you got your 12.

More than that, use more IFs. Performance will be bad regardless.

So why would this cause perfomance problems?

1 Like

Many reasons?
loading 12 textures in memory is a safe way of jumping off to a really bad start. The MS cost of rendering this one item will be at least 12 times as much as any other. Thats also assuming that the number of drawcalls is 1 and not 12. Hard to say because it depends on the material.
if statements arent blocked (Meaning they evaluate no matter what is true or false) however, so they always completely calculate making the number of instructions of the material a lot.

On top of it, I would have to assume you are doing at least some basic blending, which doubles the instructions needed for every texture. And the question remains. What for? Do you really need to change this in editor so much? The real answer is likely No. You just use different meshes, decals, anything that’s cheaper.

Isn’t Shared:Wrap one way to reduce cost? In addition, why not use two separate materials with 6 textures each? or 3 materials with 4 textures? It’s a landscape, right? So it would probably be easier to do using more than one material. It would still be 12 textures.

I am targeting the most capable highest end hardware so this method will work with no performance issues?

I still don’t recommend it, but yea I don’t see why it wouldn’t work.
Math is math. So long as your math makes sense to the shader, you’ll get the results you want…

Also, do a test on a uniform color vertex painted mesh to with the Debug Vector node to see if the value value the color is a float or already expanded to full color (max 255).
If it’s a floating point, you may want to Multiply by 255 to work in the same range as RGB does on a color pallet.
Chances are there’s a built in function to convert the value correctly…