[feature request] Better denoiser for GI

[All this related only to “Performance” mode of ray traced GI]
While Unity’s GI denoiser way better than one in Unreal Engine 4.x it’s still has a lot to wish for. In small scenes with low view distances (like for interior render) it’s possible to tweak denoiser for small radius that preserves not per pixel but relatively small details… in scenes with large view distances denoiser is barely acceptable. Here are some reference screenshots to illustrate current GI denoiser state:
1)Denoiser radius maxed out to smooth noise on objects located on medium distance from camera:


Note that distant objects have quite messy look, close up objects has washed out little and not so little lighting details.

2)Denoiser radius minimized to preserve small details on objects close to the camera:


Price - noise on medium range objects becomes more noticeable; distant objects still messy, not so much difference.

3)Personally I use settings from first example (optimized for middle-range objects) + AO to recover some small details (not in color but at least in shape/silhouette):


Price - AO affects many areas where actually should not be any AO + it’s also cost some performance. Distant objects still messy, not so much difference from previous two examples…

4)Ground truth reference - path tracing (limited to single bounce GI):


Per-pixel awesomeness + better emission color handling ).

So, current GI denoiser can work only for nearby objects or only on middle distance; no way to tweak it for whole scene range. If someday somehow GI denoiser can be improved (make denoiser radius rise with scene depth? and/or screen-space GI in mixed mode can try to cast some short radius rays for GI on small details) - it will be nice!

Here is this project if needed (all models here are my own (and almost 10 years old) except human - it was made in HumanMaker so also free, all published with CC0 license).

6 Likes

Hello,

Can you please create a simple repro project from this scene and report a bug. I’ll try to have a close look at what I can do.

Thanks,

Best,

4 Likes

Done: case 1346383

3 Likes

@Lex4art First there is indeed an issue with the emissive parts in your scene, it has nothing to do with color management, but that should be easy to fix (it works fine in quality mode and now in performance)

It was working “properly” for Lit, but not for unlit

Oh wait, it was broken by a PR done when I was off [Fogbugz 1324000] Fixing unlit emissive reflections by kecho · Pull Request #4340 · Unity-Technologies/Graphics · GitHub

1 Like

Yeah, I remember that winter patch with fixes to performance mode emissive coloring - good to have it back )

Now we should be all good :wink: (Ignore Sky contrbution)

2 Likes

@Lex4art I’ve done a first pass on the denoiser. It should be significantly better Improving the denoiser for RTGI (case 1346383) by anisunity · Pull Request #5078 · Unity-Technologies/Graphics · GitHub if you want to give it a try

1 Like

You should be pretty happy

6 Likes

Can’t really see much on youtube-compressed 720p video (with RTAO enabled on top) - but it seems to be completely noise free. Thanks!

Upd: after commenting out
error that prevents compiling com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\HDRenderPipelineAsset.cs(114,34): error CS0115: ‘HDRenderPipelineAsset.prefixedRenderingLayerMaskNames’: no suitable method found to override and all following errors it’s possible to do live tests with this PR. Updated denoiser is so much better:

Upd2: seems that lowering camera min and max view distances helps to increase denoiser details preservation, but even at my 0.01m as minimum and 100 000 m as maximum (for volumetric clouds) its good enough trade-off. More live tests needed.

1 Like

Found couple issues that i’ll be working on, it was more to give you something to try out and give some feedback

4 Likes

Also i cannot remember which of you asked for better performance for the Upscale (in the case or VR, or in general) @m0nsky or @Lex4art this PR will also significantly improve that

1 Like

@auzaiffe Sounds good! I’m currently preparing to test this in VR. Something short I would like to add in the subject of the diffuse denoiser, I have had really good results with a second denoiser pass + jitter for RTAO (with both HF + LF buffer like RTGI) when testing this a few weeks ago, maybe this would be a good addition for the official repo?

Fun stuff

2 Likes

I have some ideas to improve the RTAO denoiser so that a second pass is not necessary. It shoudln’t be too expensive

1 Like

No issues in VR so far, seems to be a great improvement in noise, details and performance.
Only feedback for room for improvement I can provide is this:

On a sidenote, is there any chance RTAO can be converted to the RaytracingDeferredLightLoop so all DispatchRays are equal (and so it can benefit from ray binning + 1 dimensional array trick)

Ray binning for RTAO is something that is on my list to explore, thanks for reminding me

Also I did a change that should improve the usecase you are presenting

1 Like

Ok should be good for what you reported @Lex4art i’ll be opening the PR

4 Likes

Is this change already in the latest 2021.2 beta3?