Search Unity

Feedback SSGI with outdoor areas and vegetation: Noise/Denoiser and performance

Discussion in 'High Definition Render Pipeline' started by PutridEx, Dec 13, 2021.

  1. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Been testing SSGI in a forest outdoor env, it's actually a good fit for outdoors!
    With full res enabled, it's much better, there's still some noise and ghosting, but it's manageable in outdoor areas.
    But performance is quite high, approx 7.3ms on a GTX 1070 with quality set to low (in outdoor open areas quality doesn't make a big difference in visuals so keeping it low is good) and that cost is a bit crazy.

    but with Full Res Disabled it goes down to approx 2.6ms! which is manageable on a GTX 1070.

    The issue is noise goes up quite a bit with full res disabled, and it'd be worse than the video since the game would be taking the entire window.

    I don't know what res is used if Full Res is disabled. Is it quarter or half?
    If the noise could be reduced with full res disabled it'd be a really big win for SSGI, and In general better denoising. In my experience SSGI isn't good for interiors, too much noise and the limitations of screen-space effects.

    But It could really be a really good fit for outdoor areas. It gives forests much better visuals imo, it looks beautiful with sky shadowing for the trees/vegetation.

    Video showing noise with all types of difference quality modes, zoom levels:


    Forest with both disabled:
    View attachment 971094

    With SSAO only (High intensity, Full Res Enabled, high quality):
    View attachment 971097

    with SSGI only:
    View attachment 971100
     
    Last edited: Dec 13, 2021
  2. Deleted User

    Deleted User

    Guest

    Don't know how these people got great results with ssgi https://mobile.twitter.com/the_f_key/status/1432852247562620936

    https://mobile.twitter.com/the_f_key/status/1432981892811395072

    https://mobile.twitter.com/the_f_key/status/1450859669572964356

    https://mobile.twitter.com/the_f_key/status/1448705523545743363

    https://mobile.twitter.com/the_f_key/status/1433002516120317952

    I really want to know from unity what they use to make it look so good... I never get such results
     
  3. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    The performance alone is just really too much to swallow for me. I wonder if it applies GI after or before DLSS...

    Even in low, SSGI performance hits really hard, and in half res, artifacts just start popping in.
     
    PutridEx likes this.
  4. Deleted User

    Deleted User

    Guest

    finally got the SSGI working great for interiors
    (first SSGI off and second SSGI on)
    Screenshot (143).png Screenshot (142).png Screenshot (145).png Screenshot (144).png
    just use a reflection probe and set your SSGI fallback to reflection probes and sky most of the artifacts and noise with moving camera is solved with that (there is still a bit of noise and artifacts but its okay for me and yes noise increases with half resolution and having more performance optimizations and yes, denoising improvements for the ssgi would be really a win) it gives more accurate and better results when reflection probe updates frequently or is realtime when there is day and night cycle but other wise one bake is enough... (above i have baked the reflection probe for each scenario)... it also removes the ugly ambient light of the sky... more screenshots coming below... need to test it for outdoors as well
     
    Last edited by a moderator: Apr 20, 2022
    PutridEx likes this.
  5. Deleted User

    Deleted User

    Guest

  6. Deleted User

    Deleted User

    Guest

  7. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    I don't recommend to use AO in conjunction with SSGI as it artificially darkens areas even more, which leads to unrealistic results.
    SSGI does the job very well and is all what you need.
     
    Last edited: Dec 17, 2021
  8. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Half.

    Depends on the version you are ON but on the latest versions SSGI use the same denoiser as the raytracing one (2 denoiser pass). It costs a little more but without it, it hardly usable so it's a trade off we had to make.
     
    Deleted User and PutridEx like this.
  9. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,670
    Yeah but in those cases i prefer to bake the lighting, at least for static objects, in those cases is better to bake
     
  10. Deleted User

    Deleted User

    Guest

    Sadly, I cannot use baking for my game!!
     
  11. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    So with the reflection probe fallback it really became a solid GI solution, even with just a single probe at camera position...

    No SSGI
    screen_1920x1080_2022-01-24_16-48-32.jpg
    SSGI
    screen_1920x1080_2022-01-24_16-49-03.jpg
    SSGI + reflection probe at camera
    screen_1920x1080_2022-01-24_16-49-18.jpg

    The result with the probe is astonishingly good, however I need fully dynamic GI and therefore I have to rely on realtime reflection probes, which tank performance alot.
    You can of course set them to On Demand and update them less frequently, but this will result in abrupt changes in lighting/reflections.

    So I came up with a two-realtime-probe setup in which I schedule and split the reflection rendering of the two probes over a couple of seconds and then smoothly blend between their results.
    The performance overhead is greatly reduced, but still offers smooth and good looking results.

    This is the script if someone is interested;
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Rendering.HighDefinition;
    3.  
    4. [ExecuteAlways]
    5. public class ReflectionProbeUpdater : MonoBehaviour
    6. {
    7.     [Range(0.1f, 60)] public float interval = 2;
    8.  
    9.     Transform[] reflectionTrans = new Transform[2];
    10.     HDAdditionalReflectionData[] reflectionData = new HDAdditionalReflectionData[2];
    11.     Transform camTrans;
    12.     float[] updateTime = new float[2];
    13.     float[] weight = new float[2];
    14.     float intervalTwo;
    15.  
    16.     void OnValidate()
    17.     {
    18.         Setup();
    19.     }
    20.  
    21.     void Start()
    22.     {
    23.         Setup();
    24.     }
    25.  
    26.     void Update()
    27.     {
    28.         weight[1] = Mathf.Abs((updateTime[0] - Time.time) / intervalTwo * 2 - 1);
    29.         weight[0] = 1 - weight[1];
    30.  
    31.         for (int i = 0; i < 2; i++)
    32.         {
    33.             reflectionData[i].weight = weight[i];
    34.             if (Time.time >= updateTime[i])
    35.             {
    36.                 updateTime[i] += intervalTwo;
    37.                 reflectionTrans[i].position = camTrans.position;
    38.                 reflectionData[i].RequestRenderNextUpdate();
    39.             }
    40.         }
    41.     }
    42.  
    43.     void Setup()
    44.     {
    45.         for (int i = 0; i < 2; i++)
    46.         {
    47.             reflectionTrans[i] = transform.GetChild(i).GetComponent<Transform>();
    48.             reflectionData[i] = transform.GetChild(i).GetComponent<HDAdditionalReflectionData>();
    49.         }
    50.      
    51.         camTrans = Camera.main.transform;
    52.         updateTime[0] = Time.time;
    53.         updateTime[1] = updateTime[0] + interval;
    54.         intervalTwo = interval * 2;
    55.     }
    56. }
    Just create an empty object, add two realtime reflection probes (set to On Demand) as childs and add the script to the empty.

    EDIT
    Changed the probe blending calculation to be linear instead of using Mathf.Sin, should be significantly faster now.
     
    Last edited: Mar 29, 2022
  12. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Another shot in a shadowed forest, this really shines...

    No SSGI
    screen_1920x1080_2022-01-24_20-19-31.jpg
    SSGI
    screen_1920x1080_2022-01-24_20-19-55.jpg
    SSGI + reflection probe at camera
    screen_1920x1080_2022-01-24_20-20-20.jpg

    Hopefully the time slicing support for realtime reflection probes comes asap, so we can hope for way better performance.
    Even though my solution renders the probes just every few seconds, it still renders the complete probe in a single frame, so time slicing will be a game changer here.
     
    Gooren, mahdisml, NotaNaN and 3 others like this.
  13. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    great stuff! SSGI feels great for outdoors/vegetation with reflection probes.
    HDRP might also get realtime time slicing which would help a lot with performance.
    [HDRP] Add time slicing to realtime reflection probes by simonb-unity · Pull Request #6661 · Unity-Technologies/Graphics (github.com)
     
  14. Deleted User

    Deleted User

    Guest

    SSGI really helps in adding depth and realism to the scene... no baking here just one realtime reflection probe and SSGI... there are a bit artifacts and some nosie on the character while moving in indoor scenes but i am finding ways to reduce it... Currently TAA does help in reducing the noise but there is a bit of smudging caused by it.... I really want unity to add a complete realtime GI solution soon... i feel that even if the realtime GI isn't much accurate or not that good SSGI can really make it look better and accurate and in return it would also stabilize the SSGI output
    Screenshot (173).png
    Screenshot (172).png
    Screenshot (170).png
    Screenshot (169).png
     
  15. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255

    Happy to see that the SSGI + reflection probe trick works for you :p
     
  16. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,670
    don´t take me wrong but i think you can make those renders looks better
     
  17. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,670
    can you please show us a video? in this case is better to see a video
     
  18. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Make it better in what way?
    It's of course all hackery with just a realtime reflection probe at camera and it's not going to look as correct as with loads of probes scattered across the scene.
    But it's good enough for mostly open areas and still OK for indoors.
    It's always a tradeoff between quality and performance.
     
  19. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    I think he is referring to the vegetation sticking out like a sore thumb...kind of looks weird...maybe the subsurface scattering is too strong...

    the three components all play separate

    sky, trees and river+rocks. It feels like it was copy pasted from 3 different pictures. I can't really put my finger on it but something is off.

    But that is more scene composition rather than GI+RP...so maybe irrelevant.
     
    Last edited: Jan 27, 2022
    impheris likes this.
  20. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,670
    Yeah little but at the same time big details, the 3 screens looks very flat.
    Try to change the lighting and shadows without post effects to achieve more contrast because it looks very flat, mostly in the area of the leaves.

    It looks off because you can see the bright sky, but then 70% of the image is very dark.

    Find the image's brightest point in the sky, now, look the reflection of that area in the river, is way too dark and it needs to be at the same value (or at least 90% closer if you are shy with the idea xD)
    I also think the SSGI is making a "decent" job but not entirely well done (in my opinion) maybe it works for interiors but for me, in fact, the "No SSGI" screenshot looks better jaja

    Edited: i uploaded 2 examples
     

    Attached Files:

    • hh.jpg
      hh.jpg
      File size:
      3.1 MB
      Views:
      463
    • 2.jpg
      2.jpg
      File size:
      889.5 KB
      Views:
      428
    Last edited: Jan 28, 2022
  21. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Well the overall dark look comes from the custom tonemapping I'm using, it makes quite a big difference compared to other modes.

    Custom
    screen_1920x1080_2022-01-28_02-43-41.jpg
    Neutral
    screen_1920x1080_2022-01-28_02-44-40.jpg
    ACES
    screen_1920x1080_2022-01-28_02-44-58.jpg


    Regarding the reflections;
    Well the reflectivity highly depends on the view angle to the water surface ofc, in your images it's a very shallow angle, so the reflections are stronger.
    And due to the fact that the reflections are captured at the camera position, they are not correctly represented at the waters surface position (infact no-where except at the cameras origin only).
    As I said earlier it's all hackery with the current probe setup.
     
  22. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,670
    yeah, ACES one looks really good in my opinion
     
  23. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    I think in this scene the custom one looks better than ACE...it is probably not what you intended but in the open (first image), it shouldn't be that dark but inside the forest(2nd image you posted) it should be that dark...maybe use the local volume and enable custom when in deep forest and just ACE as global.

    GI should be doing all this but I guess SS has its limitations.

    Why don't you bake GI and see comparisons? Could serve as a physically correct comparison to work towards.

    Looking back your SSGI +RP looks great compared to neutral...the only question is can you handle that many RP even if it is prebaked...or are you using realtime or SSR?
     
    Deleted User likes this.
  24. Deleted User

    Deleted User

    Guest

    https://github.com/Unity-Technologies/Graphics/pull/4886
    Looks quite similar to the pathtraced output aswell
     
  25. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    I'm not a fan of local volumes everywhere and always aim for a generalized solution.
    My custom tone mapping can handle huge light intensity differences way better (less under/over-exposing), but results in an overall darker image, more on that here;
    https://forum.unity.com/threads/exp...y-bright-and-dark-areas.1208596/#post-7717207
    ACES often looks too oversaturated and leads to color shifts.

    I'm forced to use realtime reflection probes for a fully dynamic scene and lighting setup, so baking is no option.
    Having more realtime probes is not plausible until the time slicing feature arrives, it's performance overhead is just too big right now.
    SSR is also used to kinda hide the incorrect reflection results of the probes (which are at camera position as I explained earlier).
     
    PutridEx likes this.
  26. AydinDeveloper

    AydinDeveloper

    Joined:
    Sep 8, 2017
    Posts:
    92
    I have forwarded the SSGI Half res fix to the developers. Although the ray result is the same as Full res. Whiteness continues to occur in the denoise filter.


    For Denoise quality, I set the CubemapLOD to 3 in the SSGI shader. so the reflection probe calculates with low smooth. I get better denoise performance as the high frequency is reduced.

    Denoise is almost perfect when used with ProbeVolumes. but using it with Reflection probe gives much sharper shadows

    Reflection probe + SSGI (my local changes)
    https://cdn.discordapp.com/attachments/725360382155292702/934861281490518026/movie_226.mp4
     
  27. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    An arbitraty level 3 mip offset is really really bad as it doesn't take into account the original resolution of the cubmap and doesn't scale at all for high complexity environements.

    That said even if you take a higher mip level, It cannot impact the denoiser performance in any mean, it may reduce the cost of the tracing, but that remains marginal unless you have high resolution reflection probes.

    I don't know to who you sent the fix, but I developed the SSGI feature and I didn't receive anything.
     
    AydinDeveloper and PutridEx like this.
  28. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    Hey mate, if you made the SSGI, can I ask you for one small feature?

    Can you add a intensity slider to the SSGI so that I can ramp up indirect without having to change all indirect? It is painful to reverse match lighting to SSGI and SSGI's quality also impacts it...makes it virtually impossible to have a consistent look for every quality level. Also I do want to have some artistic freedom there as well...
     
    Deleted User likes this.
  29. AydinDeveloper

    AydinDeveloper

    Joined:
    Sep 8, 2017
    Posts:
    92

    I reported it to someone else on the HDRP team. He said he would send it to you. Anyway, it's a simple fix.

    While half res, GetBNDSequenceSample continued to be calculated according to full res UV.

    newSample.x = GetBNDSequenceSample(currentCoord.xy, _IndirectDiffuseFrameIndex, 0);
    newSample.y = GetBNDSequenceSample(currentCoord.xy, _IndirectDiffuseFrameIndex, 1);


    newSample.x = GetBNDSequenceSample(inputCoord.xy, _IndirectDiffuseFrameIndex, 0);
    newSample.y = GetBNDSequenceSample(inputCoord.xy, _IndirectDiffuseFrameIndex, 1);


    SSGI Full Resolution
    image_546_0240.jpg

    SSGI Half Resolution

    image_547_0240.jpg

    SSGI Half Resolution Fix
    image_548_0240.jpg
     
    blueivy likes this.
  30. AydinDeveloper

    AydinDeveloper

    Joined:
    Sep 8, 2017
    Posts:
    92
    @auzaiffe

    The work you do at SSGI is great. Much better quality than other SS effects of HDRP, for example SSR still does not have a proper Temporal filter!!!!

    Can you extra blur the unaccumulated areas for SSGI?

    I'm also wondering why _RaytracingFrameIndex and _IndirectDiffuseFrameIndex are in a constant loop. SSR uses _FrameCount. SSGI, RTGI, RTAO are constantly looping through 8 different sample positions. a fixed pattern is formed. In my local package I make this number 128. resulting in better denoise due to accumulation. Of course, after the camera movement, there is a lot of noise in the unaccumulated areas.
     
    Last edited: Jan 29, 2022
    Deleted User likes this.
  31. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Indeed, i've noticed this issue before never took the time to fix it. Good catch.
     
  32. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    What do you mean by "in a constant loop" _IndirectDiffuseFrameIndex and _RaytracingFrameIndex are looping over a per effect defined range. Note that above 16 the ghosting is significantly higher
    upload_2022-1-31_11-4-34.png
     
    AydinDeveloper likes this.
  33. AydinDeveloper

    AydinDeveloper

    Joined:
    Sep 8, 2017
    Posts:
    92
    I am not increasing accumulation. just more random positions. I did not change the temporal denoise shaders. they are still accumulating by 8 samples. I just think it looks better than the fixed pattern.
     
  34. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    can you share the custom tonemapping values you used for the first image
     
  35. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    PutridEx likes this.
  36. Matjio

    Matjio

    Unity Technologies

    Joined:
    Dec 1, 2014
    Posts:
    108
    Also for real-time reflection probes, use custom frame settings on your probes to disable as many features as possible without impacting too much the reflection quality in your scene. You can save quite a lot with that in some cases.
     
  37. Matjio

    Matjio

    Unity Technologies

    Joined:
    Dec 1, 2014
    Posts:
    108
  38. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Hey—I've been using this for the past month, it looks great! Thanks so much for sharing.

    I've been getting the problem highlighted in this thread:https://forum.unity.com/threads/hdprobe-requestrendernextupdate-flash.1109414/

    Basically, every time a rerender is requested from one of the probes, the screen (especially the shadows) will 'flash' black, which is pretty bad-looking.

    Do you (or anyone else reading) know a way around this? Change the Visual Environment override's Ambient Mode to static does fix it, but ofc that has a pretty broad and undesirable impact itself.
     
  39. AydinDeveloper

    AydinDeveloper

    Joined:
    Sep 8, 2017
    Posts:
    92
    Use Ray tracing denoise shader instead of SSR Accumulation. Accumulation is not usable in any way. new options. I was trying even before it was merged with master. I had high hopes but only when the camera is stationary it blocks the ghosting of moving objects.

    https://forum.unity.com/threads/ssr-pbr-accumulation-half-resolution-tracer-and-denoising.1251112/
     
  40. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    I'm not experiencing such an issue, did you try to reproduce it in a new project? It might be project, or system related.
    Better file a bug then.
     
    gewl likes this.
  41. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    339
    To reproduce this issue you must have a dynamic rotating directional light as sun light and set ambient lighting to "Dynamic" and have the PBSky as your background.
    so when you update the reflection probe,all object with this reflection probe will fallback to globe reflection probe first then jump back to the reflection probe you updated.
    if the directional light is not rotating you won't have any issue.
     
    gewl likes this.
  42. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
    Update your PBS at a slower rate from the component settings near the bottom

    This is just the probes trying to update instantly per frame, rather than anything with sebs code by the looks of it
     
  43. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    That hasn't been my experience, I'm able to reproduce this no matter what the update frequency is (using the ReflectionProbeUpdater that seb posted).
     
  44. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    I'm still not able to reproduce it.
    The probe blending system I posted isn't even displaying the specific probe result after calling RequestRenderNextUpdate (blending contribution is 0 then), so you wont even see those "flashes" (atleast not from the probe itself).
    The Issue must be something else.
     
  45. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Yeah, I've been getting the flashing even when I lock blending contribution to 0 from the render request frame through to when the rerender is complete, so the override seems to be independent of what the probe's actual contribution is. TBC, I don't think your reflection probe blending is the culprit, was just curious if you'd encountered it/found a way to mitigate.

    Will work on getting repro for whatever it is when I have some time!
     
  46. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    339
    I forgot to mention, in my test, the sunlight rotates 10 times per second , the reflection probe is updated 1 time per second.
    i guess most people are using more aggressive update rate for day night cycles.
    another thing i forgot to mention is you won't have the test successful if your reflection probe is in an open space, because the reflection probe is too similar to the globe reflection probe.
    it's easier to find it out if your reflection probe is slightly different from the globe reflection probe.
     
  47. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
    interesting input, I just checked out logs, at one point we had 3 seconds most other times its real-time and a different double probe set up with no flashing.

    our systems programmers also stated that it seemed to be affected by the Dynamic probe, but I hadn't seen the same situation and similarly to @SebLazyWizard I couldn't reproduce it in general.

    however, we did have a similar situation once before when using PBS with full-screen post effect ( see attached)

    @gewl
    The only other thing I can think of is another full-screen post-process that might be conflicting, like chromatic aberration.
     

    Attached Files:

    LumaPxxx likes this.
  48. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,813
    Probably set the resolution really high? I do that too for screenshots.

    Anyway, I do love the SSGI, it's great, I'm making videos with it now.


     
  49. Blade_Master_2020

    Blade_Master_2020

    Joined:
    Aug 3, 2019
    Posts:
    38
  50. Deleted User

    Deleted User

    Guest

    In 2022.2 version its there by default
     
    mahdisml likes this.