[Feature] glTF: Support per-texture transforms in KHR_texture_transform
donmccurdy opened this issue · comments
Currently the glTF KHR_texture_transform
extension is only partially implemented by loaders.gl:
Unless I've misread, the implementation assumes that UV vertex attribute has at most one UV transform applied to it. But the KHR_texture_transform
extension is more flexible, and allows per-texture transforms. For example, a particular material may have 4 textures, all sharing TEXCOORD_0, but all transforming those UVs differently. The current implementation overwrites the (shared) UVs and cannot support this.
Ideally the texture transforms are passed to the material shader as uniforms, rather than overwriting the vertex attributes directly.
The following examples may be helpful in testing more complete support for the extension:
Models in zip are sourced from:
For reference, the full implementation can get verbose, especially with support for the various KHR_materials_*
extensions and their textures. three.js handles this by compiling shader variants:
https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js
We may be able to detect reuse of buffers and clone them.
Loaders.gl offers a way to handle certain extensions on the CPU during loading.
Of course if we implement in luma.gl we don't need to rely on that and we can share buffers as intended.