Skip to content

Depth Buffer... blank? with Atmosphere #23144

@ChristopherBiscardi

Description

@ChristopherBiscardi

Bevy version and features

cargo tree -i bevy in my project reports: 1fdf426

bevy v0.19.0-dev (https://github.com/bevyengine/bevy?branch=main#1fdf4267)

I have a number of dev features enabled. most specifically bevy_dev_tools for the render debug overlay.

Relevant system information

same as #23143 (same project, different example)

What you did

I have this stack of components to "enable atmosphere". Either inserting or not-inserting this set of components results in the change in behavior.

(
        Atmosphere::earthlike(
            scattering_mediums
                .add(ScatteringMedium::default()),
        ),
        // Can be adjusted to change the scene scale and
        // rendering quality
        AtmosphereSettings::default(),
        // The directional light illuminance used in this
        // scene (the one recommended for use with
        // this feature) is quite bright, so
        // raising the exposure compensation helps
        // bring the scene to a nicer brightness range.
        Exposure { ev100: 13.0 },
        // Tonemapper chosen just because it looked good
        // with the scene, any tonemapper would be
        // fine :) Tonemapping::AcesFitted,
        // Bloom gives the sun a much more natural look.
        Bloom::NATURAL,
        // Enables the atmosphere to drive reflections and
        // ambient lighting (IBL) for this view
        AtmosphereEnvironmentMapLight::default(),
        VolumetricFog {
            ambient_intensity: 0.0,
            ..default()
        },
        Msaa::Off,
        // TemporalAntiAliasing::default(),
        // Smaa::default(),
        ScreenSpaceReflections::default(),
    )

What went wrong

The actual scene (with a perspective projection) looks like this. It is a cube cut by a plane with a custom material that has alphamode::blend. The plane is rendering a calculated value, but I do not believe that is actually relevant (especially since it is blend which shouldn't write to depth buffer and the calculation is seemingly receiving a prepass_depth value of 0, which results in the calculation basically being a visualization of in.position.z).

Image

The render debug overlay output with the Atmosphere components seems to be 0.

Image

Without the atmosphere components, its already clear something is different by the rendering of the custom material.

Image

and indeed we can see the cube in the depth buffer in the render ovarlay

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorS-Needs-ReviewNeeds reviewer attention (from anyone!) to move forward

    Type

    No type

    Projects

    Status

    Needs SME Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions