Skip to content

[FogBugz 1339083] Fixing exposure issues with clouds and planar probes #4748

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

Merged
merged 46 commits into from
Jun 14, 2021

Conversation

kecho
Copy link
Contributor

@kecho kecho commented Jun 1, 2021

Purpose of this PR

Fogbugz: https://fogbugz.unity3d.com/f/cases/1339083/
This PR has a few fixes for issues around volumetric clouds and exposures. The issues are the following:

  1. Planar reflection volumetric cloud exposure history was wrong, it was using a pointer to the parents view history. This history was invalid since the parent view would write a new exposure right before rendering. This has been changed now so the probe has its own history, and instead we copy by value the parent's exposure. A new pass has been added for this, which is called "UpdateParentExposure". This pass clears the current exposure texture to whatever was established by the parent. This effectively preserves the history of the current planar reflection probe.

Before vs After:
image

  1. When exposure control was disabled on the reflection probe, the clouds would look very weird in the reflection. This was caused by the internal usage of a "Fast tonemap" function, which squeezed the range of the volumetric clouds. This range helps when we are pre exposued, but if we are not pre exposed we get luminance values that are bigger. This causes some weird floating point behaviour when luminance is very high (we lose tons of precision due to 16 bit storage). For now this PR proposes removing the tonemapping function if exposure control is disabled on the reflection.

Before vs After
image

  1. In the editor, if we switch quickly between exposure control on and off in the planar reflection, we can get some NaNs and corruption because the history is not invalidated. Invalidated the history correctly and fixed the problem

  2. Fixed feedback loop caused by mismatched exposure coming from the CPU & GPU. The exposure used to sample planar reflection was coming from the CPU which could be a few frame delayed, and the exposure used to render the planar reflection was coming from the GPU which could be ahead. This could cause some crazy flashing /feedback loop in exposure when adaptation time was very small.


Testing status

  • Tested on sample scene from test dx11 PC .
  • Tested with planar probe with exposure control on and off.
  • Tested with exposure modes: Fixed, Auto and using histogram & average metering.

pmavridis and others added 28 commits May 26, 2021 19:23
* Fix AxF debug output in certain configurations.

* Update comment
* Fix white flash

* changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Show info box when ray tracing is enabled.

* Changelog

* Move below MSAA

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
…phics Compositor enabled (#4593)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Reconstruct jittered projection matrix far plane (for Infinite )

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
…DRP's lifecycle. (#4688)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Fix overdraw in custom pass utils blur function

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Fix

* changelog

* Force sync compilation for TAA

Co-authored-by: CifaCia <f.cifariellociardi@gmail.com>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
…side is updated. (case 1335737, related to 1314040) (#4691)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
…ing only the RTSSS Data (case 1332904). (#4626)

* Fixed the ray traced sub subsurface scattering debug mode not displaying only the RTSSS Data (case 1332904).

* Add test scene

Co-authored-by: Remi Chapelain <remi.chapelain@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
…e refraction and probe refraction (#4653)

* Delete the second transmittance mul

* Changelog

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
#4636)

* Initialize the shading normal to a non-zero value for anisotropy

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Fix VfX lit particle aov output color space

* Update comment

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Fixed issue with transparent unlit.

* Updated changelog.

* Reverted accidental change to default mtl.

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Fix

* changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
…cal volumetric fog volume (#4728)

* Fixed nullref when deleting the 3D mask of a density volume (case 1339330)

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
adrien-de-tocqueville and others added 2 commits June 7, 2021 13:49
* Ignore hybrid duplicated reflection probes during light baking

* test path instead of scene

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
…4725)

* Fix double sided option moving when toggling it in the material UI (case 1328877)

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
Copy link
Contributor

@anisunity anisunity left a comment

Choose a reason for hiding this comment

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

Pretty much good, discussed with @kecho over the phone couple changes required, but adding them here just for tracking purposes.
1 - Change the multicompile for the fast-tonemap into a scalar with a lerp, the shader is quite large and I would like to avoid increasing the compilation time.
2 - Add the exposure control history flag to the pre-existing structure, it may be useful for ray tracing effects eventually and it would avoid having yet an other structure into the HDCamera.cs
3- Duplicate the shadow test to have a version without exposure control for coverage

@kecho kecho force-pushed the HDRP/FixCloudsAndBadExposure branch from a5671ab to 0f4e141 Compare June 7, 2021 16:07
@kecho
Copy link
Contributor Author

kecho commented Jun 7, 2021

@anisunity all tests and the changes you requested have been added. Gonna now run the CI and get it all updated.

sebastienlagarde and others added 10 commits June 7, 2021 21:40
* Fix planar reflection

* changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* - Updated the recursive rendering documentation (case 1338639).

* review fixes

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
…eflection probe are updated same frame (#4812)

* Don't mark as rendered for reflection probes as we want the cached version to be from main view

* Do the thing just for directional

* Doc update

* changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
@kecho kecho force-pushed the HDRP/FixCloudsAndBadExposure branch from c546316 to 2588faa Compare June 8, 2021 19:21
…ic cloud history issues

Formatting

Changelog merge

Removing permutation for fast tone mapping in clouds, making it a dynamic branch instead. Adding as part of history validity exposure control setting

Adding new tests for NoExposure

Adding test images

Re-adding test to OSX
@kecho kecho force-pushed the HDRP/FixCloudsAndBadExposure branch from 2588faa to 5c77a4c Compare June 8, 2021 19:25
Copy link
Contributor

@anisunity anisunity left a comment

Choose a reason for hiding this comment

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

lgtm

@sebastienlagarde sebastienlagarde changed the base branch from hd/bugfix to master June 10, 2021 18:04
@sebastienlagarde sebastienlagarde merged commit a8e6bf5 into master Jun 14, 2021
@sebastienlagarde sebastienlagarde deleted the HDRP/FixCloudsAndBadExposure branch June 14, 2021 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.