Skip to content

Understanding metallic texture packing for GLTF exporter from Unity #30

@justinctlam

Description

@justinctlam

I'm trying to get a good understanding of this but I'm not connecting the dots between the GLTF exporter texture packing, the documentation and Unity.

First, the Sketchfab docs say:

packing occlusion(R)/metalness(G)/roughness(B) for PBR metallicRoughness

Looking at the exporter code:

if (metallicRoughness)
{
	addTexturePixels(ref metallicRoughness, ref outputColors, IMAGETYPE.B);
	addTexturePixels(ref metallicRoughness, ref outputColors, IMAGETYPE.G_INVERT, IMAGETYPE.A);
}

I can conclude that the exporter takes channel R from Unity and puts it in B which is roughness.
It also takes channel A and puts it in G but inverted which is metalness.

Looking at Unity Standard Shader, it says metallic is in channel R and smoothness (inverted roughness) is in A channel.

So that means B = metallic and G = roughness which reverse of the documentation. So should the Sketchfab documentation really be saying occlusion(R)/metalness(B)/roughness(G)?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions