-
Notifications
You must be signed in to change notification settings - Fork 855
SSR Improvement #1928
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
SSR Improvement #1928
Conversation
… into HDRP/ssr_improvement
… into HDRP/ssr_improvement # Conflicts: # com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
… into HDRP/ssr_improvement # Conflicts: # com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
… into HDRP/ssr_improvement
… into HDRP/ssr_improvement # Conflicts: # com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflections.compute
… into HDRP/ssr_improvement # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md # com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs.hlsl
… into HDRP/ssr_improvement
// Pick which subpixel we will be launching our effects from | ||
float subPixelSample = GetBNDSequenceSample(positionSS, globalSampleIndex, 3); | ||
int subPixel = clamp((int)(subPixelSample * 4.0), 0, 3); | ||
uint2 shift = HalfResIndexToCoordinateShift[subPixel]; |
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 is code picked from RayTracingReflection.compute is meant to handle BSDF data info fetch in half res mode, in the current state SSR doesn't have half res mode. This is a copy paste mistake i guess.
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.
We switched to an algorithm that does temporal accumulation this shift help for quality. I am open to discuss that.
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 usage of the code, if on purpose, increases the variance and biases the signal even more, I am sure of that.
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.
That help on the edges & very close hit (corners: Wall vs Floor/Ceilling)
…HDRP/ssr_improvement # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md
…HDRP/ssr_improvement
…HDRP/ssr_improvement
…HDRP/ssr_improvement
…HDRP/ssr_improvement
…HDRP/ssr_improvement # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md
@@ -1,3 +1,6 @@ | |||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs.hlsl" |
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.
Why do you need those hearders here? it is not expected that we put such header in VertMesh.hlsl
if (hdCamera.isFirstFrame || hdCamera.cameraFrameCount <= 2) | ||
cb._SsrAccumulationAmount = 1.0f; | ||
else | ||
cb._SsrAccumulationAmount = Mathf.Pow(2, Mathf.Lerp(-0.0f, -7.0f, volumeSettings.accumulationFactor.value)); |
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.
typo, there is a -0.0 here
…Graphics into HDRP/ssr_improvement
…HDRP/ssr_improvement
…HDRP/ssr_improvement
…HDRP/ssr_improvement
passData.ssrAccum = builder.WriteTexture(ssrAccum); | ||
passData.ssrAccumPrev = builder.WriteTexture(ssrAccumPrev); | ||
passData.lightingTexture = builder.CreateTransientTexture(new TextureDesc(Vector2.one, true, true) | ||
{ colorFormat = GraphicsFormat.R16G16B16A16_SFloat, clearBuffer = true, clearColor = Color.clear, enableRandomWrite = true, name = "SSR_Lighting_Texture" }); |
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 must be of color buffer format (i.e 101010f or 16f depends on the option of hdrp asset)
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 see it is not related to your PR, I will take care of it separately
|
||
if (!usePBRAlgo) | ||
{ | ||
CoreUtils.SetKeyword(cmd, "SSR_APPROX", false); |
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 don't understand why you do this at the end. You must no do this but instead do:
CoreUtils.SetKeyword(cmd, "SSR_APPROX", !usePBRAlgo); at the beginning.
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.
oh unless it is for the transparent case?
cmd.DispatchCompute(cs, parameters.reprojectionKernel, HDUtils.DivRoundUp(parameters.width, 8), HDUtils.DivRoundUp(parameters.height, 8), parameters.viewCount); | ||
|
||
if (parameters.transparentSSR) | ||
CoreUtils.SetKeyword(cmd, "DEPTH_SOURCE_NOT_FROM_MIP_CHAIN", false); |
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.
you don't need to reset keyword at the end (unless you reuse the shader, you should setup
CoreUtils.SetKeyword(cmd, "DEPTH_SOURCE_NOT_FROM_MIP_CHAIN", parameters.transparentSSR); at the beginning
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.
oh unless it is for the transparent case?
* Change reflection direction to match GGX * local tmp * Temp Denoise and Inpainting * Backup remote work * Remove blur step * Add doc * ChangeLog + small fix * Speed dependend convergence * Clean code * Fix multicamera + SSR * Cleanup * Saturate local & target velocity * Fix RenderGraph * Code cleaning + comments * Fix feedback * Support previous & new algorithm * missing file: support both algorithm * fix for default RenderGraph * Simplify UI * Remap parameters for more userfriendly parametrization * fix doc missing * Clean up * New rendergraph fix * temp * Fix alloc issues RenderGraphs * Update default values * Add NaN killer * New strategy for 'first frame' reset * Update doc with clearer explaination * Perf improvement * Move code * Fix GCAlloc issues * Fix SSR & Transparent, both pipe RenderGraph & non-RenderGraph * Add what's new * Regenerate shader includes * Fix API Test * Fix name RayTracingCommon.hlsl * Typo simplification * Update VertMesh.hlsl * Update VertMesh.hlsl * Fix parity RG & Non-RG Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
SSR Improvement
The improvement:
Better match:

New SSR:
Pathtracer (Bounce == 2):

Checklist for PR maker
Docs team contacts sheet.
Purpose of this PR
SSR will give us a better match with Pathtracer.
Testing status
On the scene add a moving object for example a cylinder and move it, note the motion vector for objects are only available in the GameView:
` public float speed = 5.0f;
For rough surface, we will have more noise even with large accumulation, on region of this cylinder.
Ref:
https://drive.google.com/file/d/1zyrvVWU-bzVqYOyOERe7OMvnZXtjbxzI/view?usp=sharing
Parameters to consider during a test:

Object thickness, which allow the ray to pass behind thin object:
Correct value: scene dependents
Allow more accumulation with multiple frame:

Yamato: (Select your branch):
https://yamato.prd.cds.internal.unity3d.com/jobs/902-Graphics
Comments to reviewers
Notes for the reviewers you have assigned.