Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Progressive CPU Lightmapper

Discussion in 'Global Illumination' started by Kuba, Feb 2, 2017.

  1. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    231
    Looks like a biasing issued when using realtime direct lighting. Have you tried tweaking the bias on the directional light?

    Would be interesting to know if this is in the lightmap or the realtime direct. You should be able to determine that by using the baked lightmap visualization in the scene view.
     
  2. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    231
    We have an issue with a serial stage that depends on the lightmap size, we have optimized this significantly in 18.3 and we are backporting this fix to earlier versions ATM.
     
    Fallc likes this.
  3. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    231
    We know about this and have a fix in 18.3 that we are going to backport to earlier versions asap. Once that happens you should be back to ~100% CPU utilization.
     
    JamesArndt and buttmatrix like this.
  4. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    231
    We have recently been looking into the packing step. We are adding spatially coherent packing and also an ability to force a group of objects into a single atlas. We will look into your request too while we are doing this. It makes sense to be able to do your own packing and maintain that for baking.
     
  5. ZeBraNS

    ZeBraNS

    Joined:
    Feb 21, 2015
    Posts:
    40
    Hi,
    could someone give (or make) some practical example of how to use configurable falloff in the Progressive Lightmapper.

    Thanks
     
  6. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hey!

    In order for the custom light falloff to work, you would first need to create a script named ExtractFalloff which contains the following code:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Experimental.GlobalIllumination;
    5. using UnityEngine.SceneManagement;
    6.  
    7. [ExecuteInEditMode]
    8. public class ExtractFalloff : MonoBehaviour
    9. {
    10.     public void OnEnable()
    11.     {
    12.         Lightmapping.RequestLightsDelegate testDel = (Light[] requests, Unity.Collections.NativeArray<LightDataGI> lightsOutput) =>
    13.         {
    14.             DirectionalLight dLight = new DirectionalLight();
    15.             PointLight point = new PointLight();
    16.             SpotLight spot = new SpotLight();
    17.             RectangleLight rect = new RectangleLight();
    18.             LightDataGI ld = new LightDataGI();
    19.  
    20.             for (int i = 0; i < requests.Length; i++)
    21.             {
    22.                 Light l = requests[i];
    23.                 switch (l.type)
    24.                 {
    25.                     case UnityEngine.LightType.Directional: LightmapperUtils.Extract(l, ref dLight); ld.Init(ref dLight); break;
    26.                     case UnityEngine.LightType.Point: LightmapperUtils.Extract(l, ref point); ld.Init(ref point); break;
    27.                     case UnityEngine.LightType.Spot: LightmapperUtils.Extract(l, ref spot); ld.Init(ref spot); break;
    28.                     case UnityEngine.LightType.Area: LightmapperUtils.Extract(l, ref rect); ld.Init(ref rect); break;
    29.                     default: ld.InitNoBake(l.GetInstanceID()); break;
    30.                 }
    31.  
    32.           ld.falloff = FalloffType.InverseSquared;
    33.                 lightsOutput[i] = ld;
    34.             }
    35.         };
    36.  
    37.         Lightmapping.SetDelegate(testDel);
    38.     }
    39.  
    40.     void OnDisable()
    41.     {
    42.         Lightmapping.ResetDelegate();
    43.     }
    44. }
    The code example above already has Inverse Squared falloff set by default. You can choose between InverseSquared, InverseSquaredNoRangeAttenuation, Legacy, and Linear. If you want to use a different light falloff method, simply change the following line:

    ld.falloff = FalloffType.InverseSquared;


    Once that is done, simply attach the script to the light of your choice. Keep in mind that only baked lights are supported at the moment.

    If you happen to not see any changes in your light falloff after modifying the script, try to disable and enable the light and rebake the scene.

    We have also put a small example project which contains a single light, with the custom falloff script already attached to it. Keep in mind that you would need to open it in Unity 2018.2 in order for it to work. You can download the project via this link.

    If you need more information, please refer to this manual page on custom light falloff in Unity - https://docs.unity3d.com/Manual/ProgressiveLightmapper-CustomFallOff.html
     
    ZeBraNS and konsic like this.
  7. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    since it is lightmap process it should be available in the default renderer
     
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    scroll up :D
     
  9. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    Where to apply script? On camera or point light ?
     
  10. ZeBraNS

    ZeBraNS

    Joined:
    Feb 21, 2015
    Posts:
    40
    Thanks Kristijonas for your detailed answer :)
     
    kristijonas_unity and JamesArndt like this.
  11. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Did you read Kristijonas post above?
     
  12. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,624
    I don't know if this changed in 2018.2, but I found that to be on the safe side, I usually end up loading another scene and then reloading the scene I want to make sure the change in falloff actually happens.
     
    kristijonas_unity and konsic like this.
  13. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Many thanks to you and Jesper for answering everyone's questions! (Here's my original post: https://forum.unity.com/threads/progressive-lightmapper.454362/page-13#post-3473156 )

    So it turns out that my project had no " LightmapParameters" object in the project. Should that be generated automatically at some point? So I created one and left the settings at defaults, the tried lightmapping my game scene again. Attached are some views. You can see that the lightmap does not correspond to where the actual (realtime) shadows are cast on the terrain. These are tree-creator trees, and Double Sided GI is dimmed/inactive on those materials.

    thanks
    Dave


    texel validity.png shadowmask.png baked lightmap.png shaded view with realtime shadows.png
     
    Last edited: Jul 11, 2018
  14. Laurens-Paladin-Studios

    Laurens-Paladin-Studios

    Joined:
    Apr 25, 2015
    Posts:
    54
    Hi There Unity,

    I just encountered an issue using Progressive lightmapping with an Alpha clipped material using LWRP:
    BakedGiAlphaClip.JPG

    On the top-right you can see the realtime shadow, on the bottom-left the baked version of the same plane. I'm using LWRP and double sided GI.

    Doing the same thing and not using LWRP works just fine:
    BakedGiAlphaClip_UnityRP.JPG

    I've reported this as a bug (Case 1061688), and am curious if this was already on your radar.

    Thanks
    Laurens

    (edit: Using the latest official unity 2018.2)
     
    Last edited: Jul 18, 2018
    KarlKarl2000, JamesArndt and konsic like this.
  15. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Hi Dave! Unity always have a scene wide lightmap parameters assigned in the Lighting window. See this page for details https://docs.unity3d.com/Manual/class-LightmapParameters.html
    Creating a new parameters asset will have default values and assigning it to your object without modifying the values will not change anything. You have to modify the values in the parameters asset you assigned to your object.
    From your screenshots I can tell that you are getting a lot of invalid lightmap texels on the terrain. This is because the lightmap texels on the terrain are seeing a lot of backfacing triangles from the trees.

    - Try setting a higher backface tolerance value on the lightmap parameters for the terrain
     
  16. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    I can only find Backface Tolerance value on the LightmapParameters object that I created in the project -- it's set to 0.9 there, which is almost maximum value. Is there somewhere else to set it for the terrain specifically? If so, sorry, I can't find it and would appreciate a tip....

    thanks
    Dave
     
  17. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
    Hello,

    Just tested the progressive lightmapper in 2018.2.02f, everything is fine, just that the light mapper started to not save and I can't get it to save the baked light maps again. I can see the textures in the global maps tab, but I can't get it to save them to the scene folder.
    Could you advise on a workaround or a fix on my side?

    Thanks,
    Mihai
     
  18. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
    The saving works sometimes and sometimes doesn't. Is there any settings that I configure to ensure saving (some buffer size or smth like that?)
    Thanks
    Mihai
     
  19. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    In the manual https://docs.unity3d.com/Manual/class-LightmapParameters.html have a look at the `Assigning Lightmap Parameters Assets` section about assigning to GameObjects.
    InkedUnity_2018-07-26_08-13-09_LI.jpg
     
  20. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Is mixed mode lighting broken in 2018.1.3f1? I'm using the Progressive lightmapper and when I bake a light out and then return that light to Mixed Mode it doesn't light my real time object anymore.
     
    konsic likes this.
  21. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    2018.2 released but no gpu baking system. :(:(:(
     
  22. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    It should come at some point in the 2018.3 cycle !
     
    KEngelstoft likes this.
  23. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    I must be doing something wrong now. I bake my lighting and the directional light in the scene still affects the track surface, but it should be only lit by a lightmap after baking. I've tried Subtractive, I've tried Shadowmask and all of the different options. My track is set to "Static", it's got Lightmap UVs generated for the mesh. My light is set to "Mixed" so it should bake the track lighting and dynamically light the vehicle. No clue why it isn't working. It does bake lighting to the track when the light is set to "Baked" but when I switch it back to "Mixed" it doesn't light my vehicle anymore.

    Is something broken with Mixed Mode lighting?

    I try to use Light Probes to bake "real time" lighting, but it kills all nice specular shine on my vehicle and it looks awfully flat, so light probes don't' seem to be solving this either.

    EDIT - Okay I did find a nifty workaround that appears to be working. Use two lights. One is a real-time light and the other is a baked light. They are both set to use culling layers, so the real-time light only affects my vehicle and the baked light only affects the environment. Once I'm done baking I disable the baked light, so the only light being used in my scene is the real-time that only illuminates my vehicle. It appears to be working, but feels like a hack or workaround.
     
    Last edited: Aug 3, 2018
    konsic likes this.
  24. Mr-Mechanical

    Mr-Mechanical

    Joined:
    May 31, 2015
    Posts:
    507
  25. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    What is the status of GPU support. Today with 2018.2 I've finally managed to bake an outdoor 600x600m city scene. Took a while so I would like to lut the 1080 to work instead of my older cpu.
     
    Last edited: Aug 9, 2018
    JamesArndt likes this.
  26. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    This is the baked urban map. It is the available Naniwa -Ku map by zenring plus a lot of extra stuff by me, I should not have added small objects to lightmap as It is done trough proves, but I'm still getting familiar with teh system. I had to doubl ethe intensity of directional because initially it was too low lit, may be this could have been tweaked with exposure on the filter stack.
    upload_2018-8-9_12-8-26.png

    upload_2018-8-9_12-9-4.png

    7h is not the end of the world but does not let much marging for increasing quality without leaving me without my working tool.
    At 0.5 resolution it takes about the half despite the docs say its 4 times more texels. I wonder if leaving 0.5 resolution and puting 4 times more indirect rays would be better.
     

    Attached Files:

  27. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    ISSUES:
    I'm having issues with road markings that are a plane with texture with alpha.
    They get black.
    upload_2018-8-9_12-12-5.png

    upload_2018-8-9_12-12-19.png



    RENDERER FOR THE FAILING ROADMARKINGS MESH
    upload_2018-8-9_12-20-14.png

    If I switch to cutout from fade they look fine in the range where lightmap is not active but go black when they enter the lightmap distance.

    This may not be an issue but I set lightmap size 4096 and sometimes it makes 1024 other times 2048 I guess it is that it can take up to 4096 lightmap tiles and if it does not need all of em it just uses smaller size. If not, there may be a bug.


    REQUESTS:
    Of course, GPU!! powered bakes. I need that extra time to increase quality of the bakes without dying in the wait.
    Bake selected button! kmon, I do have to rebake the whole thing just for new additions.
    Is it possible to bake proves only? because if not it should.
    Bake Just AO option.

    For an start baking AO mayy be fine, this shot is just AO from the stack fx.

    EDIT:
    It may hav eoverlapping uv as warning message says. dunno, that meshwas creater in editor with a tool that mergest different meshes. Now I should find a way to create uv2 for theese.... I don´t recall having theese issues in Beast.
     

    Attached Files:

    Last edited: Aug 9, 2018
    JamesArndt likes this.
  28. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I'm baking this scene, first time it works with PLM, still too slow for the resolution that is outputing. GPU now, please, I honestly can´t get to understand why they whent CPU path.
    upload_2018-8-9_22-47-36.png
    upload_2018-8-9_22-48-14.png
    settings are the ones from above post
    upload_2018-8-9_22-48-31.png
     
  29. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    Would it be possible to replace enlighten in realtime GI with Progressive Lightmapper ?
     
  30. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Okay, the problem was indeed the backface tolerance.....but it took awhile to figure out because I thought "use a higher tolerance value" meant to increase the General GI: Backface Tolerance slider value. But that just made things worse, so I finally tried reducing it (to 0.12) and now the tree shadows are baked quite nicely! So I'm not sure why "higher tolerance value" = smaller value on the Backface Tolerance slider, but apparently it does. Problem finally solved, thanks.
     
  31. WermHat

    WermHat

    Joined:
    Jul 13, 2012
    Posts:
    88
    Is cookie baking supported yet?
     
  32. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,081
    The problem is right there in the screenshot: your m rays/second. It seems Unity still has not fixed it or backported it as promised. CPU utilization is near nothing. It's like driving a Ferrari in 1st gear only.

    My post: https://forum.unity.com/threads/progressive-lightmapper.454362/page-13#post-3486636

    The reply was: https://forum.unity.com/threads/progressive-lightmapper.454362/page-14#post-3557556

    This is the issue that's holding back the lightmapper. The current CPU progressive preview lightmapper was lightning fast in 5.6. Either Unity accidentally created a bug, or purposefully slowed it down to build hype for the GPU lightmapper and are slow to provide a fix for such a critical feature for the past, well, 2 years. If you can, try 5.6 and see.

    I bet the GPU lightmapper will only be in the paid versions.
     
    JamesArndt and buttmatrix like this.
  33. XRA

    XRA

    Joined:
    Aug 26, 2010
    Posts:
    265
    Would it be possible to have the lightmapper use UV2 from an AdditionalVertexStream assigned to mesh renderers? I tried setting custom UV2 additionalVertexStream mesh in the Lightmapping.started event but the progressive lightmapper likely resets them.
    If set prior (& visible as being set), when lightmapping begins it clears away the additional vertex streams.

    Also related, controlling the raster position via the Meta Pass vertex shader doesn't change anything in progressive (haven't checked enlighten). The vertex positions can be all set to 0 and the scene will bake without issue. (using LWRP to test as it doesn't use the Unity cginc files)

    Basically I'm looking at ways to supply some custom per-chart packing prior to baking, the main requirement is without modifying the original meshes. So either through StructuredBuffers & modifying the raster position in Meta pass, or AdditionalVertexStreams. (The custom per-chart transforms would then be supplied via structured buffer / compute buffer at runtime as part of the render pipeline)

    The alternative right now is baking the lightmaps like usual and then repacking the baked result into the new texture and modifying the scene lightmap data which isn't too bad, but would be nice if eventually we could customize things with the lightmapper a bit more.
     
  34. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Try a higher pushoff value for the decals https://docs.unity3d.com/Manual/class-LightmapParameters.html. In large scenes 32 bit floating point precision will not be enough so you have to make sure the object is moved a bit from the raytracers point of view.
     
  35. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    We are working on it, stay tuned :)
     
    optimise and lolclol like this.
  36. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    No, not yet.
     
  37. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    The meta pass can only generate albedo and emission, the position is not modifiable in that pass.
    Passing UV2 in an AdditionalVertexStream is not implemented, but it could be done. Please file a bug report with your test scene and we will take a look at your use case.
    The proper way for exposing custom packing would be for Unity to provide an API for atlassing/packing, instead of you having to modify positions. We worked on it during a hackweek but there is more work to be done there. It is in the backlog but no promises on when it will be ready.
     
    XRA likes this.
  38. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    It is strange that you experiencing this issue - there is no reason why mixed lights would not work in your particular case (static lightmapped race track + dynamic vehicles). I have just tested a similar scenario in 2018.1.3f1 using shadowmask + a mixed directional light and everything was working as intended: a dynamic object (sphere) was lit by a realtime light casting a realtime shadow, and the environment was receiving a realtime direct light along with indirect contribution baked into the lightmap. Please see the image below:

    Unity_2018-08-30_12-36-14.png

    Could you please try baking your lightmap again using mixed lights? If you'd still happen to run into issues, perhaps you could upload a small repro project so that we could investigate the issue on our end? Thanks.
     
    JamesArndt likes this.
  39. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi,
    just today i did at least 5 attempts to lightmap a scene. It is not that big of a scene and i wait more than an hour every time on lower settings. Every time i am getting these weird issues where there are white spots like in the images below !

    Wonder what could cause this ? If i open the exr lightmap in image editor i am not able to paint on that area, it is like missing information.

    Lightmapping is really slow and tedious process because of these issues ( happening 90 % of the time ) and furthermore, the Progressive Lightmapper makes the whole compute unresponsive even on middle scenes. Any option to lower threads priority should be added because a PC becomes unusable while PLM is running.
    Enlighten does not affect PC performance that much while working though but it's kinda slow baker !

    THIS IS A LONG TIME EXISTING ISSUE NOW:

    What could cause this and how to avoid it !

    Currently using 2017.2.3 p1


    upload_2018-9-6_21-51-57.png

    upload_2018-9-6_21-52-24.png

    upload_2018-9-6_21-58-7.png

    upload_2018-9-6_21-59-6.png
     
  40. HenriSweco

    HenriSweco

    Joined:
    Aug 8, 2016
    Posts:
    28
    I used to have the same issue, but it hasn't appeared in a while.

    Is PLM still in preview for that Unity version? If so, you should upgrade to 2017 LTS if possible.

    I think technically it's not missing information(in photoshop) it's infinity white/black, which photoshop can't handle. A bug nonetheless. There was some way to fix it in photoshop but I can't recall.

    A temporary 'fix' might be setting the lightmap parameter 'Backface Tolerance' to 0 across the scene. It might also have something to do with lights intersecting geometry, or just geometry intersecting geometry.
     
  41. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Yep it is !

    Upgrade it's not an option when you are creating a package for the store and want to support lowest possible version !

    Most of the time appears on different objects actually and i feel that it happens in a scene where the load on the CPU becomes too big, it doe's not make sense but i think it happens mostly when PC resources are low - however not sure about that !
     
  42. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    I'll check this out again soon and get back to you. It's not entirely my use case though. I don't want the environment affected by any real time lights whatsoever. It's a mobile project so all lighting, shadows and GI needs to be entirely baked to texture maps. The only object affected by the real time light should be the kart itself.
     
  43. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    In this case, using culling masks (baked light for the environment + realtime/mixed light for the karts) would be the best solution. Looking back at your previous posts, seems like you've already discovered this solution yourself.

    Another possible solution would be writing a custom shader with fake specular, although not sure how feasible would that be in your case.
     
    JamesArndt likes this.
  44. Kubic75

    Kubic75

    Joined:
    Jan 2, 2017
    Posts:
    83
    UnityTechnologies,
    Please Don´t forget to give us a „Bake selected“ button.
    Its essential.
     
    SamAB likes this.
  45. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
  46. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    Has the bake caching broken in 2018.2.8? I change the filtering settings and it rebakes it all. Also what happened to the shaded wireframe mode in scene view?
     
    JamesArndt likes this.
  47. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    Cant help thinking it would be good to have more control of bake atlas's, such as being able to specify what geo goes into what map.
     
    JamesArndt likes this.
  48. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Yeah this was a big problem I was trying to talk about in another thread about the PLM CPU version. I needed control over what geometry pieces went on which atlases and found no way to do it. Supposedly tags or ID were supposed to be able to be used to tell the lightmapper which UVs went on which atlases, but it doesn't respect the setting.

    "That's why I was using the "Baked Tag" on these geometry objects via custom lightmap parameters, the documentation says it will force these objects onto the same lightmap and that's not happening. I need to keep the geometry separated for culling purposes so not really a workaround for that. I did pack these separate geometry objects onto one texture atlas in the hopes Unity wouldn't automatically shift and scale them around. I would intuitively think if forced on the same lightmap texture they would maintain their orientation and scale. I guess I'm coming from the workflow with Beast for baked lighting. It maintained the UV structure of imported UV2 coordinates."
     
  49. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    231
    The docs on "Baked Tag" -> https://docs.unity3d.com/2017.3/Documentation/Manual/LightmapParameters.html

    Basically it says:
    Objects with different Baked Tag values are never put in the same atlas

    and it goes on to say:
    there is no guarantee that objects with the same tag end up in the same atlas, because those objects might not necessarily fit into one lightmap

    However, we have a bunch of work being done in the packing area:
    1) Being able to set a count of lightmaps to use for a given bake tag (close to landing)
    2) Spatially coherent atlassing (also close but delayed because of 1)
    3) Pass through lightmap UVs - being able to do manual atlassing in DCC without Unity messing with the UVs

    I think 1) and/or 3) should help you.
     
    syscrusher and JamesArndt like this.
  50. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    "there is no guarantee that objects with the same tag end up in the same atlas, because those objects might not necessarily fit into one lightmap"

    This was a problem I couldn't solve. I tried literally everything, adjusting the "Scale in Lightmap" parameters, adjusting the map resolution, size. I even did all of the atlassing in 3ds Max first to make sure certain objects all fit nicely onto an atlas. However Unity would just go ahead and ignore that and scale and rotate the UVs on it's own to deem what it felt was the best packing. It even rotated my UV shells!

    It would still make lightmaps with huge gaps in spacing, super inneficient. When I could get a decent group of UVs onto one atlas they would be packed very inneficiently and I had no way to adjust the tightness of their fit, not to mention rotating my DCC created UV atlases.. It just made it extremely hard to get optimized, tightly packed UVs for my mobile racing game so I had to halt development until this was sorted out. I hope those points you've listed help with these things. That would be really awesome.