Search Unity

Realtime GI: all shadows full black

Discussion in 'Global Illumination' started by Elecman, Feb 18, 2017.

  1. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,374
    I have a cockpit which is about 3.5 m wide. I only use realtime GI, realtime resolution set at 3, reflection bounces at 2, bounce boost at 2, and the rest is at the default settings.

    Without any GI it looks fine, but when realtime GI is used, all areas which are in the shadows (which is most geometry) are completely black. It seems there is no bounced lighting going on at all.

    What could be the issue?
     
  2. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,374
    Ok, I found the problem. The realtime resolution was way too low. The Unity documentation is a bit misleading when it talks about a setting of 2-3 for an indoor scene. With objects as small as in a cockpit you need a resolution of 60-120.
     
  3. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @Elecman

    Using indirect resolution of 60-120 is too much and a bit of overkill for your scene in terms of performance. Instead of increasing the value of your indirect resolution, try scaling up your models according to scene units. A resolution of 2 or 3 should very well be enough for creating the clusters. In order to debug your scene, please use scene visualization modes while authoring your lighting, especially clustering scene view in this particular case. Clustering view will show the density of clusters in your scene and based on that information, you can adjust the resolution value. Please remember that you can assign local indirect resolutions for your realtime lightmaps through lightmap parameters. You can refer to this tutorial if you want: https://unity3d.com/learn/tutorials/topics/graphics/introduction-precomputed-realtime-gi

    Thanks,
    QA Team
     
  4. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,374
    Thanks for the link. It shines a lot of light on the subject (no pun intended).

    I want to get away from the whole "just scale your object" paradigm though. This is bad for both physics and VR. But I manged to make a few more optimizations. I only set the larger panels to lightmap static now. Smaller objects like switches are only lit by lightprobes. This allows me to reduce the realtime resolution a lot more. But a value of 2-3 is still way too low. For reference, the bottom right panel has a size of about 0.14 x 0.08 x 0.02 meter.

    The panels are almost completely obstructed by the shadow from a quad on the left.There is another quad on the right which provides bounced lighting. Only the main panels and the quads are set to lightmap static. The rest is lit by lightprobes. The realtime resolution is set to 7. Note the excessive blackness of the main panels.
    GI res 7.JPG

    Below the realtime resolution is set to 20. Some panels look correct, others do not:
    GI res 20.JPG

    Increasing the realtime resolution to 22 provides a mostly correct image:
    GI res 22.JPG

    It can be optimized a bit further by setting an individual resolution for each panel. Below, the second panel from the right is set to a resolution of 1.4 (multiplier) with a scene wide resolution of 20.
    GI res 7 clustering 9.JPG

    Note that the clustering view only shows a few colored squares on the panels when the realtime resolution is set to 22. The amount of colored squares on the quads is excessive, but this can be reduced by setting the the custom resolution (lower) for those objects too. Also note that all panels show "missing" triangles. This is only visible in the clustering view. Ironically, this bug is also present in some screenshots of the tutorial, where it talks about the cluster resolution on the mountain mesh. Below is a clustering view with a realtime resolution of 22:
    clustering 20.JPG

    So I guess my question is, as long as the clustering view does not show an excessive amount of colored squares, is it still ok to set a higher realtime resolution instead of scaling the objects? Or does it still affect performance? And if it does, what is another way to solve this problem?
     
    Last edited: Mar 16, 2017
  5. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Hmm, I also have a similar cockpit with the same problems, but if I try to push the texel resolution to anything above 8, Unity literally takes hours to calculate the results... and I turn on and off some configurations in realtime, so I just don't see how that can ever work right now...

    Oh, and a resolution of 2 makes everything diffuse enough to either not show up at all, or just take a hint of the surrounding illuminating colors. A resolution above this, and really bad and misplaced artifacts start to show up...

    This is also for VR, so the scale needs to be (and currently is) correct.
     
  6. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,374
    I tried something else. I set the realtime GI resolution to 3, then I made a custom LightmapParamaters asset, copied all the values from the Default-HighResolution preset, but set the resolution to 8. Then I assigned this to the scene wide lighting settings at Lighting->Scene->General GI->Default Paramters. This also gets rid of the blackness, without having to set the objects resolution individually, and still having a low realtime resolution.

    I have yet to find out if there is any difference in performance if you just set the realtime resolution higher though. According to the documentation the resolution parameter on the Default Paramters preset is merely a multiplier for the dynamic resolution. But judging from the comment from @kemalakay, the two are not the same...
     
  7. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hi @Elecman

    That's correct. As long as you keep an eye on clustering view, using higher realtime resolution is fine. As you read in the document, it's just a multiplier.

    It's just a common mistake that people increase the realtime resolution without changing any other setting so they end up with long baking times and can easily report that there is a performance bug. However, if you know what you're doing and paying attention to units, then it should be fine.

    Thanks,
    QA Team