fix: fog flicker in unified water#1772
Conversation
📝 WalkthroughWalkthroughModified the fog distance calculation in a water shader by replacing the W-component of world position with the 3D Euclidean distance magnitude. This changes how fog intensity is evaluated based on camera distance rather than a transformed scalar value. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
|
✅ A pre-release build is available for this PR: |
|
What's the reasoning for the changes? Are we changing the algorithm significantly? In other words why are the parameters used before being dropped? |
the old input.WPosition.w was distance calculated per-vertex then interpolated, which broke with unified water. all the other fog params are identical (FogParam.x/y, FogFarColor.w, FresnelRI.y). |
|
Please also consider the commit message. |
fixes flicker, also results in better final fog colour with less "glow"

before/after
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.