Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Jagged Shadows in Baked Lightmaps (Unity 5)

Discussion in 'Global Illumination' started by BaconSanwich, Apr 7, 2015.

  1. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    hippocoder likes this.
  2. frankn

    frankn

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    10
    There have been some changes and fixes, but the main problem is sadly still not fixed (dynamic objects casting shadows from mixed light in deferred). At least that's true for 5.3.0b5, where I just tested with my testing scene.
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    So there have been "many fixes" and the feature is totally broken. OK.

    Got it.

    You know it's fine that features are broken, assuming that we agree that they are broken, which implies that they will be fixed, at some point.

    I get really annoyed with "it had a lot of fixes and it's totally usable" when the feature is still broken.

    (Note: This has little to do with mixed mode, because I don't really care about using mixed mode all that much, but I have a really hard time getting someone from Unity to agree that final gather is useless in its current state. If I manage to get an "official" reply, I usually get replies like "No it's totally fine, I use it all the time" or "there have a ton of fixes recently" (which doesn't really matter, if even after all those fixes, the feature is fundamentally broke), which means they are either lying/evading the issue, or are deluded about the state of their tools. And I don't really know which is worse.

    So. "There have been fixes" is not an appropriate response to "this is broken" if it's still broken. And I have heard/read that reply one too many times recently, so I am venting a bit right now. So my apologies for that (although I do mean every word, tone could be better).
     
  4. frankn

    frankn

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    10
    I hope I never said it's totally usable, just there are fewer bugs in the whole system than before. But yeah that does not help you much if there is another bug that prevents you from even seeing those fixes because it breaks before. Like, that car has now 4 wheels instead of 2, but we still don't have the fuel tank in it...

    Also, it is really tricky not to confuse all the versions. We now ship updates and patch releases to 4.6, 5.2, 5.3 is in RC1 now and RC2 on the way, alongside 5.4 in alpha. And then we have the trunk as the current development stage, alongside countless branches where individual things are being tested and improved.
    That means even if a bug is fixed, it takes several weeks or months until you can actually use it, since we have to run thousands of tests and do a lot of QA to avoid regressions. I'm sorry if I say a bug is fixed and it isn't because the fix didn't make it into the latest version.

    So we just try to give some feedback on what we are working on, but of course that does not help you much if the feature does not work in your use case. I think it's still better than no feedback, though.

    Well, and then there is the problem of bug report quality. Too many people just come to the forum saying "this feature is totally broken you morons". So we try to reproduce that, and too often we just can't. Then, people refuse to submit a proper bug report which would allow us to understand the problem, because they think it is "obvious".
     
  5. nickpappas

    nickpappas

    Joined:
    Mar 19, 2013
    Posts:
    18
    Well Frankn, I would like to say thank you for your work around. By turning the blur to 1. We had so many curved objects in our game that this bug was killing the look of our game. At least there's is a solution that doesn't involve a photoshop fix. I wish I knew this 2 months ago!

    I've been frustrated with everything GI too, but if I have a work around to the bug at least I can get my job done.

    As for the mixed/ realtime bug. My work around is bake first with those dynamic lights turned off then turn them on afterwards. Yeah it's annoying but it gets your job done.
     
    frankn likes this.
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    You didn't. But you also seemed to have a hard time admitting it's broken. You see if you as a dev you are frustrated that people often whine about things being broken, but then they are unable to show you how (proper repro case), me, as a Unity user, what most frustrates me is after filling bug reports and repro cases and feeling like "ok, I've done everything I could", what Unity does a "sort of fix", that kinda improves things a bit, but doesn't really fix the main problem and considers the issue as dealt with. Then I feel like communications are breaking down and I feel frustrated.

    Also, one side is getting paid to deal with this frustration :)

    Well, luckily for you, not for long for that one! And 5.x is still not a superset of 4.6.x's features so hurray for us with ongoing 4.6 projects.

    That's cool. I hope I made clear what ticked me off. If you started your original reply with "Yeah it's still broken BUT there have been many fixes to the mixed mode in the development branch. (Etc etc)" I would have been a-ok.
     
    Last edited: Nov 17, 2015
    frankn likes this.
  7. BaconSanwich

    BaconSanwich

    Joined:
    Mar 16, 2013
    Posts:
    19
    First of all, thanks Frankn for your responses. It's easy to blame the messenger whenever something goes wrong, and that's not what I'm here to do.

    But unfortunately, having a ship-stopping bug for over 7 months now is pretty unacceptable. I can't even imagine what other devs are going through. It's also frustrating to see the new response of "now that we have a repro case..." when I submitted the 100% repro case 7 months ago, and also pointed out that it was the antialiasing that was clearly not working.

    All frustrations aside, is there any way we can elevate this bug? It's absolutely dumbfounding to me that this isn't #1 or #2 on the list of CRUCIAL things to fix immediately since this would stop any game using baked shadows from being able to ship.
     
  8. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    628
    I'm guessing quite a lot of us - especially mobile developers - are simply still using 4.6.x and Beast.

    It's going to be... interesting... when support for 4.6 ends. IMHO it's coming far too soon. For some projects, a move to 5 still isn't really viable yet.
     
    laurentlavigne likes this.
  9. frankn

    frankn

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    10
    Last edited: Nov 20, 2015
  10. BaconSanwich

    BaconSanwich

    Joined:
    Mar 16, 2013
    Posts:
    19
    Thanks Frankn.
    Case #: 689996. Link: http://fogbugz.unity3d.com/default.asp?689996_166a1jlcikmrpjda
     
  11. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Is this related to the issue of pixelated shadows from realtime(directional) lights?
     
  12. frankn

    frankn

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    10
    @BaconSanwich: Thanks! Looks like we have scheduled it for 5.4, but that means not this year anymore. I guess those lightmapping bugs will be fixed in one go.

    @eco_bach: No, if you have pixelated realtime shadows, this is most likely caused by the limitation of percentage closer filtering and/or the shadow bias, or just the fact that even the highest shadow map resolution in Unity is relatively low compared to modern AAA games. On mobile devices, there is not even PCF filtering, but that is of course for performance reasons.
     
  13. j-baeza

    j-baeza

    Joined:
    May 14, 2015
    Posts:
    26
    Seems like this only happens on non straight UVs or UV rotated objects. If I have a box, unwrap it in max (everything is straight, it's a simple box) and provide my own UVs to unity, everything is ok. If I rotate one face in the UVs in Max, then in unity those jagged shadows appear on that particular face edges. Problem occurs on cercle surfaces too because it can't be straight in UVs. Looks like antialiasing in baking process (maybe you already said everything i'm saying !).
    Cheers
     
  14. TKDHayk

    TKDHayk

    Joined:
    Dec 22, 2015
    Posts:
    104
    i still have this issue... is there a fix or a workaround? baked shadows look like S*** in unity 5 no matter what i do
     
  15. nickpappas

    nickpappas

    Joined:
    Mar 19, 2013
    Posts:
    18
    I believe the only shipping solution is to use 2 sets of lightmapping parameters on your scene. First make a set where you set the "blur radius to 1" This will fix most of the black muddy edges where objects intersect. After that bakes, look around your scene where object's lighting now looks more pixelated than it used to. That's where the blur radius was doing the work. On those objects force them specifically to use the default low or high parameters. Or just use a new custom set of parameters with the default "blur radius of 2."

    This was the only way I was able to get soft baked lighting on Lucky's Tale. If you havn't played it yet check out some vids on YouTube. It was baked with enlighten with unity 5.3.3. We had no textures and a whole world made of soft rounded shapes, so nice lighting was important. In no way is it perfect and it was certainly a painful learning process to get there but I think the result was certainly shippable. I am looking forward to the new PowerVR light baking engine in unity 5.5. I played with it at GDC and it was leaps and bounds better than Enlighten's baker.
     
    bluescrn and Stardog like this.
  16. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    @nickpappas yeah I can't wait for the PowerVR baker too. This looks really promising.
     
  17. creatlore

    creatlore

    Joined:
    Jul 14, 2015
    Posts:
    29
    Unity you ever going to fix this problem, unreal is beating you? BUMP BUMP BUMP!!!
     
  18. creatlore

    creatlore

    Joined:
    Jul 14, 2015
    Posts:
    29
    Did this problem ever get resolved because I am still experiencing the same issue everyone else on this thread is experiencing with the jagged shadows and no settings work to fix it?
     
  19. BaconSanwich

    BaconSanwich

    Joined:
    Mar 16, 2013
    Posts:
    19
    @frankn Has this been fixed or is antialiasing on baked shadow maps still broken? It's been nearly a year and a half since this bug has been filed. Could we get an update?
     
  20. BaconSanwich

    BaconSanwich

    Joined:
    Mar 16, 2013
    Posts:
    19
  21. j-baeza

    j-baeza

    Joined:
    May 14, 2015
    Posts:
    26
    Hi all !
    I have the same problem and it seems to come from UVs not being straightly unwrap.
    In the Unwrap below I artificialy straightened the UVs of the side of the chair and the artifacts disappeared.
    The other sides are jagged beacause there UVs are not in a perfect alignement.
    All objects with non-straight borders in UVs result with the same problem of jagged alliased baking.
    Any news about a solution to fix this ?
     

    Attached Files:

    • 02.jpg
      02.jpg
      File size:
      375.9 KB
      Views:
      918
    • 01.jpg
      01.jpg
      File size:
      302.6 KB
      Views:
      918
    • 03.jpg
      03.jpg
      File size:
      179.1 KB
      Views:
      918
  22. BaconSanwich

    BaconSanwich

    Joined:
    Mar 16, 2013
    Posts:
    19
    The reason there are no issues when the UVs are straight is because there is no anti-aliasing that happens when they are straight. It is the anti-aliasing which is (one of the things) broken in the tool. So yes, having straight UVs on a mesh will help it not look so bad, but the lighting system is still broken.
     
  23. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    Still looks like a bug and I'm running 5.50b7. IMHO we have a few things going on.

    This blur / anti-aliasing issue should be considered a bug and doesn't really address the edge cracking issues reported in this thread, it mitigates them but doesn't resolve them. I'm seeing the exact same issue in my scene and I'm using incredibly high resolution lightmaps.

    A simple fix that we used a decade ago on some lightmapped titles were to just "infill" the border pixel edges. This hid most of the edge issues and was a simple post process. We ended up infilling all the gutter regions and found it was sufficient in most cases. You still want to denoise, blur, and anti-alias.

    Looking forward to some fixes in the future.. as these issues have been solved for a long time in most other engines that I have used. I guess it's priorities and who complains the loudest.. but since I'm working in VR I am baking most of my lighting and rely heavily on accurate results which I am currently not able to achieve.

    Here is an example:

    UnityLightmapEdgeShellProblems.JPG
     
    Last edited: Nov 16, 2016
  24. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,886
    Don't expect a fix for this. It's been this long, and they've not mentioned it. It seems basic, but they won't fix it for some reason.

    Beast solved it in a similar way to what you described, except they used blocks of colour. See these images:

    unity46-51_lightmapdifference.jpg $lmbeast.jpg
     
  25. BaconSanwich

    BaconSanwich

    Joined:
    Mar 16, 2013
    Posts:
    19
    @blizzzz We've thought about doing this by hand, but if anything changes and we have to reburn, then we'd have to fix everything again by hand, and that's sorta a deal breaker, unless it's the type of thing to do just before you lock down the build before ship.

    @Stardog It's so depressing that they seem to not be willing to fix this. I've been waiting for over 1.5 years for a fix, myself. I just had a programmer go down to Unite with a test scene to show the problem to someone in person and get some answers, and the specialist he talked to agreed it's a bug, but that we'd have to upvote the issue to get it looked at. If you can pass around the link to the bug and get as many people to vote on it as possible, we have a much greater chance of getting this fixed: http://issuetracker.unity3d.com/iss...alias-when-blur-radius-value-is-larger-than-1
     
    Last edited: Nov 17, 2016
  26. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    FWIW I did some more testing and this is not an issue related to in-filling gutter regions. Here are more images to add to the growing list. You can see that it's already in-filing past the border edge of the shell. This is also a best case scenario as the extruded edge and top face are contiguous. I've also tried setting my static light to use "soft shadows" and applying a value > 0 in the "Baked Shadow Rad" parameter. This didn't help much, but the theory was that an area light with high sampling might do a better job at softening the transition between these two surfaces. It really does seem like a basic light baking quality issue and is extremely easy to repro.. not sure why a fix has been so delayed. Sorry for my low quality .jpg images. :(

    unityEdgeIssuesLightmap.2.JPG unityEdgeIssuesLightmapWireframe.2.JPG
     
    Last edited: Nov 17, 2016
  27. BaconSanwich

    BaconSanwich

    Joined:
    Mar 16, 2013
    Posts:
    19
    @blizzzz Yeah, this is something more than just a border issue. For example, you'll often see the aliasing throughout the interior of a burn area as well (see below image). If you know anyone with a unity account, having them vote on this bug: http://bit.ly/2f8SKgK will raise the priority of this light burn issue getting fixed. Seriously, TELL EVERYONE YOU KNOW!! :) If we can get it up to about 50 (it's grown by about 15-20 in the past week alone), then it should have a very good chance of getting fixed. Heck, if grandma has a unity account, send grandma the link and invite her to vote it up too.

     
  28. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    Went back and actually read this entire thread vs. skimming through it. @Jesper-Mortensen put me back on the right track with the comment regarding the lightmap UV shells aka islands. Looks like there is no way to achieve desired results with the top and extruded edges of my mesh being contiguous. Splitting shells at this hard edge fixes this particular issue. When splitting the shells you get the benefits of the in-filling of the gutter regions and avoid the artifacts of the shading considering the sample of the adjacent triangle. So in my case there was a fix, but I do see other areas where I am unable to split the lightmap uv shells and also I have lots of banding issues. I have tried with and without Denoising.. along with Ray Counts, Final Gather, etc... nothing seems to mitigate the banding.

    Here are the before and after images:

    Attached extruded edge = jaggies
    LightMapUvShells_Attached.JPG LightMapUvShells_AttachedGameView.JPG

    Split extruded edge = no jaggies
    LightMapUvShells_Split.JPG LightMapUvShells_SplitGameView.JPG
     
    ROBYER1 likes this.
  29. BaconSanwich

    BaconSanwich

    Joined:
    Mar 16, 2013
    Posts:
    19
    @blizzzz Did you have to change any settings during lightmap generation, or did you only change the UV layout?
     
  30. blizzzz

    blizzzz

    Joined:
    Jun 22, 2016
    Posts:
    15
    @BaconSanwich We are using .fbx as our source files. For the "Attached extruded edge" case I didn't select any special options on the fbx file import. My guess is that Unity uses the one UV set associated with the mesh. You could refer to this as the diffuse texture UV set. For the "Split extruded edge" I checked the box "Generate Lightmap UVs" which splits at the hard edge.. or more likely it's just doing a cubic projection to split the shells and make a unique lightmap UV set. Maybe someone from Unity can provide the details of how the shell splitting works when enabling this checkbox (or it's in the manual). It's not optimal and in some cases we had much better results by hand authoring an extra set of lightmapUV's in Maya. It looks like the fbx importer will default to use the 2nd set of UV's for the lightmap when they exist and no options are checked. Hope that makes sense.
     
    Last edited: Nov 23, 2016
  31. lavi_mahal

    lavi_mahal

    Joined:
    Nov 30, 2016
    Posts:
    9
  32. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    So Unity broke light mapping in version 5 and never fixed it...

    Has anyone internally at Unity actually brought this up and highlighted there was some serious failure of process to let this happen?
     
  33. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    They didn't "break" it, they switch lightmapping systems. New one (enlighten) has a ton of quirks and is not very suited for baked GI. The are releasing a new one, focused on baked lightmapping "soon".
     
  34. Tariq-11

    Tariq-11

    Joined:
    Jan 5, 2017
    Posts:
    5
    Go to Edit > Project settings > Quality > Shadow projection now change stable fit to ( Close fit ) that's it.
     
  35. jack_benton

    jack_benton

    Joined:
    Dec 18, 2016
    Posts:
    3
    This might be too late but i solved my jagged baked shadows in unity 5.4.3p1.
    I figured the actual exr file created for my baked shadows is not jagged at all by opening it in Photoshop. But it gets pixelated in unity even if i bake it at 8k.

    So i changed it's texture format from "Compressed" to "True Color" in its Import Settings & now it looks all smooth as it should.

    Although the size of the texture increases because it's not compressed anymore but it's worth the quality & u can also put it at 1024 or 512 max size and still look good.
    Hope it helps some :)
     
  36. AlienBoyGames

    AlienBoyGames

    Joined:
    Feb 12, 2020
    Posts:
    17
    2020 I am having the same problem. Any solutions? Thanks
     
  37. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    99
    Hi AlienBoyGames. Several issues/problems have been mentioned in this thread. To name a few:
    • Jaggies on flat surfaces due to lack of supersampling.
    • Jaggies at edges due to non-ideal UV layouts (which no amount of supersampling can solve).
    • Mixed mode lighting not working as intended.
    • Blur radius not working as expected.
    So therefore it is not clear to me what your problem is exactly. I suggest that you create a new topic where you present your issue in greater details. You may consider to include an image or two as well since this often makes it much easier to understand what is going on. I think this will make it much easier for us to help you. Thanks in advance! :)
     
  38. AlienBoyGames

    AlienBoyGames

    Joined:
    Feb 12, 2020
    Posts:
    17