Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Artifact on sharp corners in baked lighting

Discussion in 'Global Illumination' started by AndersMalmgren, Jan 23, 2017.

  1. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    I have
    a problem where I get strange shadow artifacts on 90 degree corners. Like here upload_2017-1-23_21-8-52.png

    Or here
    upload_2017-1-23_21-11-31.png
     
    Last edited: Jan 24, 2017
  2. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    Forgot the setting

    upload_2017-1-23_21-13-5.png
     
  3. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    Tried with compressed unchecked, still strange articats look at the seam between the wall mesh. Next im upping the padding from 2 to 4 upload_2017-1-23_22-27-30.png
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,749
    That's what I was going to suggest, let us know how it goes.
     
  5. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    Didnt help (maybe a bit), I'll test with 8 and see if its any better :D But its late here in Europe now, I'll post a pic tomorrow with padding 8
     
  6. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    OKey so this is my current settings after last bake
    upload_2017-1-24_17-20-58.png

    The settings I think makes most difference for my artifacts are Compressed unchecked and padding = 8. But I stil get artifacts,
    upload_2017-1-24_17-21-53.png
    upload_2017-1-24_17-23-43.png

    upload_2017-1-24_17-24-39.png

    Any tips would be highly appreciated, thanks
     
  7. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    Can final gather help? I'm reluctat to test because of the time it takes
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,749
    Probably not.

    Are you making your own UVs or are you using Generate lightmap UVs on your meshes?
     
  9. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,749
    When you click the mesh in Project view, in the Inspector import settings, is the "Generate Lightmap UVs" checkbox, checked?

    (if yes, try raising the pack margin value, see if that improves things)
     
  11. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    The meta files are like they were from author, here is example on the pilar you see in screenshot

    upload_2017-1-25_9-57-12.png
     
  12. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    Ok, by how much?

    edit: I checked my other assets, that checkbox is not checked for my other assets from other authors.
     
  13. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,749
    32 should be more than enough. Try checking the checkbox for the other assets, set a high-ish pack margin (16 to be on the safe side? if it looks okay, you can start lowering it afterward), rebake, and see if that fixes it.
     
  14. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    its the same on all assets in this package, so screenshots above are done with these settings already applied :/
     
  15. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    The author seems to have used different settings on different assets though, upload_2017-1-25_10-28-54.png

    Should I contact him and ask for custom UVs?
     
  16. Finward-Studios

    Finward-Studios

    Joined:
    Sep 27, 2015
    Posts:
    30
    Hello. Very common problem when using baked lightning in unity. It's really hard to get rid of all the artifcats if not impossible. So what I can recommend to minimize the problems, I've found that increasing pack margin will help. So you can try to increase it to 32 or something very high on wall pieces. Another one that has huge impact is the resolution of the bake. So setting a higher resolution will give you less artifacts, but obviously will take longer to bake. So it's more about when are you happy enough with the artifacts, but I think you should increase it to 70+. Also baked padding could be increased to 12 or so. But as I said, when using baked lightning there will be almost always some problems, at least I or anyone I know haven't really had a perfect solution to it when working with full scenes.
     
  17. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    Hi, thanks for getting back to me. Our other assets does not have these problems, could it be that they have custom lightmap UV's?
     
  18. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    Here is a comparision with one of our other assets,




    edit: Are all your assets generated UVs? I'm thinking of getting both the suburban asset and the city block one
     
  19. Finward-Studios

    Finward-Studios

    Joined:
    Sep 27, 2015
    Posts:
    30
    Yes all of them have auto generated lightmap uv's.
     
  20. Finward-Studios

    Finward-Studios

    Joined:
    Sep 27, 2015
    Posts:
    30
    Self made lightmap uv's might help. Have you tried putting the same pilars or wall pieces to this scene and see if there's artifacs?
     
  21. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    I have tried the same baking settings yes, the first settings screenshot is actually the same settings thats works good with the tiles in above screenshot. Since then I have increased padding to 8 res. to 40 and turned off compression.
     
  22. Finward-Studios

    Finward-Studios

    Joined:
    Sep 27, 2015
    Posts:
    30
    So I tried to investigate it once again and I actually found a way to get rid of the baking errors. I tried manual lightmap uv's etc but no help and I've been struggling with the problem for years but now I think I found something, at least it fixed the problems with my test scene. So you would have to change the settings from the wall models. Set Hard Angle to 35 from Lightmap UV's and Increase Pack Margin to 52. In Most cases pack margin 32 was enough but it still sometimes gave some baking errors but with 52 it was good. Also from baking settings I had baked padding set to quite high (12) and compressed had to be taken off. You can try this and I think it should fix the problems.

    fix2.jpg

    baked.jpg
     
    Last edited: Jan 25, 2017
  23. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,661
    Thanks going to try that