Vertex Colors Too Bright

PhilBax
Tue, 15 Jan 2019 16:47:24 +0000
Character & Animation

Hi! We’ve added support for linear vertex colors to both static and skeletal meshes in UE4, as we need full 32-bit float precision for our project. This worked fine in version 4.19.

We recently upgraded to 4.21.1. We have an asset that uses both textures and vertex colors, and the two should blend seamlessly. In 4.19, they did. In 4.21.1, they do blend seamlessly when the asset is imported as a skeletal mesh. However, as a static mesh, the vertex color sections are much brighter than the textured sections.

Furthermore, we have a test that takes a plane that we generated with a specific “hardcoded” grayscale floating-point vertex color, renders it fullscreen without any post-processing to a render target, and reads back the rendered pixels to confirm their value matches the input value (we added support for reading back 32-bit float values from a framebuffer). In 4.21.1, the hardcoded grayscale value is 0.540021. The rendered value is 0.70784. As you can see, quite a difference!

The difference is still there if I use OpenGL instead of Vulkan, so that’s not the issue.

My guess is it may have something to do with the new work to make static and skeletal meshes siblings? I know there’s been a lot of behind-the-scenes work to redo how UE4 imports/generates static meshes. In fact, I rewrote one the importer for our custom asset type to use the new MeshDescription object. I simply store the linear vertex color value directly into the MeshDescription’s VertexInstanceAttribute’s Color array. But we’re still seeing the issue.

Perhaps there’s an associated shader I need to investigate? Perhaps some other adjustment is being done that I’m missing at present? Maybe there’s a new post-processing feature I need to disable somewhere?

Any advice or thoughts on where to look would be much appreciated!

3 posts - 2 participants