fix(hooks): promote snow render targets to fp16 for banding#2410
Conversation
kSNOW and kSNOW_SWAP are created at R8G8B8A8_UNORM by vanilla; the snow shader accumulates wetness/sparkle values that exceed the 8-bit range and quantize into visible banding on tessellated snow. Hook their CreateRenderTarget calls (offsets 0x406/0x41C in BSShaderRenderTargets::Create) and override the format to R16G16B16A16_FLOAT to give the snow pass enough headroom. Sources the two new hooks on the same RelocationID as the existing Main / Normals / NormalsSwap / MotionVectors render-target hooks.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds two new renderer hooks ( ChangesSnow Render Target Hooks
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.22.0)OpenGrep fatal error (exit code 2): [00.12][ERROR]: Error: exception Unix_error: No such file or directory stat src/Hooks.cpp 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. Comment |
|
No actionable suggestions for changed features. |
|
I lied. |
|
✅ A pre-release build is available for this PR: |
Rationale: vanilla creates the snow and snow-swap render targets as R8G8B8A8_UNORM, while the snow shader can accumulate wetness and sparkle values that quantize visibly on tessellated snow. Implementation: hook the kSNOW and kSNOW_SWAP CreateRenderTarget call sites and force their render-target format to R16G16B16A16_FLOAT before forwarding to the original creation path. The companion sky noise tuning from the source branch is intentionally left out. Acknowledgement: Manual port of community-shaders#2410 by doodlum. Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com>
Extracted from the
effect11sh2branch as the snowswap-hooks half of the "banding fix" pair.Summary
kSNOWandkSNOW_SWAPare created atR8G8B8A8_UNORMby vanilla. The snow shader accumulates wetness/sparkle values that exceed the 8-bit range and quantize into visible banding on tessellated snow. Hook theirCreateRenderTargetcalls (offsets0x406/0x41CinBSShaderRenderTargets::Create) and override the format toR16G16B16A16_FLOATto give the snow pass enough headroom.Mirrors the existing
CreateRenderTarget_Main/CreateRenderTarget_Normals/CreateRenderTarget_NormalsSwap/CreateRenderTarget_MotionVectorspattern, sourced from the same RelocationID.Scope note: sky noise half held back
The companion commit on
effect11sh2("better banding fix" inSky.hlsl) replaces a per-pixel TPDF noise term — whicheffect11sh2had also added — with a multiplicative1 + noiseGrad * 10scheme. Neither the TPDF term nor that scheme exists ondev, where theDITHERpath has been restructured aroundENABLE_LL(linear lighting) since the original commit. Forward-porting the multiplicative noise into theENABLE_LL-conditional path is a graphics tuning decision that needs runtime evaluation, so it's been left out of this PR rather than guessed at.Test plan
Generated by Claude Code
Summary by CodeRabbit