Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Black objects in indirectly lit areas.

Discussion in 'Global Illumination' started by Futurerobot, Jun 19, 2015.

  1. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Sometimes while baking Baked GI, I notice objects in areas with only indirect light turn completely black. This behaviour goes mostly away when using final gather, but not always with the best results.

    My bake settings have ambient light from a procedural skybox. (though the result is the same with just a flat color). One directional light, Only baked GI, resolution of 10, indirect on 1. Non Directional lightmaps.

    Example:
    indirect_lighting_bug.jpg


    By adding a pointlight, I can bake direct light to the dark surface. But still no indirect light.
    The black wall segments are the same as the lit ones around them.
    indirect_lighting_bug_2.jpg
     
  2. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Similar problem in a different level. An area below a bridge that is only lit indirectly, except for lighting coming from behind some archways. Without final gather the result is very buggy. With final gather it gets better, but still has lots of issues. The same mesh bakes fine in other areas. Bake settings are the same as before. Only baked gi, 10 res, 1 indirect res. non-directional.

    indirect_lighting_bug_3.jpg
     
    Meltdown likes this.
  3. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Without Final Gather the a solution based on realtime GI is bilaterally upscaled and filtered to form the indirect lighting part of the baked lightmap (the other being direct and AO). If an object or parts of it don't get any lighting when they should, it's typically caused by those texels seeing mostly backfaces and being marked as invalid.

    To fix this case you should lower Backface Tolerance (see: Manual: Lightmap Parameters, LightmapParameters.backFaceTolerance).

    The problem goes away in your first case, as final gather gathers lighting from other surfaces and they are all properly lit. In the second case there are not that many properly lit surfaces in this area to gather from.
     
  4. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Hm, I only use baked GI here, but does this mean that the resolution of the realtime GI will affect a baked lightmap's indirect lighting quality when Final Gather is off?

    Also will backface tolerance help remove the artifacts I get when Final Gather is on, or is that just for the realtime GI?

    I'll definitely check the backface setting here, because all those gates are lit from behind, and the gate mesh is a mix between closed brick meshes, and a single-sided wall segment. Do you have any idea if Beast lightmapper had a similar setting, and in that case, what would be a equivalent value? This area did not experience problems in our unity 4.6 version, we're basically going through the upgrade-learning-process here. : )
     
  5. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Yes, it will. BTW when Precomputed Realtime GI is off, we rebrand the Realtime Resolution as Indirect Resolution.

    Final Gather is the last step and it gathers from the solution produced by realtime GI. So regardless if you're using realtime or baked GI -- you should make sure that the realtime solution is sensible, in your case by tweaking backface tolerance.

    Not really, as the Beast lightmapper was much more straightforward, because there was no dependency on the low resolution realtime GI solution.
     
  6. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    116
    By the way, it seems that "backface tolerance" (and maybe other properties) under "Precomputed Realtime GI" are not used when using Final Gather. Adjusting backface tolerance does not do anything while Final Gather is ticked. Is this intentional, or a bug?
     
  7. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    What do you mean by "does not do anything"? It is used during the precompute and will affect the final gather indirectly in the way I described above. If you think it's not working, please submit a bug with a repro case, if possible. Or describe it here in more detail to begin with. Thanks!
     
  8. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    116
    Ok. Yep, I mean it is not working. I added some screens below.
    The two images with Final Gather on seems very similar, even though the Backface Tolerance values are very different. Changing Backface tolerance has a pretty big effect when Final Gather is off, as can be seen in the images below.

    So, it seems there is a bug. Do you need any more info?
    Edit: Btw, this is in 5.1.2p1
    backfacetolerance.png
     
  9. essimoon2

    essimoon2

    Joined:
    Nov 13, 2013
    Posts:
    195
    I recently had the same problem but solved it by increasing the number of rays inside the Lightmap Parameters file. Doubling the count worked fine for me.