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
Improving the denoiser for RTGI (case 1346383) #5078
Conversation
Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed. HDRP Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure. |
4f97ecb
to
a4b8457
Compare
a4b8457
to
cf4110b
Compare
After running the test a thousand times, all green |
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 quickly tested performance on the ray tracing apartment scene in quality mode and in performance medium mode and -surprisingly, I found performance a bit worse than the current master. Needs to be discussed later.
-
I honestly don't know how we can solve this but since values are serialized in the HDRP asset, the only way to get the new values from the quality settings is to create a new HDRP Asset, which is a terrible pain for upgrading. It should at least be mentionned in the upgrade guide or something.
Also, only managed to repro those issues on those specifics projects, but they didn't repro on master so they must be linked with the improvement in a way.
-
Found some NaNs when we use the perf mode denoiser in this project. Doesn't repro in quality mode and on master.
https://user-images.githubusercontent.com/57442369/125320240-cc97ad00-e33b-11eb-8241-d9c489ab7ff5.mp4 -
And in perf mode again, I can see some green appearing on the right side of the view. Doesn't repro in quality mode and on master.
https://user-images.githubusercontent.com/57442369/125320427-fc46b500-e33b-11eb-9c30-d7f94826b1e7.mp4
Hit me up when you are getting back on this to either pair debug it or for me to send you repros.
@remi-chapelain The counters for the perf are not working properly and cannot be trusted. I'll check the perf comparison using a GPU capture to make sure that there is no major regression. Let's sync for the issues that you found, so that you give me a repro. |
86ff6e4
to
4787412
Compare
RTGIDenoiserRadius[(int)ScalableSettingLevelParameter.Level.Low] = 0.75f; | ||
RTGIDenoiserRadius[(int)ScalableSettingLevelParameter.Level.Medium] = 0.5f; | ||
RTGIDenoiserRadius[(int)ScalableSettingLevelParameter.Level.High] = 0.25f; | ||
RTGIDenoiserRadius[(int)ScalableSettingLevelParameter.Level.Low] = 1.0f; |
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.
Given it is all the same value, does it make sense to keep as a scalability setting? (is it beneficial if user change this defaults or should they always be the same 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.
Users can chose to lower it for lower perf modes it as it can affect performance a lot
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.
If it has an high impact, shouldn't this have different values by default too though? Out of the box the scalability does nothing here.
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.
To be disccused
{ | ||
// Compute the tap coordinate in the 8x8 grid | ||
uint2 tapAddress = (uint2)((int2)(groupThreadId) + offset); | ||
return clamp((uint)(tapAddress.x) + tapAddress.y * GATHER_REGION_SIZE, 0, GATHER_REGION_SIZE_2 - 1); |
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.
No need for cast here, tapAddress.x is already a uint
uint2 cornerGroupThread = corner - groupId * DIFFUSE_DENOISER_TILE_SIZE; | ||
|
||
// Grab the indices of the sub-region to use | ||
int ldsIdx0 = OffsetToLDSAdress(cornerGroupThread, int2(0, 0)); |
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.
So I see you don't load a safety border so it is clamp at group border which I guess can give problems if we have signficiant depth discontinuities happening at the edge of the group? Might be ok, but leaving comment here to see if needs further discussion or not.
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.
Not sure to get what you are describing, let's chat
|
||
// If the normals of both pixels are too different, we cannot use it | ||
if(dot(neighborData.normalWS, normalWS) < NORMAL_REJECTION_THRESHOLD) | ||
weight *= 0.1f; |
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.
Would it make sense to soft reject this? Lerping towards 0.1 (or close to) multiplier as we approach the threshold?
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 guess we can have a transition region. But the idea here is to not use these unless there are not better samples
597a548
to
1062c75
Compare
Everything is green |
Conflits, need to merge |
1062c75
to
397751d
Compare
Everything is green @remi-chapelain depends on your review |
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.
Couldn't repro any of the issues I reported above. ✔️
For the rest, I could only see improvements, couldn't find any more regression on the scenes I tested. ✔️
Also tested animation because we don't have coverage for moving objects. ✔️
Pushed the changes regarding the upscale filter to make the documentation match.
This PR improves the upscaling process as well as the denoising of RTGI (and RTAO), it is one of the two PRs to solve this bug
https://fogbugz.unity3d.com/f/cases/1346383/
Removes the upscaling parameter for RTGI (forced to 3 for half res, 4 for full res).
Reduces signficantly the cost of the upscaling pass.
Resolves bleeding (and ghosting artifacts) that come from the upscale.
Change the default parameters for quality settings for RTGI.
Fix edges issues with the half resolution denoiser.
Deduce automatically the world space denoiser radius for surfaces (instead of fixed for the whole scene)
https://youtu.be/J5UJRT5fF6E
https://youtu.be/GZwg9ditAzk
Testing status
DXR Tests are green after updating the screenshots.