Skip to content

Fix banding in MultiScaleVolumetricObscurance (AmbientOcclusion)#6758

Closed
maloyer-unity wants to merge 1 commit into
masterfrom
ppv2/fix_banding_in_multiscale_volumetric_obscurance_FP32
Closed

Fix banding in MultiScaleVolumetricObscurance (AmbientOcclusion)#6758
maloyer-unity wants to merge 1 commit into
masterfrom
ppv2/fix_banding_in_multiscale_volumetric_obscurance_FP32

Conversation

@maloyer-unity
Copy link
Copy Markdown
Contributor

@maloyer-unity maloyer-unity commented Jan 17, 2022

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.

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;
Copy link
Copy Markdown
Contributor

@mikesfbay mikesfbay Jan 26, 2022

Choose a reason for hiding this comment

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

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.

@maloyer-unity
Copy link
Copy Markdown
Contributor Author

Closing this PR for now, I will re-evaluate the issue and alternative fixes.

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.

2 participants