bevyengine / bevyengine/bevy

Using both Bloom and Motion Blur breaks camera ordering.

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

Description

## Description

I'm using `egui_dock` to make a simple editor for my game. The example I made for it works great with the following dual camera setup:

```rust
// Main camera for the game
commands.spawn((
Camera3d::default(),
EditorCamera,
Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
));

commands.spawn((
Camera2d,
Name::new("Egui Camera"),
PrimaryEguiContext,
RenderLayers::none(),
Pickable::IGNORE, // Make egui camera ignore picking events so they propagate to entities behind it
Camera {
// Render the UI on top.
order: 1,
clear_color: ClearColorConfig::None,
..default()
},
));
```

However, whenever I integrated it with my actual game, the game view was always entirely black unless I rendered the 3d camera on top of the UI. I eventually figured out that the important difference between the two setups is that the 3d camera in my actual game uses BOTH motion blur and bloom:

```rust
commands.spawn((
EditorCamera,
Camera3d::default(),
crate::camera::ThirdPersonCamera::default(),
crate::player::controller::ControllerCamera,
Transform::from_xyz(0.0, 3.0, 5.0).looking_at(Vec3::new(0.0, 1.0, 0.0), Vec3::Y),
// Removing EITHER of these 2 components makes game view visible again
Bloom::NATURAL,
MotionBlur {
shutter_angle: 1.25,
samples: 2,
},
));
```

I will attempt to create a minimal reproducer for easier debugging.

## Screenshots

### With Motion Blur and Bloom enabled on the 3d camera

Image

### With either or neither Motion Blur and Bloom on the 3d camera:

Image

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.