Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity [2020.1] New Feature - Russian Roulette and Sampling Improvements

Discussion in 'Global Illumination' started by kristijonas_unity, Mar 2, 2020.

  1. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    487
    ETR05-RR0vsRR2.gif
    Notice that when using Russian Roulette optimization, the output is almost identical. Yet the bake time is much faster.

    Overview
    These features were developed by Arthur Dufay (@ADufay).

    Russian roulette
    During the bake, we launch rays in the scene that bounce on the surfaces, creating a light path. This is a fundamental step for GI calculation. The more the ray bounces, the longer the path, and the more this said path is compute expensive. One cannot rely on the fact that a path will end by not intersecting any geometry. This is especially true in indoor scenes, so at some point the lightmapper needs to end the path. There are two ways of doing this: by setting a max bounce count, or in a random way by using Russian Roulette.

    Russian Roulette method takes into the account how meaningful the path is to the GI. The chances of a path ending early increases each time it bounces on a dark surface. This reduces the total bake times. Bright surfaces have an opposite effect, as they increase the importance of a path. This in turn increases the bake times.

    Note that Russian Roulette is not a noise reduction method. Aggressive Russian Roulette values will likely introduce noise in the lightmaps.

    Improved sampling
    We implemented a better decorrelation method for CPU and GPU lightmappers. This results in results in better lightmap convergence and less artifacts.

    Also, we have increased the sample count limits from 100.000 to one billion samples.

    Setup instructions

    LightingSettings.png

    You can find Russian Roulette option in the Lighting Settings window. Choose the value appropriate for your use case, and you are good to go. This option is available for both CPU and GPU lightmappers.

    Decorrelation improvements are active by default, and do not need any user input.

    Feature access & feedback
    You can get access to the feature by downloading the latest 2020.1 and 2020.2 alpha builds via the Unity Hub, or via this link - https://unity3d.com/alpha/2020.1a#downloads. We are looking forward to hearing your feedback!
     
    Last edited: Mar 13, 2020
  2. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    996
    Thank you sir for speed improvements
     
    BATTLEKOT likes this.
  3. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    212
    BATTLEKOT and kristijonas_unity like this.
  4. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    829
    So, in practice, this technique is reducing samples on low light zones, killing rays earlier.
    Could we have the opposite feature?
    INCREASE sample count the darker it gets?
    (or DECREASE sample count on lighter surfaces)

    I always have grainy lightmaps on zones of low indirect light and that forces me to push sample count to astronomical levels globally, when I would only need it on low indirect light zones.
    I'm talking horror games here ;)
     
  5. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    487
    Adaptive sampling feature will do just that. We are working on it.
     
  6. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    49
    Is there any benefit to allowing more than 4 bounces for rays? We work primarily with indoor scenes lit up by reflected sunlight (ie. no extra indoor lighting). 4 seems a bit low, but it's naturally hard to tell without being able to test higher values.
     
  7. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,181
    Bakery plugin allows 5 bounces and I can see better/more realistic results than rendered with 4 bounces.
     
  8. ADufay

    ADufay

    Unity Technologies

    Joined:
    Jan 2, 2020
    Posts:
    16
    Hello there !
    A bounce unlock has been added to both CPU and GPU Lightmappers, in 2020.2. You will be able to set up to 100 bounces.
    But, be careful with this, more than 10 bounces is not recommended since it can take a while to compute a 100 bounce light path.

    Note also that transparent materials aren't restricted to this 4/100 bounce limit (depending on unity version before or after 2020.2).

    Cheers
     
    Kleptine and Cascho01 like this.
unityunity