Search Unity

Inconsistent realtime GI results on two identical objects

Discussion in 'Global Illumination' started by dgoyette, Nov 22, 2018.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    I'm having trouble figuring out why I'm getting two very different results from Realtime GI. Here's a screenshot to demonstrate the issue:

    upload_2018-11-22_0-27-57.png

    We've got two big walls, one on the left and one on the right. Notice the obvious square on the right wall (which I outlined in blue dots). It's very noticeable. That's a separate object from the wall, but both objects are ProBuilder objects, marked as fully static, with the same material on them.

    What you don't see in this screenshot is that I've actually got an identical thing happening on the left wall. But that one blends in basically perfectly. Here's a shot of it:

    upload_2018-11-22_0-32-33.png

    Both of these "holes" are formed the same way: I added some edges to a big ProBuilder object, creating the squares. I then highlighted the two squares one at a time and separated them out to be new, independent objects. I then baked lighting.

    So what I don't understand is why I get a seamless behavior on the left wall, but a very noticeably different result on the right wall. I've tried this with and without light probes in the scene, and with different light sources. But that square on the right is always really obvious, while the left one blends in. I realize there could potentially be a lot of reasons, but maybe someone has some ideas.
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Maybe this is some quirkiness in the way ProBuilder works. If I merge the left square back in to the whole room object, then my right a square looks fine. Or if I delete the left square entirely, the right square looks fine. But in cases where the three objects exists at the same time, the lighting on the right square is wrong. Maybe it's an issue with object count?

    But I've also found that if I replace the left square with just a plain old cube (not probuilder), the right square still looks wrong.
     
  3. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Regarding your issue with the lightmaps. The issue which you are experiencing could be explained by neighboring texels extrapolating GI. However those big patches for realtime GI could have a drastically different view of the scene, which results in their darkened appearance. This is an unfortunate side-effect of how baked indirect lighting is handled, and hopefully it will be improved in the future.

    One potential way to solve your issue is to increase the Irradiance Quality and Irradiance Budget in the custom lightmap parameters. In addition, assigning the same System Tag to the adjacent modular pieces might help, but it will not guarantee that those objects will end up in the same system during clustering.

    Also, in your particular case, switching Ambient Mode to Bake might also mitigate some issues.

    Keep in mind that you might still run into issues while even while using the before-mentioned guidelines. In order to fully rectify the problem, you'd need to author your meshes differently. One solution is to avoid over-modularizing your levels, and instead rely on on larger contiguous meshes. Not only that will save you some draw calls, but will also mitigate lightmapping problems as well.

    In addition, you can use additional geometry, such as trims and props, to hide the seams between different modules.

    Apologies for not providing you with a silver bullet solution that would rectify your problem. Please understand that this is one of the limitations of how indirect lighting is calculated. We will keep on investigating this issue, and hopefully will find a solution in the future.
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Thank you very much for the detailed response. I tried out our recommendations. Higher lightmap parameter settings seemed to help a small amount, but the sharp lines were still very noticeable. Adding baked lighting, in order to set Ambient Mode to bake, didn't seem to change anything. And assigning the same tag to all objects didn't change anything.

    However, your statement "drastically different view of the scene" got me to thinking that having one very large wall that spans a whole room might be problematic. Maybe punching a whole in an otherwise unified object was the issue. So I broke the back wall into a couple of smaller objects, and the results are very good. That's maybe off, since you also said it would be good to use large meshes instead of lots of smaller once. But it seems like the single large wall, with a hole cut out of it, get lighted very differently than if that same wall is broken into a few smaller objects.

    This is somewhat non-ideal, because it makes it hard to work with that wall in the future, but this is at least a path forward. I guess realtime GI baked differently depending on whether a face is on an independent object, or whether it's connected to other faces?

    Again, thank you for the insight, and for leading me in the right direction.
     
    Last edited: Nov 22, 2018