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

Textures don't render correctly on Bistro #9946

Closed
Elabajaba opened this issue Sep 28, 2023 · 4 comments · Fixed by #9982
Closed

Textures don't render correctly on Bistro #9946

Elabajaba opened this issue Sep 28, 2023 · 4 comments · Fixed by #9982
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-High This is particularly urgent, and deserves immediate attention
Milestone

Comments

@Elabajaba
Copy link
Contributor

Bevy version

b6ead2b

This appears to have started when assets v2 was merged.

Relevant system information

AdapterInfo { name: "AMD Radeon RX 6800 XT", vendor: 4098, device: 29631, device_type: DiscreteGpu, driver: "", driver_info: "", backend: Dx12 }

Also happens on linux vulkan on the same system.

What you did

Convert bistro (https://developer.nvidia.com/orca/amazon-lumberyard-bistro) to a gltf using blender, then view it with the scene viewer.

What went wrong

The textures aren't tiling correctly.

Additional information

The current incorrect texture rendering:

Screenshot 2023-09-27 233257

@Elabajaba Elabajaba added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Sep 28, 2023
@JMS55 JMS55 added A-Rendering Drawing game state to the screen P-High This is particularly urgent, and deserves immediate attention and removed S-Needs-Triage This issue needs to be labelled labels Sep 28, 2023
@JMS55 JMS55 added this to the 0.12 milestone Sep 28, 2023
@Kanabenki
Copy link
Contributor

What export settings did you use when exporting to gltf ? I tried reproducing by exporting as glb from the fbx with the default settings in blender. When loading the scene with the scene viewer from the bevy examples on 20ed3e0, the textures are properly tiling but I'm getting some extreme flickering from most of the meshes.

@Elabajaba
Copy link
Contributor Author

Blender 3.6.4 is outputting broken gltfs that flicker (at least for bistro, tested in bevy and unreal 5.2). Blender 3.5.1 gltf exports work, but in bevy post assets v2 have broken texture rendering (at least for bistro).

@DGriffin91
Copy link
Contributor

Same issue on sponza. This is using the same gltf file that I usually use for testing sponza that works correctly on 0.11
image

@superdump
Copy link
Contributor

Looks like embedded textures have their sampler descriptor set but loading via uri doesn’t:

image.sampler_descriptor = ImageSampler::Descriptor(texture_sampler(&gltf_texture));

address_mode_u: texture_address_mode(&gltf_sampler.wrap_s()),
that texture_sampler() function is where the address mode is set

So the two cases which handle uris need to use that function

To make the sampler descriptor

github-merge-queue bot pushed a commit that referenced this issue Oct 25, 2023
Closes #9946 

# Objective

Add a new type mirroring `wgpu::SamplerDescriptor` for
`ImageLoaderSettings` to control how a loaded image should be sampled.

Fix issues with texture sampler descriptors not being set when loading
gltf texture from URI.

## Solution

Add a new `ImageSamplerDescriptor` and its affiliated types that mirrors
`wgpu::SamplerDescriptor`, use it in the image loader settings.

---

## Changelog

### Added

- Added new types `ImageSamplerDescriptor`, `ImageAddressMode`,
`ImageFilterMode`, `ImageCompareFunction` and `ImageSamplerBorderColor`
that mirrors the corresponding wgpu types.
- `ImageLoaderSettings` now carries an `ImageSamplerDescriptor` field
that will be used to determine how the loaded image is sampled, and will
be serialized as part of the image assets `.meta` files.

### Changed

- `Image::from_buffer` now takes the sampler descriptor to use as an
additional parameter.

### Fixed

- Sampler descriptors are set for gltf textures loaded from URI.
ameknite pushed a commit to ameknite/bevy that referenced this issue Nov 6, 2023
)

Closes bevyengine#9946 

# Objective

Add a new type mirroring `wgpu::SamplerDescriptor` for
`ImageLoaderSettings` to control how a loaded image should be sampled.

Fix issues with texture sampler descriptors not being set when loading
gltf texture from URI.

## Solution

Add a new `ImageSamplerDescriptor` and its affiliated types that mirrors
`wgpu::SamplerDescriptor`, use it in the image loader settings.

---

## Changelog

### Added

- Added new types `ImageSamplerDescriptor`, `ImageAddressMode`,
`ImageFilterMode`, `ImageCompareFunction` and `ImageSamplerBorderColor`
that mirrors the corresponding wgpu types.
- `ImageLoaderSettings` now carries an `ImageSamplerDescriptor` field
that will be used to determine how the loaded image is sampled, and will
be serialized as part of the image assets `.meta` files.

### Changed

- `Image::from_buffer` now takes the sampler descriptor to use as an
additional parameter.

### Fixed

- Sampler descriptors are set for gltf textures loaded from URI.
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
)

Closes bevyengine#9946 

# Objective

Add a new type mirroring `wgpu::SamplerDescriptor` for
`ImageLoaderSettings` to control how a loaded image should be sampled.

Fix issues with texture sampler descriptors not being set when loading
gltf texture from URI.

## Solution

Add a new `ImageSamplerDescriptor` and its affiliated types that mirrors
`wgpu::SamplerDescriptor`, use it in the image loader settings.

---

## Changelog

### Added

- Added new types `ImageSamplerDescriptor`, `ImageAddressMode`,
`ImageFilterMode`, `ImageCompareFunction` and `ImageSamplerBorderColor`
that mirrors the corresponding wgpu types.
- `ImageLoaderSettings` now carries an `ImageSamplerDescriptor` field
that will be used to determine how the loaded image is sampled, and will
be serialized as part of the image assets `.meta` files.

### Changed

- `Image::from_buffer` now takes the sampler descriptor to use as an
additional parameter.

### Fixed

- Sampler descriptors are set for gltf textures loaded from URI.
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 P-High This is particularly urgent, and deserves immediate attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants