Skip to content

View model under HDR, and an anti-aliasing pass from content - #137

Merged
larelgit merged 2 commits into
mainfrom
claude/view-model-hdr
Nov 27, 2026
Merged

larelgit merged 2 commits into
mainfrom
claude/view-model-hdr

Conversation

@larelgit

Copy link
Copy Markdown
Owner

Two follow-ups to #136, found when Cranium turned its bloom and SSAO on.

The arms under an HDR world camera

The view model's camera used to draw in HDR into the world camera's texture, after that camera's tone mapping and grade, so it got neither. A grade's exposure brightened the world and left the arms that many stops darker: 1.7 stops in Cranium's tunnels as soon as a bloom made the camera HDR.

Now it never draws in HDR. Its materials tone map in their shaders and take the world camera's grade, which they draw as its exposure, the same way they do over a camera without HDR. Over an HDR world camera, the two textures have different formats and can't be shared, so the view model draws into its own. That texture is cleared to nothing and laid over the world's finished picture with premultiplied alpha (CameraOutputMode::Write). It keeps Bevy's 4x MSAA there, whatever the world camera has.

An anti-aliasing pass from content

picture.anti_aliasing: Some(Fxaa) or Some(Smaa) puts Bevy's FXAA (its defaults) or SMAA (High) on the world cameras. It is meant for a camera that SSAO took MSAA from. Taking it out gives the camera back its own pass, or none. It is off by default.

Tests

  • GPU (offscreen, RTX 5080):
    • first_person::the_arms_are_drawn_alike_over_a_world_camera_with_hdr_and_without: the arms' mean colour is (124.8, 133.6, 151.6) both without HDR and in HDR, with a +1.7 exposure grade.
    • the_contents_anti_aliasing_smooths_the_edges_of_a_picture_without_msaa: SMAA changes 182 edge pixels and FXAA 390, the picture's light stays the same, and the picture is unchanged once the pass is taken out.
    • The SSAO first-person test now expects the arms' own MSAA under the sandbox's HDR camera.
  • Unit tests: the view model's camera over an HDR world camera (no Hdr, the world's grade and tone mapping, its own cleared texture, laid over the world, 4x MSAA), and the anti-aliasing pass going on and giving the camera's own back.
  • Clippy is clean for shards_action and shards_motion.

🤖 Generated with Claude Code

The view model's camera drew in HDR into the world camera's texture after
its tone mapping and grade, with neither: a grade's exposure brightened the
world and left the arms that many stops darker. It now draws without HDR
whatever the world camera does, tone mapped and graded (the exposure) in its
shaders; over an HDR world camera it draws into a texture of its own,
cleared to nothing, laid over the world's picture with premultiplied alpha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…MSAA over HDR

picture.anti_aliasing: Some(Fxaa | Smaa) puts Bevy's FXAA or SMAA (High) on
the world cameras, for a camera SSAO took MSAA from; taking it out gives the
camera back its own. Over an HDR world camera the view model has a texture
of its own and keeps Bevy's 4x MSAA whatever the world camera has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@larelgit
larelgit merged commit a8d0d55 into main Nov 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants