bevyengine / bevyengine/bevy

Panic on Binding Issue: Occlusion Map in Greyscale 16-bit

Open
#11,201 0 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.12.1
Also tested on commit hash: 41c362051cbfc57ecbaca57b8546a5695717b727

## \[Optional\] Relevant system information

Tested on:
MacBook Pro, 2023, Apple M2 Max
macOS Ventura 13.5.2
AdapterInfo { name: "Apple M2 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }

Also tested on:
Dell Precision 7670
Windows 11 Enterprise (10.0.22621 Build 22621)

## What you did

I tested using the following asset:
[SciFiHelmet](https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/SciFiHelmet/glTF)

I converted the ambient occlusion map to greyscale 16-bit, as here:
![SciFiHelmet_AmbientOcclusion](https://github.com/bevyengine/bevy/assets/2727461/6862bdda-1ba8-4ef6-a1e7-89324dba843a)

I test-loaded the modified asset using a quick modification to the load_gltf example. The relevant code is:
```
commands.spawn(SceneBundle {
scene: asset_server.load("models/SciFiHelmet/SciFiHelmet.gltf#Scene0"),
..default()
});
```

## What went wrong

The application panics on a WGPU error related to the binding of the AO texture:

```
2024-01-03T18:37:36.173278Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default
thread 'Compute Task Pool (3)' panicked at /Users/jasonbond/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/backend/direct.rs:3111:5:
wgpu error: Validation Error

Caused by:
In Device::create_bind_group
note: label = `StandardMaterial`
Texture binding 7 expects sample type = Float { filterable: true }, but given a view with format = R16Uint

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_pbr::material::prepare_materials`!
thread 'Compute Task Pool (3)' panicked at crates/bevy_render/src/pipelined_rendering.rs:145:45:
called `Result::unwrap()` on an `Err` value: RecvError
thread 'main' panicked at /Users/jasonbond/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.8/src/platform_impl/macos/app_state.rs:387:33:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }
```

## Additional information

- Using colour 16-bit or greyscale 8-bit seemed to work fine.
- The repro case above may seem like a weird thing to do, but it's motivated by a collection of protected-IP assets which I'm actually trying to use and which have this format of occlusion texture.

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.