You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used lightmaps with the directional lights where shadows_enabled is set to true, here's an example:
//! Rendering a scene with baked lightmaps.use bevy::pbr::Lightmap;use bevy::prelude::*;fnmain(){App::new().add_plugins(DefaultPlugins).insert_resource(AmbientLight::NONE).add_systems(Startup, setup).add_systems(Update, add_lightmaps_to_meshes).run();}fnsetup(mutcommands:Commands,asset_server:Res<AssetServer>){
commands.spawn(SceneBundle{scene: asset_server.load("models/CornellBox/CornellBox.glb#Scene0"),
..default()});
commands.spawn(Camera3dBundle{transform:Transform::from_xyz(-278.0,273.0,800.0),
..default()});
commands.spawn(DirectionalLightBundle{directional_light:DirectionalLight{shadows_enabled:true,// This must be enabled for it to panic!
..default()},
..default()});}fnadd_lightmaps_to_meshes(mutcommands:Commands,asset_server:Res<AssetServer>,mutmaterials:ResMut<Assets<StandardMaterial>>,meshes:Query<(Entity,&Name,&Handle<StandardMaterial>),(With<Handle<Mesh>>,Without<Lightmap>),>,){let exposure = 250.0;for(entity, name, material)in meshes.iter(){if&**name == "Light"{
materials.get_mut(material).unwrap().emissive = Color::WHITE* exposure;continue;}if&**name == "large_box"{
materials.get_mut(material).unwrap().lightmap_exposure = exposure;
commands.entity(entity).insert(Lightmap{image: asset_server.load("lightmaps/CornellBox-Large.zstd.ktx2"),
..default()});continue;}if&**name == "small_box"{
materials.get_mut(material).unwrap().lightmap_exposure = exposure;
commands.entity(entity).insert(Lightmap{image: asset_server.load("lightmaps/CornellBox-Small.zstd.ktx2"),
..default()});continue;}if name.starts_with("cornell_box"){
materials.get_mut(material).unwrap().lightmap_exposure = exposure;
commands.entity(entity).insert(Lightmap{image: asset_server.load("lightmaps/CornellBox-Box.zstd.ktx2"),
..default()});continue;}}}
What went wrong
I got this panic:
2024-02-16T13:06:01.153062Z ERROR log: Handling wgpu errors as fatal by default
thread '<unnamed>' panicked at /home/doonv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.1/src/backend/wgpu_core.rs:3009:5:
wgpu error: Validation Error
Caused by:
In a RenderPass
note: encoder = `shadow_pass_command_encoder`
In a draw command, indexed:true indirect:false
note: render pipeline = `pbr_prepass_pipeline`
Incompatible bind group at index 1 in the current render pipeline
note: Should be compatible an with an explicit bind group layout with label = `mesh_layout`
note: Assigned explicit bind group layout with label = `lightmapped_mesh_layout`
note: Entry 4 not found in expected bind group layout
note: Entry 5 not found in expected bind group layout
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in exclusive system `bevy_render::renderer::render_system`!
thread 'Compute Task Pool (6)' panicked at crates/bevy_render/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError
pass.
I did this during the prepass, but I neglected to do it during the
shadow map pass, causing a panic when directional lights with shadows
were enabled with lightmapped meshes present. This patch fixes the
issue.
Closesbevyengine#11898.
…p pass. (#11910)
I did this during the prepass, but I neglected to do it during the
shadow map pass, causing a panic when directional lights with shadows
were enabled with lightmapped meshes present. This patch fixes the
issue.
Closes#11898.
…p pass. (#11910)
I did this during the prepass, but I neglected to do it during the
shadow map pass, causing a panic when directional lights with shadows
were enabled with lightmapped meshes present. This patch fixes the
issue.
Closes#11898.
Bevy version
main (fe777d5)
What you did
I used lightmaps with the directional lights where
shadows_enabled
is set totrue
, here's an example:What went wrong
I got this panic:
Additional information
The lightmaps PR: #10231
This issue has been present since lightmaps were introduced.
The text was updated successfully, but these errors were encountered: