Skip to content

Commit

Permalink
fix light in render_to_image_widget example (#282)
Browse files Browse the repository at this point in the history
Issue bevyengine/bevy#3462 has been fixed. So since Bevy 0.13, render lights can be specified per RenderLayer.

I've decided to reuse the same light by specifying `RenderLayers::all()`, although adding a separate one (with preview_pass_layer and without) is also fine.
  • Loading branch information
rlidwka authored Jun 2, 2024
1 parent 4a4ba67 commit 6d0c298
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions examples/render_to_image_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ fn setup(
.insert(PreviewPassCube)
.insert(preview_pass_layer);

// Light
// NOTE: Currently lights are shared between passes - see https://github.com/bevyengine/bevy/issues/3462
commands.spawn(PointLightBundle {
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 10.0)),
..default()
});
// The same light is reused for both passes,
// you can specify different lights for preview and main pass by setting appropriate RenderLayers.
commands
.spawn(PointLightBundle {
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 10.0)),
..default()
})
.insert(RenderLayers::all());

commands
.spawn(Camera3dBundle {
Expand Down

0 comments on commit 6d0c298

Please sign in to comment.