Fix banding in MultiScaleVolumetricObscurance (AmbientOcclusion)#6758
Fix banding in MultiScaleVolumetricObscurance (AmbientOcclusion)#6758maloyer-unity wants to merge 1 commit into
Conversation
The precision of the temporary TileDepth* rendertargets are lower than all other temporary depth target when applying MSVO; With some specific camera angle/distances, this can cause banding/lines effects to appear due to these low precision buffer. This change will add a user-selectable option to allow to increase the precision of the TileDepth* buffers. This solves the banding issue at the cost of GPU memory and GPU bandwidth.
| AllocArray(cmd, ShaderIDs.TiledDepth2, MipLevel.L4, RenderTextureFormat.RGHalf, true, camera.allowDynamicResolution); | ||
| AllocArray(cmd, ShaderIDs.TiledDepth3, MipLevel.L5, RenderTextureFormat.RGHalf, true, camera.allowDynamicResolution); | ||
| AllocArray(cmd, ShaderIDs.TiledDepth4, MipLevel.L6, RenderTextureFormat.RGHalf, true, camera.allowDynamicResolution); | ||
| RenderTextureFormat depthFormat = m_Settings.highDepthPrecision ? RenderTextureFormat.RGFloat : RenderTextureFormat.RGHalf; |
There was a problem hiding this comment.
With source scene depth being 32-bit depth, increasing temporary depth buffer to 64-bit seems an overkill. Also compute shader that uses TiledDepth has Linearize() which splits upper/lower depth based on MSAA or not.
For the fogbugz case, it sounds like they are trying to optimize SSAO 50m out where depth precision drops exponentially. The better way is to tighten near/far planes and fade out SSAO for far geometry where there's less depth precision. When I implemented similar SSAO VO (also known as Volumetric Obscurance https://www.ppsloan.org/publications/vo.pdf), SSAO quality is concentrated near the camera and AO is faded out gradually to avoid artifacts.
For some fugbugz cases, it may be fine if there's something user isn't doing correctly, and we suggest a user fix rather than changing code on our side.
|
Closing this PR for now, I will re-evaluate the issue and alternative fixes. |
The precision of the temporary TileDepth* rendertargets are lower than all other temporary depth target when applying MSVO; With some specific camera angle/distances, this can cause banding/lines artifacts to appear due to these low precision buffer.
This change will add a user-selectable option to allow to increase the precision of the TileDepth* buffers. This solves the banding issue at the cost of GPU memory and GPU bandwidth.
Purpose of this PR
Fix issue from https://fogbugz.unity3d.com/f/cases/1375337/
Testing status
Used the project in FogBugz and tested it in Editor and WindowsPlayer
Comments to reviewers
To fix the issue, we need to check the new option "High Depth Precision" in the AO setting panel.
This was added as an option since it will increase the memory usage of the AO post-process and is not needed for most users.