Vertex Paint vs Texture Pallete: Which is more efficient?

What is the best way to color a 3D model with simple colors?

Should I vertex paint the model and then use a compatible shader to show vertex colors, or just make a color pallete texture and UV map the model accordingly?

It seems like the first will be faster and easier, but I’m not sure if there are some performance reasons to consider here.

The goal here is to have lots of color options, but only use 1 Material, static meshes, and thus 1 draw call.

From what I’ve researched so far, it also sounds like both options will require me to save separate meshes if the model needs different colors.

So basically, which option has better performance?

Vertex colors will be faster.

As long as the material is exactly the same asset used on all of the meshes, and all the meshes are all set to static batching they’ll batch. In fact even if they dynamic (and you have dynamic batching enabled) they’ll batch too, just separately from the static geometry.

If you need two meshes of the same geometry but different colors, you will need two meshes. Though you can work around this by using additionalVertexStreams if you want to use the same mesh, but I wouldn’t worry about that too much as once they’re staticly batched effectively every single copy of that tree is a unique version of the mesh baked into a larger mesh. Performance wise you could have 100 of exactly the same tree, or 100 completely unique trees of the same vertex count, it won’t care at that point since in both cases it’ll be treated as one mesh with 100 trees in it.

You can also use the free VertexPaint tool to paint meshes in the editor to make them different colors. This uses additionalVertexStreams so you don’t have to have multiple copies of the mesh asset.

Technically you could do this with a palette texture and UVs too, even update the UVs with additionalVertexStreams. We used a palette texture for Dino Frontier, though we didn’t use additionalVertexStreams to modify the meshes, we just built unique meshes.

3 Likes

Thank you very much for taking the time to leave a good reply! Very helpful :slight_smile:

I’m using this vertexpaint asset currently. It puts a vertex instance stream script on each mesh object I paint on. Do I need to remove this script everytime? Or is the script the thing allowing me to not have copies of the same mesh?

Thanks!

If the script is using additional vertex streams to apply the color, the script is what’s storing the vertex coloration and applying it to the mesh. Without it, yes, you’d need multiple meshes.