Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

White squares appearing on lightmaps

Discussion in 'Global Illumination' started by Harold_83, Dec 17, 2021.

  1. Harold_83

    Harold_83

    Joined:
    Nov 25, 2014
    Posts:
    45
    I am using Unity 2021 and I have an issue with white squares appearing on certain parts of the level. I checked the lightmaps and the white squares do not appear on the lightmaps themselves. I played with the lighting setting and settings on the mesh itself and did not change. I'm not using a render pipeline. The attached file has images of what's wrong and settings.
     

    Attached Files:

  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Try disabling filtering and rebaking so we can tell better what happens.

    My hunch is you need more samples in general.
     
  3. Harold_83

    Harold_83

    Joined:
    Nov 25, 2014
    Posts:
    45
    I disabled the filtering but it introduced blotching in the lightmaps. What's a good number without increasing bake times insanely? I've been playing with the samples and I'm getting an improvement in the lightmaps.
    .
    Thanks,
     
    Last edited: Dec 20, 2021
  4. Harold_83

    Harold_83

    Joined:
    Nov 25, 2014
    Posts:
    45
    I changed and played with all the settings increasing the samples and there was no improvement. I switched the Directional lighting to Non-Directional and that fixed the issue. I used the same settings in the previous versions of Unity and didn't have this issue.
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Can you show an image of what it looks like without the filtering?
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Oh. Hmmm, I'm not sure then, I'm not too experienced in what can go wrong with directional lightmaps.
     
  7. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    307
    If it consistently reproduces with Directional mode but doesn't with Non-Directional, I suggest filing a bug report. Sounds like a regression to me.
     
  8. Harold_83

    Harold_83

    Joined:
    Nov 25, 2014
    Posts:
    45
    This is the directional mode. Doesn't matter what other settings you use. It always looks like this.
     

    Attached Files:

  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    This is different though. This just looks to me like you need a lot more samples.

    Try:
    Direct Samples: 512
    Indirect Samples: 8192

    And then generate lighting. You might need even bigger values, but you should see a clear improvement here.
     
  10. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,866
    You must increate the indirect samples to the 10.000 or above to reduce the noise for indirect light sources(area lights, emissive materials)

    So you can use 180 degree spot lights to simulate indirect lighting (like Unreal Engine 4) to have the 10x faster baking and higher indirect shadows:



    In HDRP or URP, use my attached script to change the shadow radius in the inspector (add to the light's inspector)
     

    Attached Files:

  11. Harold_83

    Harold_83

    Joined:
    Nov 25, 2014
    Posts:
    45
    May have gotten rid of the blotching but introduced more white squares.
     

    Attached Files:

  12. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,866
    Select your mesh renderers and enable the Double Sided Global Illumination (GI) in material settings
     
  13. Tonymotion

    Tonymotion

    Joined:
    Dec 5, 2018
    Posts:
    12
    I just had this same problem with a 1-sided storefront mesh, which has several random, white, bright/highly-emissive rectangles appear on it after baking. Besides looking terrible, they created bright reflections on other objects.

    A solution I found online was to go to the model for that storefront mesh, and set it to "Generate Lightmap UVs". After doing that and running the bake again, those white patches, and the terrible light they threw, were all gone. (Here's where I found that suggestion: https://gamedev.stackexchange.com/a/116414/143471.)

    If you haven't solved this problem, hopefully this suggestion could help you, or help someone else who stumbles across your question while looking for answers, like I did. :)