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

Bug Stripe Patterns appearing in Lightmaps

Discussion in 'Global Illumination' started by Barliesque, Dec 4, 2021.

  1. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    When baking lightmaps for this scene, I'm getting stripe patterns appearing on some surfaces.
    StripedBake.jpg

    Here's a look at the actual lightmap...
    Lightmap.jpg

    I'm working in Unity 2021.1.10. I get the same result with either Progressive CPU or GPU.
    Any help would be greatly appreciated!
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Have you unwrapped the lightmap UVs yourself, or were they generated inside of Unity?
     
  3. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    The model has UV's that overlap, so Lightmap UVs are being generated in Unity. I'm using the default settings.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Does it happen if you move the model to a new scene and lightmap it on its own? (and if it does, can you share the model? I would like to investigate).

    The UVs don't look like the problem to me, they are typical inefficient Unity generated UVs, but they're not actually that bad.
     
  5. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    @AcidArrow
    Good idea testing in another scene. That didn't resolve the issue, but gave me a place to try a few things and narrow it down. ...and I've found some interesting quirks in the Progressive lightmapper, as well as a couple of workarounds.

    Firstly, here's the model with plain untextured materials.
    LightingIssue_7500_Double.jpg

    Two things to note: 1) The surfaces getting these stripes are all using a material that has Double-Sided Global Illumination enabled. 2) The model is positioned at 0,7500,0 (it's a cockpit of an airplane that's flying at high altitude)

    When I turn off Double-Sided GI on that material, the stripes disappear...
    LightingIssue_7500_Single.jpg

    When I move the model to 0,0,0 the quality of ALL the lighting improves dramatically. Turning Double-Sided GI back on with the model at this position does not bring the stripes back:

    LightingIssue_0_Double.jpg

    So, as a workaround I can position the model at 0,0,0 to light it, and then reposition at 0,7500,0 -- not ideal, of course, but workable.

    I'll post a bug report.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Ah, yes, this is the issue. It's a floating point precision issue. The precision issues start much earlier than that, but they are much subtler than what you've been seeing.
     
  7. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    Looks like the same issue as a bug that was fixed back in 2019 but found its way back in. I've submitted a bug report, so hopefully it'll be addressed again.
     
    VirtualDimension likes this.
  8. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Can you please share the case id? Thanks!
     
  9. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    KEngelstoft likes this.
  10. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    Why was this marked as resolved? If there's a resolution, it would be helpful to know where to look for that, or when it might be available. Case 1387471 is still open, so I assume this was marked resolved in error. I've changed the status back to bug, and will post here when I have word that it is resolved.
     
  11. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    307
    Hey. Case 1387471 is as you say still open. Which case are you referring to as having been marked as resolved? I don't follow.
     
  12. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    I was referring to this forum thread. I kinda overreacted though. :rolleyes:
     
  13. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
  14. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hello!

    I wanted to provide a quick update regarding this issue. We have discussed this issue internally. As correctly observed by @AcidArrow, it is caused by 32 bit floating point precision errors. This means that large scenes, and objects placed away from world origin (0,0,0) will exhibit lightmap artifacts.

    We are planning on addressing it as part of the upcoming unified baking backend work. We cannot provide the ETA, unfortunately.

    In the meanwhile, you could try the workaround which @KEngelstoft has suggested:

    I hope this helps.