Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed recent DoF and tonemap bugs #61171

Merged
merged 1 commit into from
May 18, 2022
Merged

Conversation

clayjohn
Copy link
Member

@clayjohn clayjohn commented May 18, 2022

Fixes: #61165 and fixes #61167

Both bugs introduced by #54585

The tonemapping bug comes from the ANGLE shader compiler being strictly compliant with the GLSL specification and refusing to subtract a float from an int. The solution is to just use floats.

The DoF bug is more subtle. #54585 allows some post-effects to run with a transparent background. However, DoF near overrides the alpha channel of the backbuffer to pass extra information from the horizontal pass to the vertical pass. This invalidates the alpha values the alpha channel of the buffer. The solution is to ignore alpha when writing out the vertical pass. This achieves two things:

  1. the dark artifact is gone becuase the buffer maintains its alpha of 1
  2. DoF will still work on a transparent VP, it just won't look totally correct as the blended alpha is ignored.

To properly implement DoF with a transparent Viewport we will need another buffer. Since this is something that we didn't support prior to 3.5 and have had very little demand to support, I do not think we should attempt a full implementation before 3.5. If there is strong user demand for DoF with a transparent viewport then we can consider adding it in the nect release.

@clayjohn clayjohn added this to the 3.5 milestone May 18, 2022
@clayjohn clayjohn requested a review from a team as a code owner May 18, 2022 20:27
@clayjohn clayjohn changed the title Fixed recent DoF tonemap bugs Fixed recent DoF and tonemap bugs May 18, 2022
@akien-mga akien-mga merged commit d8650fb into godotengine:3.x May 18, 2022
@akien-mga
Copy link
Member

Thanks!

@TokisanGames
Copy link
Contributor

@clayjohn Thanks. Is it plausible this also fixed another coloring artifact I experienced at the same time?
https://twitter.com/TokisanGames/status/1526975579844538370

The background house is colored differently. Far DOF is disabled. This environment is using TimeOfDay, which uses a giant transparent sphere mesh for fog, and a sky shader, and it controls the directional light. We are using tonemapping.

@clayjohn clayjohn deleted the Dof-tonemap-bugs branch May 18, 2022 21:00
@clayjohn
Copy link
Member Author

clayjohn commented May 18, 2022

@clayjohn Thanks. Is it plausible this also fixed another coloring artifact I experienced at the same time? https://twitter.com/TokisanGames/status/1526975579844538370

The background house is colored differently. Far DOF is disabled. This environment is using TimeOfDay, which uses a giant transparent sphere mesh for fog, and a sky shader, and it controls the directional light. We are using tonemapping.

@tinmanjuggernaut It's possible. The DoF bug came from DoF turning parts of the buffer transparent, so there was bleedthrough from whatever was behind. If you send me an MRP I can take a look.

@TokisanGames
Copy link
Contributor

The second coloring artifact is indeed still present. I'll make a separate issue for it.
https://twitter.com/TokisanGames/status/1526975579844538370

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.

3 participants