Skip to content

Use transmittance instead of opacity in the early-out branch when calculating volumetric fog#116107

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
clayjohn:volumetric-fog-early-out
Feb 10, 2026
Merged

Use transmittance instead of opacity in the early-out branch when calculating volumetric fog#116107
Repiteo merged 1 commit intogodotengine:masterfrom
clayjohn:volumetric-fog-early-out

Conversation

@clayjohn
Copy link
Member

@clayjohn clayjohn commented Feb 9, 2026

Fixes: #116045

This fixes one more case that was implicitly using opacity in the volumetric fog calculations. When we switched to consistently use transmittance in #112494, the result of this early-out became opaque black instead of a fully transparent black. This is because transmittance is 1-opacity.

This fix is totally safe and should be backported. The situations where this branch is triggered are quite rare, but should be fixed quickly since it is affecting real projects.

The MRP in #116045 uses a vertex shader to lock a QuadMesh to the near plane of the camera. For some reason that QuadMesh has Volumetric Fog applied to it as well despite being used for post-processing effects. Due to precision issues, fog_pos.z ends up slightly less than 0.0 on one corner. Which leads to a large section of the screen being less than 0.0 due to interpolation. This triggers this branch which, due to #112494, returns a fully opaque black fog. The fully opaque black fog overwrites the color calculated in the shader. And since this shader is actually an opaque QuadMesh, it overwrites the final pixel colour as well.

While I think the MRP is a bit silly, the current behaviour is incorrect and avoidable and the MRP should be able to function correctly.

@clayjohn clayjohn requested a review from a team as a code owner February 9, 2026 17:54
@clayjohn clayjohn added bug regression cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release topic:rendering labels Feb 9, 2026
@clayjohn clayjohn added this to the 4.7 milestone Feb 9, 2026
Copy link
Contributor

@blueskythlikesclouds blueskythlikesclouds left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

@Repiteo Repiteo merged commit 0dc5c0a into godotengine:master Feb 10, 2026
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Feb 10, 2026

Thanks!

@Repiteo
Copy link
Contributor

Repiteo commented Feb 10, 2026

Cherry-picked for 4.6.1.

@Repiteo Repiteo removed the cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release label Feb 10, 2026
rivie13 pushed a commit to rivie13/Phoenix-Agentic-Engine that referenced this pull request Feb 16, 2026
…rly-out

Use transmittance instead of opacity in the early-out branch when calculating volumetric fog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Volumetric fog cuts to black at certain angles when applied to a full screen QuadMesh

3 participants