High Priority – Game Art

Basics of Vertex Colors

1. What are Vertex Colors

Vertex colors are values between 0 and 1 (or 0 and 255) that can be added to the vertices of your mesh. And that most tools and engines support, including the FBX file format. I believe OBJ does not support vertex colors.  Technically you can have an “unlimited” amount of these values. But it is common practice to limit it to the RGBA values, so 4 values per vertex. Hence why we call it Vertex Colors.

Let’s take a cube for example. It has 8 vertices. Each vertex has a number, something you don’t see when you’re just modeling but it does need this so the 3D world and files formats know what vertex goes where and how everything is connected. Per vertex number a set amount of values are added, RGBA. We can then adjust these values using our 3D tools.

See the image below.

  • The left cube has no vertex color data, and so is gray (default representation in Modo).
  • The middle cube does have vertex color data, but it is all black. So 0,0,0,0 on all vertices.
  • The right cube is also all black. Except the one in the corner, which is Red. So 1,0,0,0.

Vertex Colors - Cube Example

Depending on your software tool. You can simply use a color wheel to “paint” colors into the vertex color data. Some software also have tools so you can make them gradients or other forms of manipulation.

The vertex pain tool in Modo:

Vertex Colors - Color Wheel

Note that you can also use Channel Masks as seen in the image above. This is handy since often vertex colors are used for shader effects. Where the information in the Red channel does a completely different thing than that of the Blue channel.

Also note that vertex colors are not part of regular rendering. Meaning that when you’re looking at the object in your regular viewport or with PBR rendering. You don’t see them. Only through a shader, or a specific viewports vertex color view option can you see them.

2. Applications of use

You will often see the use of such masking methods with foliage and a tree shader. Where the Red channel controls a wind swaying effect of the entire tree. The blue channel controls the swaying effect of the branches. And the Green channel controls the fluttering of the leaves. However, vertex colors are also used for texture blending on floors and walls, Creating coloring gradient controls in the shader, VFX shader effects, creating a cheap AO alternative, etc, etc

Vertex Colors - Tree Example

For correct use of vertex coloring for shaders, you often need a few handy tools. Every 3D software tool has different methods, so you will have to see how they work for your chosen 3D tool. You will want to be able to do the following:

  • Fill the entire object with a color that also works with channel masking. Good to make it all black.
  • Linear gradients that also work with channel masking. Like with the tree example above, channel red.
  • Spherical or cylindrical gradients with channel masking. Like the tree example above, channel green.
  • Regular painting with a brush that also supports channel masking.
  • The ability to adjust the values on a single vertex, or group selected vertices. For those moments when you need exact numbers.

3. Explore yourself

Here is the tree model from the example above so you can explore yourself.

I suggest you also use basic primitives, like a box or sphere. To explore the tool sets within your 3D package. And try to export and import it with FBX, so you can check if it comes through correctly during the exporting process.

Vertex Colors - Example

See you next time!

The High Priority Team