Skip to content

Conversation

mate-h
Copy link
Contributor

@mate-h mate-h commented Aug 12, 2025

Objective

Solution

  • created a new atmosphere node type called environment
  • up-sampling the existing sky-view lookup texture and tied to the current view only. this atmosphere cube map pass has negligible performance impact, however the filtering pipeline does have a small performance impact to the example.
  • using the new filtering pipeline, creates mip chain for different roughness levels as well as diffuse

Testing

  • ran the atmosphere example

Showcase

Screenshot 2025-08-12 at 12 19 08 PM
commands.spawn((
    Camera3d::default(),
    // ...
    // Renders the atmosphere to the environment map from the perspective of the camera
    AtmosphereEnvironmentMapLight::default(),
));

Limitations, out of scope

  • The generation does not support light probes (yet). This allows to render the atmosphere as a light probe from any "location" within the scene and within the overall atmosphere.
  • therefore we assume that the relative scale of the scene to the atmosphere are orders of magnitude different , this is a safe assumption now with the current impl not officially supporting space views, yet
  • the PBR directional light is still unaffected by the atmosphere (not tinted by it) out of scope for this PR
  • unrelated issue to this PR: small black pixels around the fully reflective sphere. narrowed it down, this is a problem in the inscattering calculation based on the depth value in the render sky shader. however the addition of the env map light makes this problem more "apparent". to be addressed separately.
  • past work staged for further PRs, up next: WIP: Atmosphere PBR support mate-h/bevy#10

@mate-h mate-h added C-Feature A new feature, making something new possible A-Rendering Drawing game state to the screen M-Needs-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 12, 2025
Copy link
Contributor

It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note.

Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes.

Copy link
Contributor

@atlv24 atlv24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet! thanks for splitting it up :)

Copy link
Contributor

@JMS55 JMS55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think user-facing docs need some work still. They focus too much on technical details (renders a cubemap), rather than what they're useful for (getting the atmosphere to contribute lighting).

Code looks good though.

Copy link
Contributor

@ecoskey ecoskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shaders look great! Just a couple nits for stuff on the rust side, but nothing blocking :)

@@ -139,6 +148,14 @@ impl Plugin for AtmospherePlugin {
configure_camera_depth_usages.in_set(RenderSystems::ManageViews),
queue_render_sky_pipelines.in_set(RenderSystems::Queue),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this system should match prepare_atmosphere_probe_pipelines naming-scheme wise, and be in the same set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense but should this be the other way around? i see auto exposure also uses the Queue render set, and queue_ naming prefix. but it's a view specific pipeline. I almost think I should match my naming to this since the entity we are considering in this case for queueing is the view / camera.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as they match I don't mind tbh

@ecoskey ecoskey added this to the 0.18 milestone Aug 12, 2025
@ecoskey ecoskey added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 12, 2025
@mate-h mate-h added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Aug 13, 2025
@mate-h
Copy link
Contributor Author

mate-h commented Aug 13, 2025

Thanks for everyone’s feedback! I have addressed every comment, let me know if this version still needs any fine tuning. It is ready for a final review!

prepare_atmosphere_probe_bind_groups.in_set(RenderSystems::PrepareBindGroups),
queue_atmosphere_probe_pipelines
.in_set(RenderSystems::Queue)
.after(init_atmosphere_probe_layout),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.after(init_atmosphere_probe_layout),

This is redundant

Copy link

@Igor-dvr Igor-dvr Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mate-h It seems this comment was missed. Is this line redundant or we decided to leave it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in previous versions I was getting a runtime error without explicitly ordering systems, but with the queue render set changes it is probably safe to remove it! I have not had a chance to test without this line. Feel free to raise a PR if you do so! Thanks.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 14, 2025
@JMS55
Copy link
Contributor

JMS55 commented Aug 14, 2025

@mate-h needs release notes, no?

@mate-h
Copy link
Contributor Author

mate-h commented Aug 14, 2025

I am not at home right now, but i can do it as a follow up tomorrow! The release note is super simple though. Just added this new component no breaking changes to the atmosphere.

@JMS55
Copy link
Contributor

JMS55 commented Aug 14, 2025

Yeah, but we should highlight it in the blog post :)

Merged via the queue into bevyengine:main with commit ae143d4 Aug 14, 2025
34 checks passed
@mate-h mate-h modified the milestones: 0.18, 0.17 Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible M-Needs-Release-Note Work that should be called out in the blog due to impact S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants