Skip to content

Support the KHR_texture_transform GLTF extension #11869

@janhohenheim

Description

@janhohenheim

What problem does this solve or what need does it fill?

In Blender, the default way of making sure a texture tiles n times is to add a UV Map and a Mapping node, like this;
image
The above example tiles the texture exactly 5 times.

This transforms the UV. The Blender GLTF exporter supports this by writing it to the KHR_texture_transform extension. So, setting the nodes up as follows, we get a nicely tiled GLTF:
image
I have a simple greyboxing grid texture applied to a cube in this case. Viewing it through a GLTF viewer, I get this:
image
As you can see, the text in the grid is repeated 5 times per face. Opening this up in Bevy however... (ignore the poor lighting)
image
Oh no! Bevy does not support GLTF extensions yet, so it just stretches the texture instead of tiling it!

What solution would you like?

Ideally, Bevy should apply the transforms to the UV automatically when encountering this extension. As the Khronos group link specifies, most implementations ignore the rotation value, so I think it's fine if we do too. Most important are the offset for texture atlases and scale for tiling.

What alternative(s) have you considered?

Leave it to the user. #11138 allows us to read the extension manually, so a user could write a custom shader or a shader extension for this.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-FeatureA new feature, making something new possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions