Vertex colors are simply arbitrary further knowledge you may pack right into a mesh – you do not have to make use of them as literal colors when rendering. So continuously, these get used as management weights for a wide range of results:
-
Storing low-frequency ambient occlusion or baked lighting knowledge (which may be literal gentle colors, or every channel may retailer an publicity masks for a given gentle supply or approximated bounce).
-
Controlling which vertices in a fabric or foliage mesh are free to flutter within the wind or get pushed away from pressure fields, versus which of them ought to keep extra rigidly mounted in place.
-
Storing a neighborhood offset to a pivot level, or the orientation of a joint/axis, in order that branches of a tree or dangling bits of a dressing up will be animated cheaply in a vertex shader with no need full skeletal animation for each wiggly bit.
-
Controlling the frequency bands of such movement, so leaf ideas can tremble whereas thicker branches slowly sway.
-
Controlling the section of animation, so results can ripple from one a part of the floor to a different in an artist-controllable means, unbiased of the mesh’s pose or texture unwrap. This may also be used to make totally different elements of the asset animate out of sync with one another, so the impact seems extra natural fairly than mechanical.
-
Masking which elements of a mesh with overhangs ought to get moist when it rains.
-
…or extra usually, choosing out any elements of the mesh that ought to have some particular impact utilized, that does not want the per-pixel precision of an additional masks texture.
Natalie Burke introduced an ideal GDC speak with a number of examples of how some of these strategies are utilized in Future, particularly for issues just like the animations of weapons and different gear objects.
Yow will discover comparable strategies on this longer presentation from Gilbert Sanders about vegetation rendering in Horizon Zero Daybreak (round 10 minutes in).
One thing helpful about encoding this data within the vertex colors as an alternative of utilizing the vertices’ native positions is that vertex colors are preserved unchanged, even should you mix a number of small meshes utilizing the identical materials right into a single batch (which normally entails ‘baking out’ their transformations, modifying the native area vertices that the vertex shader sees). In order that’s why you will nonetheless see this used, even in circumstances the place the vertex color is only a predictable gradient within the mesh’s native coordinate area.