KhronosGroup / KhronosGroup/glTF
Allow separate metallic and roughness textures
- Dominant language
- HTML
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 17h 26m
- Merged PRs (30d)
- 5
Description
Currently Metalness and Roughness are always intended to stored as the Blue and Green channels of a single texture file. While this works for saving space as glTF only officially supports PNG and JPG, and KTX2 and WebP with extensions. All of which are primarily 3/4 channel formats.
While I think the current system works well for models made for glTF, it struggles with cross compatibility between models which often have these as separate textures.
If the textures are referenced from external files, most often they can be reused between different 3D model formats, however with glTF, the two need to be combined into one texture, which can be a lossy process if they are different resolutions (which I have come across, as metallic textures are often less detailed).
I believe it SHOULD be one singular metallicRoughnessTexture, any applications should convert to this format by default and it is recommended, however I believe you should be able to supply an extra texture to override one of the channels of that image for compatibility purposes and to possibly allow future support for single channel image formats. (PNG and KTX2 already does)
Currently, if a single channel image is given as a metallic-roughness texture, it acts as an RGB image where all channels are the same, described in #2298. Two channel images are considered as RGB and Alpha, which is basically the same since alpha is ignored. That makes these single channel formats not very useful.
If a single channel image is given to metallicRoughness and an image is given to a "roughnessOverride" texture for example (using the blue channel), it would make the same final result. This follows in how the occlusion texture uses the red channel only, so it can be combined into the metallicRoughness texture, or exist in a separate file.
I believe a better solution to making this work is possible, perhaps one incorporating better single/dual channel file support, it's just what I thought of on the spot while maintaining backwards compatibility.
In short, allowing separate metallic roughness textures allows for more compatibility with other formats, better support for single channel PNGs or any other single channel image formats, and allowing for these two textures to be different resolutions.
Contributor guide
Research direction
Start by reviewing the existing glTF metallicRoughnessTexture and occlusion texture behavior described in the issue, then read the related discussion in issue #2298. Clarify the backward-compatible behavior for separate metallic and roughness inputs, including single- and two-channel images, before defining what a complete solution would require.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100