bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.8k stars 3.54k forks source link

When loading skinned primitive from gltf the programm crashes #11091

Open rewin123 opened 9 months ago

rewin123 commented 9 months ago

Bevy version

0.12.1

[Optional] Relevant system information

2023-12-26T11:16:49.945923Z  INFO bevy_winit::system: Creating new window "App" (0v0)
2023-12-26T11:16:50.591403Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA TITAN Xp", vendor: 4318, device: 6914, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "537.58", backend: Vulkan }
2023-12-26T11:16:51.724808Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 10 Pro", kernel: "19045", cpu: "AMD Ryzen 7 2700X Eight-Core Processor", core_count: "8", memory: "63.9 GiB" }
2023-12-26T11:16:54.858069Z  INFO bevy_window::system: No windows are open, exiting
2023-12-26T11:16:54.859490Z  INFO bevy_winit::system: Closing window 0v0

What you did

Program crashing when i trying to load primitive with joints and weights attributes.

Im trying to load the PUG gltf file from Kenney's (Can be downloaded from https://drive.google.com/drive/folders/1UNNT0MeVX0O04RGgu8aLkKe3fwB9_t-A )

I want to load Mesh0/Primitive0 with Material0. But on load program crash. If i remove joints and weight from primitive, then program works.

fn setup(
    mut commands: Commands,
    mut asset_server : Res<AssetServer>,) {
    commands.spawn(Camera3dBundle::default());

    let mesh_handle = asset_server.load("Pug.gltf#Mesh0/Primitive0");
    let material_handle = asset_server.load("Pug.gltf#Material0");

    commands.spawn((
        PbrBundle {
            mesh: mesh_handle,
            material: material_handle,
            ..default()
        }
    ));
}

What went wrong

2023-12-26T11:21:06.501637Z  INFO bevy_winit::system: Creating new window "App" (0v0)
2023-12-26T11:21:07.099166Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA TITAN Xp", vendor: 4318, device: 6914, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "537.58", backend: Vulkan }
2023-12-26T11:21:08.271808Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 10 Pro", kernel: "19045", cpu: "AMD Ryzen 7 2700X Eight-Core Processor", core_count: "8", memory: "63.9 GiB" }
2023-12-26T11:21:09.345420Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default    
thread '<unnamed>' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 1, Vulkan)>`
    In a draw command, indexed:true indirect:false
      note: render pipeline = `pbr_opaque_mesh_pipeline`
    The pipeline layout, associated with the current render pipeline, contains a bind group layout at index 2 which is incompatible with the bind group layout associated with the bind group at 
2

', C:\Users\rewin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.17.1\src\backend\direct.rs:3056:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in exclusive system `bevy_render::renderer::render_system`!
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', C:\Users\rewin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.12.1\src\pipelined_rendering.rs:145:45
error: process didn't exit successfully: `target\debug\examples\minamal_gltf_test.exe` (exit code: 101)

Additional information

I tried another random files from Kenney's models. All failed.

Primitive from gltf file

 "meshes" : [
        {
            "name" : "Cube.004",
            "primitives" : [
                {
                    "attributes" : {
                        "POSITION" : 0,
                        "NORMAL" : 1,
                        "COLOR_0" : 2,
                        "JOINTS_0" : 3, <-- if i remove this line, program will not crash
                        "WEIGHTS_0" : 4 <-- if i remove this line, program will not crash
                    },
                    "indices" : 5,
                    "material" : 0
                },
dmlary commented 9 months ago

This looks like a dup of #10810

rewin123 commented 9 months ago

Ye, it's very similar. Just different in materials (one from gltf, one was generated)