-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec fails to describe occlusion packed into metallicRoughness texture #1982
Comments
Occlusion is always sampled from the red channel while metall-roughness uses green and blue. Separate storage example: "images": [
{
"uri": "occlusion.png"
},
{
"uri": "m-r.png",
}
],
"textures": [
{
"source": 0
},
{
"source": 1
}
],
"materials": [
{
"occlusionTexture": {
"index": 0
},
"pbrMetallicRoughness": {
"metallicRoughnessTexture": {
"index": 1
}
}
}
] Combined storage example: "images": [
{
"uri": "o-r-m.png"
}
],
"textures": [
{
"source": 0
}
],
"materials": [
{
"occlusionTexture": {
"index": 0
},
"pbrMetallicRoughness": {
"metallicRoughnessTexture": {
"index": 0
}
}
}
]
It is not an error. The red channel of the metallic-roughness texture would be ignored by design if |
A few additional comments — the specification has no requirements about what can or cannot be packed into a single texture, other than colorspace requirements: e.g. For another example... {
"name": "MyMaterial",
"pbrMetallicRoughness": {
"baseColorTexture": {
"index": 10,
"texCoord": 0
},
"metallicRoughnessTexture": {
"index": 11,
"texCoord": 1
}
},
"emissiveTexture": {
"index": 10,
"texCoord": 2
},
"occlusionTexture": {
"index": 11,
"texCoord": 1
}
} ... note that
Having each property use a separate texture would also be valid. Certain extensions (e.g. KHR_materials_clearcoat) define new material properties, which can similarly be packed into shared textures. The packing flexibility is helpful when optimizing a model to meet sampler and GPU memory requirements. |
Brilliant, thank you both. That's very helpful. I suspect it is safe and reasonable to conclude then, that where no explicit occlusion texture index is defined, that there should be no expectation (implicit or otherwise) of it being packed into the metallicRoughnessTexture? Eg:
|
Correct, yes — even if there happens to be data in the R channel of the |
One more question if I may....
That means the red channel of the base-colour is performing double-duty as occlusion... perhaps that just stylistic intent? |
Hm, that wouldn't be correct, since the occlusion texture is supposed to be linear... There have been some other issues with this particular model (see KhronosGroup/glTF-Sample-Assets#71 and KhronosGroup/COLLADA2GLTF#146) probably related to tricky conversion from an older format, I would consider that a bug in the model. |
Oops, just saw you already commented in that thread back in 2020 as well! 😅 |
Thanks Don. I suspected that might be the case. Good to know. |
I'm a little confused at the minute, this page very clearly describes the idea of an occlusion texture being packed into the metallic-roughness texture.
The spec seems to make no mention of this, but does define a seperate occlusion texture.
I see issue #857 saw fit to make changes to accomodate packing occlusion into the metallic-roughness texture.
Is it simply that this remains undocumented?
There is a comment here that mentions this is documented in the schema... The link to the schema in that comment is broken, and the only schema documentation I can find (here) continues to make no mention.
I guess I want to know:
The text was updated successfully, but these errors were encountered: