Search Unity

Baked lightmap inconsistency between different PCs

Discussion in 'Global Illumination' started by DanjelRicci, May 17, 2018.

  1. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    We are working with three Windows PCs and a Macbook on our project.

    If I recall correctly, after upgrading from 2017.3.1p4 to 2017.4.3f1 (), we found that lightmaps of two scenes looked fine on two PCs, but had scrambled textures on the other two computers, only on a bunch of objects (simple Static prefabs with a Mesh Filter and a Mesh Renderer). Everything still fine on the other scenes. We usually bake lightmaps from a single PC (not the Macbook), and use Collab to sync the project on all the machines.

    We tried to clear both the GI cache and the Baked Data of those two scenes, on every pc, and launched the bake again for the two maps. Unfortunately, everything was identical to before, the same GameObjects had the same glitches on the same PCs. I guess there is some kind of metadata not clearing?

    It's worth saying that before updating everything was totally fine and all baked lightmaps were 100% correct, (we always set Static flags and Generate Lightmap UVs). The images below are from the same spot on the same identical scene, same Baked Data, but on two different PCs.

    EDIT: tried to manually delete the Scene folder with the baked data and reverting my version the the last Collab push by the machine that baked the scene; same identical problem. :-/


     
    Last edited: May 17, 2018
  2. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    Found a very cheap solution for now. So we have these four computers, let's call them A, B, C and D. If I bake on A or B, the lightmap appears glitched on C and D only. But if I bake on C or D, the lightmap is glitched on A and B only.
    Since we care mostly about computers C and D (one of them is used for final builds), we will use them for baking and ignore the problem on A and B (they are kind of support-only computers).
    I suppose this problem is linked to cache or metadata files? It's quite weird that it has different behaviors on alternate computers.
     
  3. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Relaying an internal question:
    "It would be interesting to know if the corners are different objects or part of one big door frame object.
    also, a screenshot of the charting and UV overlap views would help."​
     
  4. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    Yes, the corners are different objects; the whole door frame is made up of individual prefab tiles. The door itself is not a prefab though. Other objects in different parts of the scene have the same problem, anyways.

    I have some trouble in providing you screenshots. The UV Charts view option under Baked Global Illumination is grayed out, and selecting Light Overlap shows really nothing more than the scene as it is... This happens on all four machines (even the one which baked the scene).
     
  5. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    The fact that Light Overlap shows the scene as it is is good: it means there is no light overlap. What my colleague in the lighting team is interested in is UV Overlap. It might be that another object is being baked in texels on the lightmap which bleed onto the texels for the door corners.

    More information on these two scene modes at the end of this page: https://docs.unity3d.com/Manual/GIVis.html

    So my guess is there is some UV Overlap in the lightmaps. Why is it only on some of the computers… not sure. So first check the UV Overlap scene debug mode, then you can take a look at the same mode in the Lighting Settings Panel > Object Maps > UV Overlap. If you select the frame GameObject, it will be highlighted in the lightmap. Then you will be able to see if the bake is overlapping because the little UV islands are too near.

    To fix that, I'm afraid you need to bake again.
    Go to the 3D model's import settings, under Generate Lightmap UVs, expand the submenu and set the Pack Margin to something higher, then rebake (maybe using Prioritize Scene View to quickly test the culprit objects).
     
  6. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    Ok, understood now. But there are no UV Overlap views in the scene debug or object maps (that's why I was talking about UV Charts, sorry). Are these from Unity 2018 maybe?


     
  7. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Yeah, just saw this in another document by chance :D
    UV Overlap debug mode is a feature from 2018.1 (and quite handy too!). But I trust the problem might be there, so my fix should be applicable... let me know!
     
    DanjelRicci likes this.
  8. whdinasor

    whdinasor

    Joined:
    Jan 14, 2014
    Posts:
    2
    Hello, I have the similar problem today.
    Maybe you can try to uncheck "Generate Lightmap UV" and recheck it again on PC A and B or PC C and D. It worked for me. Just wish can help you. Good luck!
     
    Jenzo83 likes this.
  9. Jenzo83

    Jenzo83

    Joined:
    Oct 22, 2013
    Posts:
    35
    Thanks!
    It worked for me as well. Annoying problem though!
     
  10. Gnistregn

    Gnistregn

    Joined:
    Jun 7, 2018
    Posts:
    3
    I had the same problem too. I generated lightmap UVs (Unity's built-in) and lightmaps on a PC, which looked all messed up when opened on a Mac. I solved it by regenerating all the lightmap UV's on the Mac. The existing lightmaps looked fine after that.
     
  11. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Hi,

    Would you mind sending a screenshot of the baked lightmap with the UV overlay on it, both for the faulty and the correct one? You can view your lightmaps in the Lighting Settings panel, under one of the tabs there. It might be a known bug that we have fixed, but I just wanna make sure that is the case. Otherwise we might need you to file a bug.
    Also, if you have the time, maybe download a later version 18.x and see if the problem is still there. I know it's not something one does for fun, but might be worth a shot.

    Thanks!

    / Jennifer
    Lighting team
     
  12. CerebralFrost

    CerebralFrost

    Joined:
    Mar 28, 2017
    Posts:
    12
    Hi Jennifer,

    I'm seeing something similar - using Unity 2017.4.1f1. Baking lights on one computer, checking in the baked data to source control (perforce in this case), and then syncing to the repo from another computer results in broken lights.

    In the following screencaps, this scene was baked using only realtime global illumination, and it seems that somehow the UVs are messed up. For this mesh Generate Lightmap UVs is enabled, and was checked into the repo in a separate checkin (well before the bake was done).

    The result is similar for baked global illumination:

    Computer 1 (PC - this is the machine that did the bake and checked in the lighting data assets)
    Capture1.PNG

    Computer 2 (PC - this is the build machine that makes our final builds)
    Capture2.PNG

    [Edit] : the fix proposed by whdinasor does seem to fix the issue - at least temporarily (not sure if another bake -> checkin -> checkout would cause it to break again)
     
  13. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    176
    I have this issue on Unity 2020.3.8. Lightmaps built on my PC have issues when transferred via SVN to my Mac. When you check the lightmap uv's you can see they are different, even though the exact same settings have been used on both machines to generate the uv's.

    Clicking regenerate uv checkbox on and off does not fix the problem. In fact so far absolutely nothing I have tried fixes the problem. There are not uv overlaps at play either - it is just complete inconsistency in uv generation from one machine to another.
     
    sampenguin likes this.
  14. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    328
    Hey there. This sounds like a bug to me, and I suggest filing a bug report, if possible. If the project is too big, perhaps you could reproduce it with just a few problematic meshes, and list the specs for the differing machines?
     
  15. sampenguin

    sampenguin

    Joined:
    Feb 1, 2011
    Posts:
    64
    I'm seeing this problem (or a similar problem) still in Unity 2021.3.5f1, between Windows and Mac machines via git. Very simple lighting, just 2 direct lights, one with shadows, built in rendering. Windows machine renders correctly... Mac machine renders several meshes all black... unless I turn off shadows on the direct light.

    In my case this is happening on ProBuilder meshes if that matters.

    I also can make the issue go away if I turn off "Receive Shadows" on the Mesh Renderer component... although of course then I won't see the shadows I want on the mesh, so that's not a solution. So there's some kind of shadow setting that's not getting saved/persisted across to the Mac machine.

    I've also tried direct copy of the entire project (minus the Library and UserSettings folders) from the Windows machine to the Mac machine instead of going through git just to make sure I'm not accidentally ignoring something, but the problem still exists this way too.

    Curious if anyone ever figured out a solution/workaround or has any ideas on what to poke at?
     
    Last edited: Jun 6, 2023
  16. Arriken

    Arriken

    Joined:
    Oct 11, 2019
    Posts:
    3
    Just had this issue myself and it turned out to be a Mesh Import issue, at some point my version had changed when the remote files were correct. However, I could not revert or reconcile my files to get the correct settings.

    In the end I changed my mesh import settings for the meshes whose lightmaps were broken:
    Mesh Import Settings -> Lightmap UV Settings -> Margin Method -> Calculate (was Manual)


    After applying this fixed my broken meshes, but curiously when submitting the fixed files to our repo the changes did not affect other machines.

    Another colleague is having a similar issue but these steps did not fix his lightmaps, so something else must be causing that but hopefully these steps may help others.