Skip to content

fix fog color inversion if density is set 0#72329

Closed
jainl28patel wants to merge 1 commit into
godotengine:masterfrom
jainl28patel:fix_fog_density_opengl
Closed

fix fog color inversion if density is set 0#72329
jainl28patel wants to merge 1 commit into
godotengine:masterfrom
jainl28patel:fix_fog_density_opengl

Conversation

@jainl28patel

@jainl28patel jainl28patel commented Jan 29, 2023

Copy link
Copy Markdown
Contributor

This PR fixes #66462 and fixes #66459.

Non-zero density

image

Zero density

image

@jainl28patel jainl28patel requested a review from a team as a code owner January 29, 2023 19:06
@clayjohn clayjohn added this to the 4.0 milestone Jan 29, 2023
@clayjohn

Copy link
Copy Markdown
Member

This also fixes #66459 right?

@jainl28patel

Copy link
Copy Markdown
Contributor Author

This also fixes #66459 right?

Yess !!

@clayjohn

Copy link
Copy Markdown
Member

So this fix will work for all cases where the values in fog are between 0 and 1. But it will break outside of that range. The basic usage of fog leaves all the values between 0 and 1, but if sun_scatter is used, it looks like values can be larger than 1. So when using sun_scatter the fog color will get clamped to vec3(1.0) (which may not be a dealbreaker)

@clayjohn

clayjohn commented Feb 8, 2023

Copy link
Copy Markdown
Member

Superseded by #72914

In the end this bug was fixed by reparing the half2float and float2half functions, so there is no need to work around the bug by limiting to normalized floats as is done here.

Thank you anyway for your investigation and your hard work in fixing this bug!

@clayjohn clayjohn closed this Feb 8, 2023
@clayjohn clayjohn removed this from the 4.0 milestone Feb 8, 2023
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.

OpenGL: Fog color is inverted if density is exactly 0 OpenGL: Fog color is incorrect if one of the components is exactly 0

2 participants