Open roym899 opened 7 months ago
I think the red color has to do with the texture for this mesh being single channel.
To extend on that, the issue is concrete that we're using TextureFormat::R8Unorm
as a format here which as the name implies is a red channel texture.
To make matters worse, we actually also should probably take the OETF (gamma curve ;)) into account: Gltf specifies that any information in the texture data should be ignored and we should always assume the data is OETF encoded https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#metallic-roughness-material It specifically talks about RGB values though, so it's a good bet this applies. The tricky bit of all this is that we quickly approach the the complexity of our tensor decoding and I believe we don't want to be that well-supporting on the mesh for the time being until we're in a situation where we can easily convert "tensors to textures" on the gpu as a separate, but still on-the-fly step. I.e. in the limit we'll need the ability to map all of our tensor decoding to a texture that also includes mipmapping, allowing us to have a very classic render pipeline from that step on and separating these concerns!).
That said, it shouldn't be too bad if for this unfortunate case of single-channel textures we just do the texture sampling in gamma space and convert it afterwards.
Not sure if it's covered by the above, but it's also been noted that compressed meshes don't work.
If you try it yourself, take any GLB file, compress it on https://optimizeglb.com/ and try to load it again in Rerun it will fails, but work fine on any web glb viewer
created a separate issue for that here since it's orthogonal to the texture problems described in the ticket here https://github.com/rerun-io/rerun/issues/6365
Very related to:
Describe the bug When opening these meshes, the obj file has no texture and the glb / gltf files either show up red or give an error. In Open3D all meshes show up red. So maybe something with the meshes is off? However, they work fine in f3d / Blender / MeshLab (all meshes were exported from a DAE / COLLADA file via Blender; there were similar issues when using trimesh to do the conversion; source mesh is also included in the zip):
The error for gltf + bin + texture is
To Reproduce Drag & drop the attached files into the Rerun Viewer.
Expected behavior Ideally, show the textured mesh in all cases. If there's an issue with the mesh leading to missing texture and red material (?) it would be nice to get some information about the problem.
Screenshots No texture (obj in Rerun)![image](https://github.com/rerun-io/rerun/assets/9785832/e488efe7-8692-448f-be2a-2a65fc942c7a)
Red (glb in Rerun)![image](https://github.com/rerun-io/rerun/assets/9785832/d6ec58b3-eec5-4ce7-a3e9-782fd3d1b730)
"Correct" (obj in MeshLab)![image](https://github.com/rerun-io/rerun/assets/9785832/db97fd7a-32da-4423-b112-1e1c45bc1886)
Desktop (please complete the following information):
Rerun version