Search Unity

Baking Lightmaps causes jagged shadows help!

Discussion in 'Global Illumination' started by R3fr4ct0r, Apr 6, 2020.

  1. R3fr4ct0r

    R3fr4ct0r

    Joined:
    Feb 14, 2019
    Posts:
    9
    2020-04-06 (2).png The map is really big, you can't tell from this picture but it is really massive a person is smaller than half of the orange toothbrush holder you can see on the sink. Also in the console i get "There are 4 objects in the scene below with overlapping UVs" As you can see the shadows are really jagged and just terrible, especially if the player has to be close to them all the time. Please help
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Disable lightmap compression and rebake.
     
  3. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Hi

    Can you post your settings? And a screenshot of one of the lightmaps?

    For the UV overlap, go to the Scene view and choose the UV Overlap mode to find where the issue is :)
     
  4. R3fr4ct0r

    R3fr4ct0r

    Joined:
    Feb 14, 2019
    Posts:
    9
    Here's the settings, i am currently baking without compression and will update you with the results. Keep in mind that i am fairly inexperienced with light baking so i could use some tips especially for a giant map like this :)
     

    Attached Files:

  5. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Hi! One thing to add that might be causing you to bake way too many lightmaps for a rather simple scene (albeit big). The lightmap resolution is set to 40 texels per unit. A unit is 1 meter in Unity, and since 1 meter in your scene (your 2 m tall human) is so insignificant, you might want to cut down on this. Try maybe 10 or 20 (or even lower) and see how that goes for you baking time. You can turn of Prioritize View and move around whilst baking to see what the progress looks like :)

    You should probably also increase your samples and use at least 256 indirect samples. Try lowering your AO distance since this might also cause this effect. You can also try running you bake with some different type of filtering. I think you lightmap will be super noise with such a low sample count, causing the filtering to smudge it way too much.

    Also, I did some beginners talk on Youtube that explains all the settings. Search for "Baking at the speed of light" or (slightly older)"Bake it til you make it". That might bring you up to speed on most settings :)
     
    Last edited: Apr 8, 2020
    Acissathar likes this.
  6. R3fr4ct0r

    R3fr4ct0r

    Joined:
    Feb 14, 2019
    Posts:
    9
    Ok so i tried various different settings and everything seems normal except these strange lines that appear on objects, i increased the Indirect (from 40 to 256) and Direct (from 36 to 50) samples. Lowered the ambient occlusion from 900 to 200 and this is the result. There's still these lines on objects. Also it says that 7 objects' UVs now overlap and when i use the scene view mode "UV overlap" there's literally no Red lines to be seen on the objects that unity says are overlapping. Really messy stuff and the strangest thing is that before i redesigned my bathroom everything was silky smooth with the older settings. Is it possible that adding more objects messed something up in the scene lighting? I am pretty new on this stuff

    EDIT: By redesigning i mean just adding a few objects here and there and changing older textures with new ones.
     

    Attached Files:

  7. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Those gradients that you are seeing are most likely caused by the lightmap compression. Go to Lighting Settings > and uncheck Compress Lightmaps checkbox. Alternatively, you could override the the lightmap texture format in the texture importer: https://docs.unity3d.com/Manual/class-TextureImporter.html
     
  8. R3fr4ct0r

    R3fr4ct0r

    Joined:
    Feb 14, 2019
    Posts:
    9
    It was the first thing i tried and it didn't work, gave it another shot later last night and it's still the same.. I really have no clue what could be causing this
     

    Attached Files:

  9. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Please go to Project Settings > Player > Lightmap Encoding and make sure that it is set to High.
     
  10. R3fr4ct0r

    R3fr4ct0r

    Joined:
    Feb 14, 2019
    Posts:
    9
    Didn't work. Baked it again and it's the same results. What boggles me even more is that before, with the old settings everything was fine (i also had less objects and less detailed textures) Could this be the root of the problem?
     
  11. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    I am wondering if these harsh gradients are present in the baked lighting or only in the final output? Please supply a screenshot of that view mode. Thanks!
     
    R3fr4ct0r likes this.
  12. R3fr4ct0r

    R3fr4ct0r

    Joined:
    Feb 14, 2019
    Posts:
    9
    Here it is at the start: here it is after 20 minutes: after 50 mins: after 3 hours: 1 hour away from the end where i fell asleep: should i rebake and send just-before-the-end screenshot?
     

    Attached Files: