Moguri/panda3d-gltf

Support extension KHR_texture_transform

Closed this issue · 2 comments

Texture information in a gltf file might include mapping information - this might be common with repeated maps, and might include information used to build cards for sprite atlases.

Sample partial gltf:

"materials" : [
    {
        "name" : "applesauce",
        "normalTexture" : {
            "extensions" : {
                "KHR_texture_transform" : {
                    "offset" : [
                        -9.99999999999999,
                        1.0000004371139
                    ],
                    "rotation" : 1.5707963705062866,
                    "scale" : [
                        10,
                        10
                    ]
                }
            },
            "index" : 0,
            "scale" : 0.15000000596046448,
            "texCoord" : 0
        },
        "pbrMetallicRoughness" : {
            "baseColorTexture" : {
                "index" : 1,
                "texCoord" : 0
            },
            "metallicFactor" : 0,
            "roughnessFactor" : 0.5
        }
    }
],

... I'm not sure where the offset value is coming from, here, since my setup in blender looks like this:
image

rdb commented

This is now supported, although note that gltf-viewer uses simplepbr which does not yet fully support this.

The reason for the funny offset in the glTF file is that glTF uses a different transformation origin for the texture coordinates than Blender (and Panda for that matter).

Thanks!