bevyengine / bevyengine/bevy

Support KHR_texture_transform per texture

Open
#15,310 0 comments 0 reactions 0 assignees View on GitHub
A-glTF A-Rendering C-Feature S-Blocked
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

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

In gltf files, KHR_texture_transform can be set per texture to offset/scale it but bevy currently uses the base color texture's transform and applies to every texture on the model.

Although bevy prints a warnings if the base color texture transform doesn't match other textures, the gltf crate doesn't support reading this value for normal maps or occlusion textures (and may not be until v2 https://github.com/gltf-rs/gltf/pull/412) and will silently render incorrectly if different transforms are used per texture.

* This issue is blocked on [gltf](https://github.com/gltf-rs/gltf) adding support for reading KHR_texture_transform for all textures.

## What solution would you like?

KHR_texture_transform to be supported per texture

## What alternative(s) have you considered?

I ran into this issue because my occlusion texture was rendering incorrectly, even though it was using a completely separate UV map, because it was using the KHR_texture_transform value from the base color texture. Perhaps the texture transform should only apply to textures with matching UVs otherwise it's almost guaranteed to be wrong but I'm not sure that's as much of an improvement.

I ended up working around my issue but just "baking" KHR_texture_transform into my UV map instead.

## Additional context

I made this issue mostly to document the fact that KHR_texture_transform is not fully supported as I didn't realize this fact until I looked at the [source](https://github.com/bevyengine/bevy/blob/main/crates/bevy_gltf/src/loader.rs).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.