godot
godot copied to clipboard
Blender/GLTF vertex coloring is changed on import.
Tested versions
reproducible in v4.3.dev6.mono.official [89850d553]
System information
Godot v4.3.dev6.mono - Windows 10.0.19044 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 31.0.15.5161) - AMD Ryzen 9 5950X 16-Core Processor (32 Threads)
Issue description
issue possible related to https://github.com/godotengine/godot/issues/87486.
when exporting a mesh from blender 4.0 to using gltf, the vertex colors are not imported correctly and appear different in godot. attach is a screenshot of the vertex colors in blender and the imported result in godot. the data has been changed as you see jagged edges / harder transitions in the colors as well as slighter darker colors. (is vertex color being compressed?). if you export from blender to gltf and then reimport, you will see there is no change in the colors. (blend file attached)
Steps to reproduce
-create a mesh in blender 4.0 with a range of vertex colors (colors near black seem to be problematic the most) -export the mesh using the gltf exporter in blender -import the glb file in godot and apply an unshaded material which displays the vertex color to albedo
Minimal reproduction project (MRP)
Is this potentially related to what this asset is trying to fix? https://godotengine.org/asset-library/asset/2905 changed behaviour in Blender 4.1.
Is this potentially related to what this asset is trying to fix? https://godotengine.org/asset-library/asset/2905 changed behaviour in Blender 4.1.
No, thats an issue with the gltf exporter not exporting vertex color at all in 4.1 (which was fixed in 4.2 here btw https://github.com/KhronosGroup/glTF-Blender-IO/pull/2233). oops sorry this actually applies to blender 4.0 i meant. I will update the description.
I was about to open a new issue with a problem importing a GLB model with color attributes. I have almost zero experience with Blender but I think vertex coloring is the same as using color attributes in Blender (with domain set to Vertex).
Since this is a voxel based model with a clearly defined texture (the eyes in the face and other details) it is easy to see that the colors are incorrectly applied. But if you open the advanced importer dialog in Godot then it looks fine so Godot is reading the format without issues.
assets.zip
I attach the assets in case they make easy to debug this or to see if I am dong something wrong on my end.
This may be caused by mesh LOD generation, which can have trouble with vertex colors if they're designed to have hard edges (by having vertices be very close to each other). Try disabling Meshes > Generate LODs in the import options.
@Calinou That worked for my case, thanks!! so then my issue was a different one than the described in the first post.
I just wanted to show this comparison which shows that there is way more saturated red in the imported colors in godot as seen here. This is was just done in godot 4.3 where the issue remains.
just a thought but, is it possible the vertex colors are being compressed somehow by godot on import?
just a thought but, is it possible the vertex colors are being compressed somehow by godot on import?
You can force disabling mesh compression in the Import options (Force Disable Compression).
just a thought but, is it possible the vertex colors are being compressed somehow by godot on import?
You can force disabling mesh compression in the Import options (Force Disable Compression).
oh? I thought that mesh compression only compressed the vertex positions. it does colors and uvs as well?
oh? I thought that mesh compression only compressed the vertex positions. it does colors and uvs as well?
According to its description, it compresses normals and UVs at least.
this is resolved. the problem was that I was passing COLOR.rgb into a varying in vertex then using that in fragment (causing it to change for some reason). when using COLOR.rgb directly in fragment that issue is gone.