Search Unity

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

Resolved Unity baked GI bleeding/artefact with modular scene

Discussion in 'Global Illumination' started by Flossyahova, May 31, 2022.

  1. Flossyahova

    Flossyahova

    Joined:
    May 1, 2021
    Posts:
    3
    Hello everyone,

    I've been running in this issue, trying to find a fix myself and spending a lot of time on different forum posts without finding any solution. I have these weird bleeding/artefact effects around the edges of my modular pieces when using baked global illumination. Each modular piece (wall, ceiling, floor) is a 2x2 m plane but also some thick boxes (issue visible on both).

    Here's the set up I did for baked GI:
    -Generate lightmap UVs for all models
    -Changed all point lights to baked mode

    And here's all the potential fixes I've tried:
    -Increased indirect samples from 256 to 1024
    -Increased direct samples from 32 to 128
    -Increased lightmap padding from 2 to 20
    -Increased objects pack margin from 16 to 64
    -Increased lightmap resolution from 40 to 60
    -Changed lightmap parameters from default-low to default-high

    Here's some screenshot of a wall with multiple modular pieces displaying the issue, my lightmap settings, my object import settings and an image of one of the baked lightmaps (in order).

    Thanks for the help in advance.
    unknown (4).png
    unknown (5).png
    unknown (6).png
    unknown (7).png
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
  3. Flossyahova

    Flossyahova

    Joined:
    May 1, 2021
    Posts:
    3
    Thanks for your reply, something interesting happens, the errors seem to have disappear, obviously it's super noisy now, but maybe the issue was the filtering ?
     

    Attached Files:

  4. Flossyahova

    Flossyahova

    Joined:
    May 1, 2021
    Posts:
    3
    Hello everyone, I have found a relatively easy "fix" ( I don't really want to call it a fix, it's more a workaround but it's so easy that I might as well us that term)

    As you may have read in many other forum posts, the main cause of the problem is modular pieces. Let's take as an example two adjacent planes, when baking lights, I believe two separate calculations are being made for both of these surfaces, the issue arises here as direct and indirect bounces are computed on each surfaces individually, which results in inconsistencies ( easy to see as you rarely have artefacts on the surface but rather around edges ).

    Therefore, the logical solution would be to merge these two surfaces in your modelling software of choice and reimport it as such, but who wants to go through the trouble of going back and forth multiple times, especially when building modular environments that go through many changes !

    Well here's where Unity's ProBuilder comes in, there are two specific tools that will help us resolve this issue, " Merge objects " and " Weld vertices " (simply merging objects isn't enough, if you got two or more merged objects but their overlaid vertices/edges are not welded, their info will be stored as individual elements, part of the same object).

    So, select the objects in your scene you wish to combine into a single piece, " Probuildarize " them, click on " Merge objects " and then select all overlaid vertices and click on " Weld vertices " (all steps shown in the screenshots below).

    And there you go, you can start a new bake and everything should look good. Now, let's say you're not happy with your scene and actually want to change it's layout ? Easy, delete the old merged elements, rework your scene, apply the modifications you want and then simply repeat the process. All of this while never exiting Unity !

    probuilder : https://unity.com/features/probuilder
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      2.3 MB
      Views:
      229
    • 2.PNG
      2.PNG
      File size:
      2.4 MB
      Views:
      230
    • 3.PNG
      3.PNG
      File size:
      2.4 MB
      Views:
      227
    • 4.PNG
      4.PNG
      File size:
      2.2 MB
      Views:
      232
    • 5.PNG
      5.PNG
      File size:
      2.2 MB
      Views:
      228