Full precision float Vertex Colors


#1

Hi,

I noticed that the Vertex Colors used in blender gets crushed into 8bit/channel. I would find it useful if this was changed to allow full precision float values. As a Technical Artist in the games industry I could use this for other things like altering deformation in vertex shaders or a cheep way of storing one shape key.

If I were to make a patch for this, would it be accepted?


#2

It’s a bit odd to change vertex colors so you can use it for purposes that vertex groups and shape keys are intended for. Why not use vertex groups and shape keys?

If we change it should really be with the intent of improving vertex colors, not to use them for a different purpose. Memory usage will increase but it’s probably not too bad in practice.


#3

The game engines imports meshes from standard file formats like OBJ and FBX. Vertex Colors can be included in most of these formats as float values. FBX also can also carry shape keys but they are for instance imported as a skeleton mesh in unreal. These are a bit heavy to deal with so sometimes it might be necessary to use trickeries like using vertex color in an unintended way to get performant effects on game consoles.

There are ways around this. Instead of using the vertex colors I could for instance create a data UV map and store the precision data in OpenEXR images. But every texture sample is expensive.

There are also a problem using Blender in a tool chain if the vertex color information gets crushed. A link can not be allowed to destroy information.

I can’t really say that it’s to make Vertex Colors them self better… but I think the interoperability is important.


#4

afaik vertex groups are not accesable for shader in most engines (even in eevee/cycles)
And using shape key enforces using skinned mesh which is more expensive than static mesh.

From my experience using vertex colors as set of 3/4 often unrelated vertex groups in shader is more common than using it as color information.

Eg. As factor of mixing textures (1, 2)


#5

Ok, then I think we would accept a patch that makes vertex colors floats.

If you do this change, it may also be a good time to then store the colors in linear color space rather than sRGB. Since this is a bit of a mess now. But that’s probably best as a second step.