How much information can you store in vertex color?

I use the color of the vertex to decide which texture should be used and got 4 textures working:

  • Texture 1 : Red
  • Texture 2 : Green
  • Texture 3 : Blue
  • Texture 4 : Black

I tried to add the color White to gain a fifth texture, but this didn’t work because it behaved like a overlay on top of the other textures (Well, this could be expected…).

So my question is: how could I store more information into my vertics?

I found a shader that supported 8 diffuse textures, but I think that’s the limit. Anything more will have to emulate Unity Terrain’s splat map system (which I would love to clone for custom meshes).

The name of the shader is “TMG_8SplatShader_Diffuse”.

I came to the conclusion: How much you need. It is possible to get the color value from a certain range:

	half value = step( 0.5, IN.color.r);
	half value2 = 1-step( 0.5, IN.color.r );

tex2D( _Tex1, IN.uv_Tex1 ) * value + 	tex2D( _Tex2, IN.uv_Tex1 ) * value2

value is in the range of the red channel from 0.5 to 1.0, while value 2 is in 0.0 to 0.5. Both return 1 if the step function is true. How much performance it costs is a different matter.