Skip to content

Using both Bloom and Motion Blur breaks camera ordering. #22376

@HugoPeters1024

Description

@HugoPeters1024

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:

    // 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:

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorS-Needs-InvestigationThis issue requires detective work to figure out what's going wrong

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions