-
Notifications
You must be signed in to change notification settings - Fork 792
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
[10.x.x] Bugfixes for SSAO #1213
Conversation
…tures and normalizedScreenSpaceUV float was not done correctly.
Adding XR team as reviewer. |
…ving unused code and fixing FullScreenBlit from declaring _ScaleBias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change looks good to me, can we add a unit test for this SSAO use case(render without intermediate texture)? For this specific issue, XR test framwork will reuse that unit test and ensure yflip is correct when rendering in XR.
Vector4 scaleBias = (flipSign < 0.0f) | ||
? new Vector4(flipSign, 1.0f, -1.0f, 1.0f) | ||
: new Vector4(flipSign, 0.0f, 1.0f, 1.0f); | ||
cmd.SetGlobalVector(ShaderPropertyId.scaleBiasRt, scaleBias); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if someone tries to access these scaleBias variables in passes before drawobjects. Should also set up those at beginning of the frame so any custom pass or pass before main rendering doesn't access garbage/previous frame values?
Can be fixed in follow up PR.
Adding Ryan to verify this is fixed in XR. |
@ellioman @thomas-zeng Ryan is away so I'll test this. Based on problems that Ryan found with previous SSAO iterations, what testing seems appropriate for this PR? I assume I should test on Rift and Quest, but are other HMDs needed? Historically, have you seen cases where SSAO worked on one graphics API but broke on another? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been discussed internally but I am repeating it here.
When I tried the following configuration what I saw in the Rift looked like a stereo version of the 142_SSAO_DepthNormal_Projection reference image:
- Unity (trunk ef716c6ae229)
- Graphics (universal/ssao-fixes 14b6738)
- XRSDK, Oculus Rift, Single Pass Instanced
- Editor Playmode and built Standalone Player
- URP Graphics Test 142_SSAO_DepthNormal_Projection
- UniversalRPAsset default settings (HDR, MSAA, and Opaque Texture on)
However, when I toggled off HDR, MSAA, and Opaque Texture I see what looks like an upside-down depth buffer superimposed over the scene geometry. Y-flip issues are difficult to solve ubiquitously. Y-flip fixes on one configuration frequently break another configuration. After this problem is purportedly fixed, this PR will need extensive testing across non-XR and XR platforms, graphics APIs, etc. prior to merging.
… into universal/ssao-fixes
com.unity.render-pipelines.core: 10.0.0-preview.26 com.unity.render-pipelines.high-definition-config: 10.0.0-preview.23 com.unity.render-pipelines.high-definition: 10.0.0-preview.23 com.unity.render-pipelines.lightweight: 10.0.0-preview.23 com.unity.render-pipelines.universal: 10.0.0-preview.22 com.unity.shadergraph: 10.0.0-preview.23 com.unity.visualeffectgraph: 10.0.0-preview.23
…ologies/Graphics into universal/ssao-fixes
# Conflicts: # com.unity.render-pipelines.core/package.json # com.unity.render-pipelines.high-definition-config/package.json # com.unity.render-pipelines.high-definition/package.json # com.unity.render-pipelines.lightweight/package.json # com.unity.render-pipelines.universal/package.json # com.unity.shadergraph/package.json # com.unity.visualeffectgraph/package.json
I repeated my tests from 7/17 using the latest dev branch commit with a newer trunk changeset. What I saw in the Rift looked like a stereo version of the 142_SSAO_DepthNormal_Projection reference image using these configs:
I'll try similar tests on Quest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve this PR. The depth buffer issue I reported on 7/17 does not occur with the following configurations.
I do see some sparkle artifacts on trees, like small flickering horizontal lines of brightly-colored pixels, as well as tearing. However, these anomalies also occur when I switch from the dev branch URP to URP packages from recent Graphics master (46f38be). I’ll investigate this further, and file bugs if applicable.
- Unity (trunk 268f33c02e91)
- URP (universal/ssao-fixes cf02adb)
- scene 142_SSAO_DepthNormal_Projection
- Quest
- OpenGLES3, and Vulkan
- MultiView
- HDR, MSAA, Opaque Texture: all Enabled, and all Disabled
# Conflicts: # TestProjects/UniversalGraphicsTest/ProjectSettings/EditorBuildSettings.asset # com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceAmbientOcclusion.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shader graph changes look alright to me, but i don't know how much test coverage we have for the gbuffer pass yet. as long as you've manually confirmed that the results aren't breaking or drastically different then it's good to go
Next up is support for Deferred where I'll be adding two test scenes for that. So we are good there. |
Purpose of this PR
This PR does the following:
GetNormalizedScreenSpaceUV()
function toShaderVariablesFunctions.hlsl
TransformScreenUV()
function toShaderVariablesFunctions.hlsl
TransformNormalizedScreenUV()
function toShaderVariablesFunctions.hlsl
float2 normalizedScreenSpaceUV
in InputData, as it wasn't actually normalized screen UV._SCREEN_SPACE_OCCLUSION
in Bakedlit shaderUniversalRPAssetBackBuffer
) that disables features that forces an opaque textureSetQualityLevelOnAwake
) that switches quality settings on Awake() in playmode and reverts back to the original one in OnDisable()144_SSAO_RenderToBackBuffer
) that uses the new script to switch to the BackBuffer Quality settingComments to reviewers
This is easily reproducible by going to the URP Asset and turning off Opaque texture, HDR and MSAA.
Testing status
Manual Tests: What did you do?