Search Unity

Strange lighting error in baked lightmap

Discussion in 'Global Illumination' started by AndersMalmgren, May 16, 2018.

  1. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Hey guys, this artifact looks like the one you get when you have a missing reflection probe and the material uses the skybox instead, but as you can see they use the same reflection probe

    upload_2018-5-16_16-11-16.png

    upload_2018-5-16_16-11-29.png


    Whats going on?
     
    iamthwee likes this.
  2. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    So I havent been able to fix this, any ideas?

    Anyother problem which is not completly related is that the mesh uses a lower prio probe even though the higher prio probe completely surrounds the mesh, as you can see here it applies 0.07 from the ourdoor reflection probe

     
    iamthwee likes this.
  3. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    @SpiriTx @Joachim_Ante

    I know you guys lurk in this part of the forum so I hope its ok I ping you directly. I have huge problem with this scene

    As you can see above the tiles missmatch

    Here is a example with huge difference, same mesh, same material, same reflection probes

    upload_2018-6-3_21-49-0.png

    The mesh is configured for lightmaps using the UV2 generation function
    upload_2018-6-3_21-50-13.png

    Material
    upload_2018-6-3_21-51-56.png

    Light settings
    upload_2018-6-3_21-53-57.png

    So, I really need help with this, thanks.
     
  4. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Hey @frosted I reply here instead, better than kidnapping the other thread.

    Thanks, will look into it further, but if it was a res problem it would be for all tiles I guess? Here it loos fine, same meshes used btw

    upload_2018-6-5_19-47-46.png

    This is at the default 40 res, we have other scenes with similar size with no problems. I'm at a loss

    edit: There is a seam problem in above screen though, but that can be fixed with baking the tiles, a bit sad Unity cant handle that for us
     
  5. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    @frosted I tested your resolution theory, here I bake at 100 res, problem remains

    upload_2018-6-6_21-57-45.png
     
  6. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Did you check the import/lightmapping settings on the mesh (from the mesh import, not scene instance).

    Also - object lightmap scale in scene instance.
     
  7. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Yeah 1.0 scale, uv2 generate, mesh import settings above btw
     
  8. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Did you ever fix this?

    Here's some ideas.

    Try another vanilla scene with nothing except one tile with one material, no specular maps and one directional/point light to illuminate the scene.

    Step repeat those tiles across to cover say cover 10 / 20 tiles - no light probes no reflection probes.

    Do a bake with same settings you have now? Is there a problem.

    Some daft questions... that seem obvious but always catch people.

    Are those tiles perfectly aligned and exactly the same colour/material?
     
    AndersMalmgren likes this.
  9. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    The last picture from above is from a isolated scene, problem remains but the color shifting is different.
    I will try your idea.

    Yeah, same mesh and material, yeah, aligned perfect to whole meters
     
  10. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    I did a quick test, with tiles and the only thing I could see to cause the inconsistent colors was moving the reflection probe? Enlighten settings set really low at about 2 to show it isn't a resolution problem

    What do you think?

    0VYSM4Pt52.gif

    If that doesn't work maybe you could wetransfer the scene and I could have a peak.
     
  11. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    The only other thing as mentioned by frosted is having an insufficient lightmap res.

    ff.jpg

    I mean here, I had to set the lightmap size to something really small like 32 and lightmap res to '2' to even notice the edges.

    But then my scene is much smaller than yours, comparatively it might be the same.

    Another daft, question but is there any reason you are working in that modular tiling way, and not just making a single plane for the floor?

    :p
     
  12. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I tried at 100 res, no difference

    Its a modular asset, I guess I could combine them with Meshbaker, but its not a perfect workflow and some negative aspects like lower resolution lightmap per mesh and occlusion will not be as good etc.
     
  13. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Btw, I also tried the built in cubes and they work like they should, no color missmatch so I lean towards something with the mesh, but I use uv2 generation in Unity so cant really understand what it could be

     
  14. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Right OK so replace the tile you are using with a single plane from unity and see if you still get colour problems.

    Gameobject > 3d Object > plane

    Then step and repeat in your scene. Make sure to hide your existing tiles by turning them off in the inspector window.

    That will prove if it is your tile that is the problem then as opposed to anything else.
     
  15. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I removed all reflection probes also added some new floor tiles to the right.

    No change to the old part of the scene, but the new tiles dont get the problem. It only has one light on it, can it be related to multiple lights? will test

    upload_2018-6-7_21-7-53.png
     
  16. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Let's not jump ahead so quickly, keep one variable fixed so we know exactly what's the problem.

    So the new tile doesn't show this problem right?

    Now fill the rest of the scene with all these new tiles keeping the lights exactly the same and report back with your findings.

    (And to clarify this new tile is just the standard unity plane with a single texture on it)
     
  17. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    how you getting on buddy?
     
  18. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
  19. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Sorry, missed your reply somehow. I'm at boring dayjob will need to play more with this tonight, Though about replacing it all with default material keep everything else and see if problem remains.

    Thats not the standard plane thats the same tiles that show the problem inside the hangar. I tried the standard plane inside the hangar didnt show any problem.
     
  20. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Well if it is the plane / meshes, you can send it to me and I can uv unwrap it properly then send it back FYI.
     
    AndersMalmgren likes this.
  21. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Thanks, I'll keep you posted. Strange thing is we got alot of Unity generated uv2s in our game that does work.
     
  22. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    No lights, no reflection probe

    upload_2018-6-8_22-3-37.png

    Next test will be default material only
     
  23. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Default material no lights, no reflection probes

    upload_2018-6-8_22-10-55.png


    hmm, it seems it syncs with the system debugger view, but not sure

    upload_2018-6-8_22-13-36.png

    upload_2018-6-8_22-13-57.png


    Some input from Unity would be very, very welcomed, thanks
     
    Last edited: Jun 8, 2018
  24. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Are you using a default plane for the tiles. . . If you are then the next test, is to remove all point/area lights and light the entire scene with just one directional light.

    After you've done this post back with your results.
     
  25. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    This time around its the mesh from the asset, give me a sec
     
    iamthwee likes this.
  26. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Dude, we're trying to figure out if it is the mesh that is at fault here LOL.
     
  27. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    This is interesting, I changed the uv2 on the windows (red arrow), cleared cache and rebaked, now the missmatch moved

    upload_2018-6-8_22-31-42.png

    System view
    upload_2018-6-8_22-31-57.png
     
  28. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Stick with the plan otherwise you're just punching in the dark, hide all existing tiles and replace with unity's standard plane.
     
  29. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Default plane

    upload_2018-6-8_22-45-24.png

    Im pretty convinced this is a bug with the lightmap systems

    upload_2018-6-8_22-45-53.png
     
  30. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    OK and there is no reflection or light probes in the scene right.

    So now please deselect all point/area lights and light the scene with only one directional light and post back with your results.
     
  31. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    There is no lights or reflection probes in the scene
     
  32. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Just sent you pm.
     
  33. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Isnt this really strange, I baked with 4096 lightmap size, it ended up with one lightmap. But in the systems view I end up with alot of systems

    upload_2018-6-9_22-10-43.png

    And offcourse color missmatch
    upload_2018-6-9_22-11-21.png
     
  34. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Tried using a custom custom light parameter for the walls, floor and cealing, setting sytem tag to 1. Didnt help, still lots of systems

    upload_2018-6-9_22-29-32.png
     
  35. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    @JamesArndt Hey James, I remembered you had a problem with systems? I'm now being hit by it too I think, did you ever get that sorted?
     
  36. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    No not that I can recall. It was still an issue.
     
  37. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    It's really annoying since it's only one atlas they should all go on the same, I hope unity will show some interest soon because I'm out of ideas
     
    JamesArndt likes this.
  38. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Yeah there was nothing I could do to be honest. No one was giving me a concrete answer on how to solve this. I halted work on that project as it required baked lightmaps and it was consuming too much time finding workarounds. I think the last thing I was doing was baking lighting to vertex colors in 3ds Max and trying to use that combined with a shadow "decal sheet". I was basically rendering different shapes for shadows for objects and then using those as decals.

    Might be important to note this was a mobile project for Android so the lightmapping thing was a blocker issue on that project.
     
    AndersMalmgren likes this.
  39. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    So I tried to bake it under 2018.1.3, low res didnt have time to wait for the bake so get some edge bleed, which I think will be fixed by a higher res bake. But the color miss match seems to be gone, so please what ever you are doing in 2018 back port to 2017.4.5 (LTS and all that). We cant move to 2018 right now. For example the shaders for this very asset break in 2018 so thats why I have to use default materials

    upload_2018-6-12_0-21-20.png
     
    JamesArndt likes this.
  40. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Man I'm still amazed the light baking is still this broken. Even on low settings you shouldn't be seeing what I am seeing in this image. Massive UV shell seams everywhere with horrible bleeding across them. Setting the quality to low should produce a little bleeding and no massively sized UV shell seams. That's what a well done lightmapper should work like. This is really pitiful and from my perspective one of the weakest aspects of the Unity editor.
     
    AndersMalmgren likes this.
  41. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Since we are a VR game there is not alternative than stick with baked lightmaps for now too :)
     
  42. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    That is interesting. @AndersMalmgren what do the system uv charts look like?
     
    Last edited: Jun 12, 2018
  43. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    I thought that was always the case with low res bakes for a LM simulating true GI??
     
    Last edited: Jun 12, 2018
    JamesArndt likes this.
  44. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    This is at 20 res, and I do think it looks a bit better in 2017.4.5 will test and compare tonight
     
  45. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Btw, there is no change in the system layout, so it still does not honor my system tag config, but the color miss match between systems is gone
     
  46. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    I was wondering if you could bake in 2018 and drag the lightmap files into 2017 or is that wishful thinking?
     
  47. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Will not work sadly. Since LTS they should backport this? We will move to 2018 eventually, we have a new ballistics system that will use features in 2018, but we are not ready for the move until a few months from now. Would like to release this level in our next update :/
     
  48. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Yeah i know, obviously i wouldn't expect you to ship a game on a unity beta build, but i did wonder if you could simply drag and drop the lightmaps over. also do you just have two installs of unity running side by side, i always thought one would overwrite the other for some strange reason.
     
  49. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    It only works when going from for example 2017.4.4 to 2017.4.5 and even then sometimes you get the famous "lightmaps need to be rebuilt"

    2018.1.3 is not a beta build. But yeah, cant move now
     
    iamthwee likes this.
  50. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Well it shouldn't be if the UV splits and charting were done in a very intelligent way. It's an issue of seams being produced by the automated splits the editor is doing per settings. My assumption is the settings should be optimized and intelligent by default and not produce massive seam splits in highly visible areas. This comes down to an algorithm and it's dependencies on pre-determined settings.

    This is an issue with the model import settings for UV setup for lightmaps. It's not part of the GI baking phase...but the issue becomes much more apparent after and during baking because of the visible seam, light leaking over boundaries, etc.