Blog

Breakdown: How I did the vertex color shader

I got a couple questions about my vertex color shader when I posted the Old shopping mall scene. In case anyone is in need of something similar, here’s what I did:

The trick is to pull the roughness-, and metalness data from uv island locations. This is then combined with the vertex color data, giving us a mesh complete with colors, metallic and roughness without unwrapping or any texture usage. It is also possible to expand this and use the vertex alpha channel for additional data like emission. I found this setup really handy for small clutter items and I also used it for some of the large and narrow metal surfaces that were mostly defined by a gradient.

Note: The gamma correction is only necessary if your 3D package outputs the vertex colors in sRGB and your game engine uses linear colors like Unreal does. If your colors look washed out, this is most likely because of the mismatch. Power-node with value of 2,2 will fix this.

Here’s how the items look with the shader. Up left is Unreal blueprint view and down left are the uv coordinates in Blender.

Results of the shader in the scene. Chairs, plates and cups are all using it.