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

Scene from glb file did not rendered when compiled to WASM in bevy 0.11 #9137

Closed
volodalexey opened this issue Jul 12, 2023 · 5 comments
Closed
Labels
A-Rendering Drawing game state to the screen A-Scenes Serialized ECS data stored on the disk C-Bug An unexpected or incorrect behavior
Milestone

Comments

@volodalexey
Copy link

Bevy version

0.11

What you did

Once I updated my simple game to bevy 0.11 I do not see scenes/meshes/models from gltf/glb file in WASM. I still hear the sound and see 2d menu.

Everything works in 0.11 when compiled natively on my Linux Mint 21.1 Cinnamon.

Additional information

Everything worked in WASM in bevy 0.10. I haven't changed anything except essential migration updates.

DEMO link compiled to WASM with bevy 0.11 - this bug is reproduceable on all my devices in browsers.

The same game in bevy 0.10 can be compiled from this commit.

WebInspector shows that scene file is loaded as before. The only one new message I see is following:

WARN /home/lex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_pbr-0.11.0/src/ssao/mod.rs:98 ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.

Scene file created in Blender is also pretty simple.

I assume that new SSAO is enabled some-how, however it should not, because I am using only default plugins or maybe the problem lies somewhere else...

@volodalexey volodalexey added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 12, 2023
@volodalexey
Copy link
Author

Investigated some more.
In Blender my ball looks like this:
2023-07-14_21-37

Current approach using gltf scene does not work in WASM:

SceneBundle {
  scene: model_assets.player.clone_weak(),
  ..default()
},

Instead of using gltf scene with this ball I tried to use only mesh and material from gltf:

let gltf = assets_gltf.get(&my.0).unwrap();
let ball_meshes = assets_gltfmesh
        .get(&gltf.named_meshes["Icosphere.002"])
        .unwrap();

PbrBundle {
  mesh: ball_meshes.primitives[0].mesh.clone(),
  material: model_assets.player_material.clone(),
  ..Default::default()
}

When run natively I still see my ball:
2023-07-14_21-48

When compile to WASM I can see finally the ball (at least), however material is broken:
2023-07-14_21-48_1

@Selene-Amanita Selene-Amanita added A-Rendering Drawing game state to the screen A-Scenes Serialized ECS data stored on the disk and removed S-Needs-Triage This issue needs to be labelled labels Jul 15, 2023
@Selene-Amanita Selene-Amanita added this to the 0.11.1 milestone Jul 15, 2023
@nicopap
Copy link
Contributor

nicopap commented Jul 31, 2023

Looks like #9098. Have you tried enabling ktx2, tonemapping_luts, and zstd features?

@volodalexey
Copy link
Author

Tested with bevy = { version = "0.11.0", features = ["tonemapping_luts", "tonemapping_luts", "zstd"]} - I still see the empty scene when using the whole glb.
When using only mesh and material from gltf - I see red ball as mentioned.

@mockersf
Copy link
Member

mockersf commented Aug 2, 2023

the run_if here: https://github.com/volodalexey/simple-bevy-wasm-ball-game/blob/main/src/game/models/mod.rs#L23 doesn't work like you think. it runs the system only on the frame the resource is added, which is not the same as the frame the gltf model is finished loading. if you remove the run_if condition, it should work.

volodalexey added a commit to volodalexey/simple-bevy-wasm-ball-game that referenced this issue Aug 3, 2023
@volodalexey
Copy link
Author

Thanks! I was pretty sure that this is due to migration to 0.11. I also didn't catch this while running natively, brobably because of instant file load.

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 A-Scenes Serialized ECS data stored on the disk C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

4 participants