Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

GameObject lightmap keeps on having black spots.

Discussion in 'Global Illumination' started by Serge144, Nov 23, 2021.

  1. Serge144

    Serge144

    Joined:
    Oct 2, 2018
    Posts:
    54
    I have tried everything. I cleaned the object itself of unecessary vertices. I re-mapped the entire UV. Increased texture size, but still, when I lightmap this scene it ALWAYS puts weird black spots onto this object, specially on the stairs.

    Here is the GameObject:
    GameObject.jpg

    The UV Lightmap
    TheUVmapping.jpg

    The Lightmapping settings:
    Lightmap Settings.jpg

    No Overlaps:
    NoOverlaps2.jpg
    also, in the Unity's Overlap warning message on the Console, it only says that there are 4 overlaps but NONE are about this GameObject that I am showing to you.

    The actual lightmap:
    TheLightmap.jpg

    Model import settings:

    Generate Lightmap UV'S: Checked

    How can i fix this?
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    763
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    8,728
    Can you post these settings? It seems like you have a really high padding value here, which isn't helping at all.
     
  4. Serge144

    Serge144

    Joined:
    Oct 2, 2018
    Posts:
    54
    Yes, here it is, thank you.
    model settings.jpg
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    8,728
    Change the Min Lightmap resolution there to 12.

    Also in you general lightmap settings raise your Max lightmap size to 1024.

    But you also seem to have open backfaces. You need to either set some materials as double sided, or as a test for the time being, set new lightmap paramaters (on the general lighting setings) and on those set backface tolerance all the way to 0.

    After doing all the above, the results should improve quite a bit. Please post them so we can see what issues remain.
     
    Serge144 likes this.
  6. Serge144

    Serge144

    Joined:
    Oct 2, 2018
    Posts:
    54
    result.jpg
    it did improve quite a bit, thank you. And yes, this GameObject has open backfaces at the bottom, did not know that could be an issue for lightmapping. Previously I also tried to improve the lightmap UV's manually by scaling up the faces of the mesh in the UV and organize it a bit better (and thus disabling Unity's lightmap UV generation) which did improve quite a bit as well. I guess I still need to study more about the "Lightmap UV settings"
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    8,728
    The problems is when other texels see the open faces they assume they are inside a wall or something, so Unity goes all "these lightmap values are garbage, filter them out", which does help avoid really dark pixels around intersecting geometry, but if you are not aware of it, it can (and has) cause a lot of confusion.
     
  8. Serge144

    Serge144

    Joined:
    Oct 2, 2018
    Posts:
    54
    by the way, by increasing the Max lightmpap size to 1024, the total lightmaps size is now 84Mb, is that alot or small for Mobile game?
     
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    8,728
    It's not little. You could either compress the lightmaps, or reduce lightmap resolution on the bigger meshes so you have less lightmaps.
     
    Serge144 likes this.
unityunity