Emissive and base colors are incorrectly converted
- Dominant language
- JavaScript
- Stars
- 1.9k
- Forks
- 311
- PR merge metrics
- No merged PRs in 30d
Description
GLTF specifies that all colors in gltf json should be represented in linear space.
OBJ files have their colors defined in sRGB space.
`obj2gltf` now takes colors directly from OBJ and puts them in GLTF, but there should be conversion from sRGB to linear rgb colorspace.
Note that colors in textures are sRGB both in obj and gltf, only base color (diffuse) and emissive colors should be converted.
See this linked issue in Blender: https://projects.blender.org/blender/blender-addons/issues/102905#issuecomment-11438
and the corresponding discussion in gltf spec repository: https://github.com/KhronosGroup/glTF/issues/1609#issuecomment-491097601
The corresponding locations in code where the change should be made:
https://github.com/CesiumGS/obj2gltf/blob/ce0c36e28193205f6465a22c03f554fe22597f46/lib/loadMtl.js#L139-L144
https://github.com/CesiumGS/obj2gltf/blob/ce0c36e28193205f6465a22c03f554fe22597f46/lib/loadMtl.js#L131-L136
EDIT:
Let me also link Bevy engine PR that also fixed this: https://github.com/bevyengine/bevy/pull/6828
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.