1. Can Vertex colors be changed at run time? Example, if I have a car during day time and I want the "shadows" on it to change based on which direction it's facing.
2. Are Vertex Colors expensive to use?
3. Are Vertex Colors still used in PS4/XBO production?
4. For large environments, is it normal to have a lot of unique materials? This is after using all shortcuts and cost cutting techniques (i.e channel packing, material instances, texture atlases).
Replies
2. They can be expensive to use if your mesh has a billion vertices on it.
3. It depends on the game engine and how the shaders are set up. Typically vertex attributes are used to represent low-frequency phenomena, like ambient occlusion, material masks, bone weights, UVs, tangent basis, and low-frequency normals. Guilty Gear Xrd uses all of the vertex color channels to modify things like the amount that the inverted model must be pushed out to create an outline (i.e. stroke weight). I'm sure other engines use them wherever it's efficient and useful. The nice thing about vertex colors is that they don't depend on texture resolution, so if you set up a tiling UV set you can get some things uniquely mapped with vertex color.
4. Clarify pl0x. Are you talking about overall draw call count, number of unique shaders, number of assets that are uniquely UVd, or what? If you're on idTech or you have an Amplify Texture license for Unity you can uniquely UV whatever you want and it's fine because of ARB_sparse_texture. Otherwise you'll probably be using a lot of tilable textures combined in clever ways to hide their tilingness. If you want to know the draw call count for a current gen game see if you can attach a graphics debugger to one on your PC.
For example, here are a bunch of materials I made for a Bathroom environment.
I will optimize them more but does it matter if I make 10 or 50 of these for a game if there are a lot of different objects?
I don't believe they have realtime performance benefits, but they do allow for faster iteration because changing a parameter in a material instance doesn't require you to recompile the base material.
Here's the UE4 docmuentation on material instances: https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/MaterialInstances/index.html
Hope that helps!
Not really. A vertex color is usally 4 bytes only, for comparision:
texture coords are ~4/8 bytes, position is ~12 bytes, bone weights ~4/8bytes, normal ~8/12bytes, tangentspace >=8bytes
Why not ? Nowadays your engine defines the attributes which are associated with a vertex. Therefor vertex color could be used as visual representation of a custom vertex attribute, eg to blend different textures or just to add some more tinting/variation to the same texture etc.