Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glTF not being rendered correctly. UV texture issue? #6335

Closed
OriginLive opened this issue Oct 22, 2022 · 3 comments · Fixed by #11904
Closed

glTF not being rendered correctly. UV texture issue? #6335

OriginLive opened this issue Oct 22, 2022 · 3 comments · Fixed by #11904
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@OriginLive
Copy link

OriginLive commented Oct 22, 2022

Bevy version

bevy = "0.8.1"

What you did

Created an image of a plane in blender with 100x100 m size. Gave a texture for each 1x1meter.
image

image

Bevy has no clue UV isn't the whole plane.

    let grid_plane = asset_server.load("models\\planewgrid.gltf#Scene0");

    // plane
    commands
        .spawn_bundle(SceneBundle {
            scene: grid_plane,
            ..Default::default()
        })
        .insert(Collider::cuboid(100.0, 0.1, 100.0));

What went wrong

This is what breaks in bevy:

image

Additional information

Here's the files:
http://gofile.me/6dlZG/cQxW3Sc6H

@OriginLive OriginLive added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Oct 22, 2022
@mockersf
Copy link
Member

Could you try your gltf file in https://gltf-viewer.donmccurdy.com?

Textures done with nodes are often not exported by blender in the gltf format.

@OriginLive
Copy link
Author

Looks fine
image

@rparrett rparrett added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Oct 25, 2022
@vonforum
Copy link

Could be missing KHR_texture_transform support, which is how blender exports scaled textures in glTF, I think.

yrns added a commit to yrns/bevy that referenced this issue Mar 28, 2023
yrns added a commit to yrns/bevy that referenced this issue Mar 30, 2023
yrns added a commit to yrns/bevy that referenced this issue Mar 30, 2023
github-merge-queue bot pushed a commit that referenced this issue Feb 21, 2024
Adopted #8266, so copy-pasting the description from there:

# Objective

Support the KHR_texture_transform extension for the glTF loader.

- Fixes #6335
- Fixes #11869 
- Implements part of #11350
- Implements the GLTF part of #399 

## Solution

As is, this only supports a single transform. Looking at Godot's source,
they support one transform with an optional second one for detail, AO,
and emission. glTF specifies one per texture. The public domain
materials I looked at seem to share the same transform. So maybe having
just one is acceptable for now. I tried to include a warning if multiple
different transforms exist for the same material.

Note the gltf crate doesn't expose the texture transform for the normal
and occlusion textures, which it should, so I just ignored those for
now. (note by @janhohenheim: this is still the case)

Via `cargo run --release --example scene_viewer
~/src/clone/glTF-Sample-Models/2.0/TextureTransformTest/glTF/TextureTransformTest.gltf`:


![texture_transform](https://user-images.githubusercontent.com/283864/228938298-aa2ef524-555b-411d-9637-fd0dac226fb0.png)

## Changelog

Support for the
[KHR_texture_transform](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform)
extension added. Texture UVs that were scaled, rotated, or offset in a
GLTF are now properly handled.

---------

Co-authored-by: Al McElrath <[email protected]>
Co-authored-by: Kanabenki <[email protected]>
msvbg pushed a commit to msvbg/bevy that referenced this issue Feb 26, 2024
Adopted bevyengine#8266, so copy-pasting the description from there:

# Objective

Support the KHR_texture_transform extension for the glTF loader.

- Fixes bevyengine#6335
- Fixes bevyengine#11869 
- Implements part of bevyengine#11350
- Implements the GLTF part of bevyengine#399 

## Solution

As is, this only supports a single transform. Looking at Godot's source,
they support one transform with an optional second one for detail, AO,
and emission. glTF specifies one per texture. The public domain
materials I looked at seem to share the same transform. So maybe having
just one is acceptable for now. I tried to include a warning if multiple
different transforms exist for the same material.

Note the gltf crate doesn't expose the texture transform for the normal
and occlusion textures, which it should, so I just ignored those for
now. (note by @janhohenheim: this is still the case)

Via `cargo run --release --example scene_viewer
~/src/clone/glTF-Sample-Models/2.0/TextureTransformTest/glTF/TextureTransformTest.gltf`:


![texture_transform](https://user-images.githubusercontent.com/283864/228938298-aa2ef524-555b-411d-9637-fd0dac226fb0.png)

## Changelog

Support for the
[KHR_texture_transform](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform)
extension added. Texture UVs that were scaled, rotated, or offset in a
GLTF are now properly handled.

---------

Co-authored-by: Al McElrath <[email protected]>
Co-authored-by: Kanabenki <[email protected]>
msvbg pushed a commit to msvbg/bevy that referenced this issue Feb 26, 2024
Adopted bevyengine#8266, so copy-pasting the description from there:

# Objective

Support the KHR_texture_transform extension for the glTF loader.

- Fixes bevyengine#6335
- Fixes bevyengine#11869 
- Implements part of bevyengine#11350
- Implements the GLTF part of bevyengine#399 

## Solution

As is, this only supports a single transform. Looking at Godot's source,
they support one transform with an optional second one for detail, AO,
and emission. glTF specifies one per texture. The public domain
materials I looked at seem to share the same transform. So maybe having
just one is acceptable for now. I tried to include a warning if multiple
different transforms exist for the same material.

Note the gltf crate doesn't expose the texture transform for the normal
and occlusion textures, which it should, so I just ignored those for
now. (note by @janhohenheim: this is still the case)

Via `cargo run --release --example scene_viewer
~/src/clone/glTF-Sample-Models/2.0/TextureTransformTest/glTF/TextureTransformTest.gltf`:


![texture_transform](https://user-images.githubusercontent.com/283864/228938298-aa2ef524-555b-411d-9637-fd0dac226fb0.png)

## Changelog

Support for the
[KHR_texture_transform](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform)
extension added. Texture UVs that were scaled, rotated, or offset in a
GLTF are now properly handled.

---------

Co-authored-by: Al McElrath <[email protected]>
Co-authored-by: Kanabenki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
4 participants