Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[feature request] Better denoiser for GI

Discussion in 'HDRP Ray Tracing' started by Lex4art, Jun 28, 2021.

  1. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    [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:
    Ray traced GI optimized for medium distance.jpg
    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:
    Ray traced GI optimized for close-up distance.jpg
    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):
    Ray traced GI optimized for medium distance plus AO for details.jpg
    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):
    Path tracing with single light bounce.jpg
    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).
     
    Last edited: Jun 28, 2021
  2. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    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,
     
  3. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    Done: case 1346383
     
    sendspace, chap-unity and PutridEx like this.
  4. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    @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)

    upload_2021-7-6_11-51-1.png
     
  5. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    It was working "properly" for Lit, but not for unlit
     
  6. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Lex4art likes this.
  7. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    Yeah, I remember that winter patch with fixes to performance mode emissive coloring - good to have it back )
     
    Last edited: Jul 6, 2021
  8. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Now we should be all good ;) (Ignore Sky contrbution) upload_2021-7-6_14-11-8.png
     
    Lex4art and m0nsky like this.
  9. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    PutridEx likes this.
  10. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    You should be pretty happy
     
    NotaNaN, newguy123, Lex4art and 3 others like this.
  11. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    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
    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:
    New denoiser goodness.png

    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.
     
    Last edited: Jul 7, 2021
    newguy123 likes this.
  12. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Found couple issues that i'll be working on, it was more to give you something to try out and give some feedback
     
  13. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    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
     
    m0nsky likes this.
  14. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    254
    @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?
     
  15. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Fun stuff
     
    Lex4art and m0nsky like this.
  16. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    I have some ideas to improve the RTAO denoiser so that a second pass is not necessary. It shoudln't be too expensive
     
    m0nsky likes this.
  17. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    254
    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)
     
  18. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    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
     
    m0nsky likes this.
  19. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255


    Ok should be good for what you reported @Lex4art i'll be opening the PR
     
  20. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,245
    Is this change already in the latest 2021.2 beta3?
     
  21. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    720