Repository navigation
HDR overlay: bloom.prefilter, Unity post-processing's bloom prefilter (runtime 20261029.1) - #1
Merged
Merged
Conversation
… (runtime 20261029.1)
An HDR sidecar may give bloom.prefilter = { threshold, knee, clamp }. The bloom
setup clamps the light to `clamp` per channel, then multiplies it by
max(b - threshold, s) / max(b, 0.0001), b its brightest channel and
s = clamp(b - threshold + knee, 0, 2 knee)^2 / (4 knee + 0.0001), as Unity's bloom
prefilter does, so every pixel at or above the clamp blooms alike (Rogue
Trader: clamp 0.8, threshold 0.674, knee 0.464). It runs where bloom.threshold
would and takes its place when both are given; the setup shader switches on a
uniform, so effects without it draw as before. The editor's sidecar check and
HDR previews pass it through.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The renderer reads bloom.prefilter from the sidecar when the settings it is given carry none, so an editor built before runtime 20261029.1 previews an effect with a Unity prefilter as the game draws it once it loads this runtime file (without it, a Rogue Trader effect bloomed unclamped and its dark core vanished in the preview). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An HDR sidecar may give
bloom.prefilter = { threshold, knee, clamp }: Unity post-processing's bloom prefilter. The bloom setup clamps the light toclampper channel, then multiplies it bymax(b - threshold, s) / max(b, 0.0001), wherebis its brightest channel ands = clamp(b - threshold + knee, 0, 2 knee)^2 / (4 knee + 0.0001). Every pixel at or above the clamp blooms alike.bloom.thresholdwould (pyramid levelround(log2(radiusScale))) and takes its place when both are given.clampis optional (Unity's default 65472).docs/HDR-EFFECT-OVERLAY.mddocuments the field.Why
The engine's bloom had only UE 4's luminance threshold, with no clamp. Rogue Trader (Unity) clamps every channel to 0.8 before its threshold (capture 17482, prefilter pass: clamp 0.8, threshold 0.674, knee 0.464). Without the clamp, an effect with light near 10x white bloomed unclamped and flooded its dark core. A fit of the six Gaussians with UE's threshold left 64 % of the game's bloom unexplained; with this prefilter, 1.9 %.
First user: RT Dark Lance HDR (animation 1005 in a test project).
Tests
editor/tests/hdr-overlay.test.cjs: 25 pass. Four new: the prefilter drives the setup pass, the default clamp, invalid prefilters fail closed, the sidecar fallback.hdr-preview-render9,hdr-preview-twin5 andeffekseer-in-scene10 pass.Also merged into
feat/optional-struct-fields(abdc82e), whose editor previews used it.🤖 Generated with Claude Code