Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Baked lightmaps are corrupted

Discussion in 'Unity 5 Pre-order Beta' started by GfK, Jan 21, 2015.

  1. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Hello

    I'm not sure if this is a bug, or something I'm doing wrong - it wasn't happening yesterday but I came to my project this morning and BOSH - broken!

    When I'm baking lightmaps, be it a point light, directional or whatever, I get artefacts everywhere, ranging from slight color variations to chronically bad areas of solid black, white, yellow etc - colors which don't even appear anywhere in the scene.

    I thought it might be to do with some objects containing normal maps which I just added, but I disabled the mesh rendered for all those objects and it didn't make any difference at all.

    I hit the 'reset' function in the Lighting window, and that didn't help either.

    Does disabling the mesh renderer take those objects "out of the loop" when baking lightmaps? I am assuming it does, but then... maybe not? Are normal maps in a scene a big no-no when baking lightmaps?

    Sorry I don't have a screenshot of the problem - had to turn my PC off before I flipped my desk.

    Oh, using Unity 5 beta 20.
    PC Spec: Windows 7, Intel i5 CPU @ 3.1GHz, 32GB RAM, Nvidia GTX970 (4GB).
     
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I've seen lightmap corruption when I had objects that had coplanar polygons overlapping.
     
    GfK likes this.
  3. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Basically, this is what I'm getting. I removed the normal maps (and the object they were applied to), so I'm pretty sure that's not the cause.
    corrupt1.png
     
  4. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Hm... you may have been right. Had another look this morning and found several coplanar polys - quite a lot actually. Each of the floor tiles has four sides, so the sides of neighbouring tiles will be coplanar. Didn't even realise I'd done that.

    [edit] Nope - not solved.
     
    Last edited: Jan 22, 2015
  5. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Stripped it back to basics. Lightmapping seems to work fine with just a plane/cube primitive. But anything more than that and it all goes pear-shaped. For instance, some surfaces facing away from the light are solid black, as is everything beyond the range of the light. It isn't as bad as it was with all the coplanar problems, but it's still far from correct.

    This is a platform made up from 5x5 tiles (single-face planes). Only the tiles with visible edges, have edges. You can see that four of the tiles have black edges, while most of the others do not. Also, everything beyond the range of the light is just solid black (ambient light is mid-grey).

    light.png
     
  6. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Just went into the lighting window, and changed Directional Mode (Under General GI) to Non-Directional - it was set to Directional for the screenshot above. The lightmap now renders correctly.

    A little worrying, still, as "Directional" seems to be the default setting.
     
  7. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    I've also found the cause of the original problem (the artefacts everywhere) - the UVs on the box were not normalized.
     
  8. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Hi! Could you please submit your scene so we can have a look at it?

    Thanks!