Debugging glTF 2.0 Metallic-Roughness Packing and Alpha-Blend Sorting Defects
How glTF Packs Occlusion, Roughness, and Metallic Into Linear RGB Channels
The core Khronos glTF 2.0 material model uses physically based metallic-roughness shading with strict channel assignments: baseColorTexture is sampled in sRGB transfer space (multiplied by RGBA baseColorFactor), whereas metallicRoughnessTexture stores linear perceptual roughness in the Green channel and metalness in the Blue channel—often sharing the Red channel with ambient occlusion (ORM packing). Connecting a standalone grayscale roughness PNG without proper channel packing or leaving metallicFactor at its default 1.0 turns dielectric plastic and wood surfaces into dark chrome mirrors.
Equally critical is alphaMode selection. Exporting opaque foliage or decals as BLEND instead of MASK (with an explicit alphaCutoff) disables depth-buffer writes in WebGL2 forward renderers, causing severe back-to-front sorting flicker. This inspector tabulates every scalar factor, alpha mode, doubleSided state, and missing dependency while isolating roughness response in the 3D stage.
- Defaults the WebGL2 viewport to Roughness Channel mode so scalar roughness luminance is immediately visible.
- Lists baseColorFactor, metallicFactor, roughnessFactor, alphaMode, and doubleSided per material.
- Cross-references broken image URIs directly onto the affected PBR material definition.
Auditing AuditPbrMaterial on scale-texture.glb
In scale-texture.glb, AuditPbrMaterial sets metallicFactor = 0.1 and roughnessFactor = 0.8, resolves baseColorTexture from bufferView 4, and flags metallicRoughnessTexture -> rough.png as an unresolved external dependency.