Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Unity Progressive CPU Lightmapper

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

  1. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    926
    Well, actually the automatic unwrapper should do the job - the point is that they are not always comparable to custom made UVs but you should be fine as there is a stitching algorithm as well.
    However, have you tried the A-Trous filter. This is the more advanced one - which is doing real denoising and not like the gaussian which is more of a blurring filter.
     
    Last edited: Apr 21, 2018
    JamesArndt likes this.
  2. Sentionaut

    Sentionaut

    Joined:
    Apr 27, 2015
    Posts:
    10
    Oh, yes, it usually does the job. On previous versions, it would sometimes get buggy and skip certain objects, on which situation the only solution was to manually unwrap those specific meshes, but it did the job in general. However, since it's being so slow and erratic now, I was just wondering if the lack of UVs is being part of the reason... I hope not, honestly.

    And thank you for the advice, but yes, I have tried the A-Trous filter. It still looked bad on my scene, so I switched back to Gaussian, which is the default. Just in case.
     
  3. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,677
    Funny just to test things out to make sure I had no illusions about Beast vs. the new lightmapping I installed 4.72 and imported in my same race track as I have in 2017.3. The Beast lightmaps the entire scene every time in less than 2 minutes with high quality lightmaps. No issues I can see. Sure I don't get fancy global illumination or raytraced bounced craziness, but I get solid looking occlusion and shadows in less than 2 minutes at very high quality. Awful to move into 2017.3 and try to lightmap the same scene. Takes at least 10 minutes and the quality looks blurry and awful. If I bump up the resolution my entire system will freeze up out of memory. I've been a Unity user for about 10 years now and this is the worst I've seen the Editor lightmapping workflow. Both lightmappers not working correctly or inefficiently and worse Unity keeping us in the dark on how to easily and quickly get bakes that look great and in minutes, not hours. I did see another thread where a Unity developer linked a workflow web site that was several pages long with thousands of lines of obscure settings and directions to reduce bake times. It's just like off the chart insanity at this point to expect every day users to go through that "pipeline".

    A YouTube video demonstrating my current lightmapping issue:



    Below is a description of my problem:
    Using Unity 2017.3.0f3 on Windows 8.1 Pro (Progressive Lightmapper)

    I brought these geometry pieces into Unity with the all of these asphalt track sections on a single UV atlas, with the geometry all separated for culling purposes. Unity sees them as individual pieces of geometry (as they are), but I need a way to tell the lightmapper they are all on one atlas. The UV set I created in 3ds Max has all of these geometry pieces fitting on one texture and is optimized for little wasted texture space. I am applying both a custom Baked tag and a System Tag to these specific pieces of geometry using a custom Lightmap Parameters file for said objects. Adjusting the "Scale in Lightmap" on these objects is making no difference in their layout or packing. The packing and layout appears to be being altered somewhere in the process (not preserving my 3ds Max layout).
     
    Last edited: Apr 21, 2018
  4. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,677
    Upon close inspection the UVs all appear to be flipped in the Y axis and scaled in Unity to different resolutions, even though they all share a "Lightmap Scale" of 1.0. On the left are the baked UV charts within Unity and on the right are my UV2 coordinates laid out in 3ds Max. Again I do not have "Generate Lightmap UVs" checked on the FBX import settings in Unity, so no idea why scaling and flipping is occurring on these same UVs in Unity.

     
    Last edited: Apr 21, 2018
  5. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,677
  6. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,376
    My main issue is that Half-life 1's lightmaps are way lower resolution, but have no bleeding issues. See these screenshots.

    See how smooth and bleed-free these HL1 engine lightmaps are. No bleeding at all, even though they must be very small resolution. There are some issues where the geometry has been cut, but that's all.
    hl1.PNG hl12.PNG hl13.PNG

    Compared to Unity:
    unity.PNG unity2.PNG

    Luckily, I'm always making realtime games, so it hasn't been an issue.
     
    JamesArndt and dadude123 like this.
  7. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    790
    I noticed that as well. It's horrible I tried adjusting padding size but it just won't help.
    I wonder why thats such a huge problem in unity when hl1 can look better with lower res :/
     
  8. Owers

    Owers

    Joined:
    Jul 7, 2012
    Posts:
    37
    I don't mean to derail the progressive lightmap thread any further, but I noticed you were having trouble with this and would like to give some suggestions. It looks to me like these road segments are separate mesh objects (Asphalt_01, Asphalt_02, etc), but you've packed their UVs together in 3dsmax as if they're one object. When Unity builds a lightmap atlas, it will automatically pack lightmap UVs together per-object, so your UV2 layout from 3dsmax is going to be overwritten (and become less efficient due to the empty UV space each object has to accommodate the other separate objects). To fix this, consider merging these objects together as one in 3dsmax (forcing Unity to use your packing layout, but removes the culling you want), or unwrap each object with their own separate UV2 layout and let Unity pack them for you in the lightmap atlas.

    Also, I wouldn't obsess too much about baked UV charts. It's basically showing you how the lightmapper is reading the geometry in your scene to sample GI (based on data like vertex normals and UV seams, etc). It has nothing to do with packing and tags. If you want to know which objects are sharing the same lightmap atlas, use the Lightmap Indices debug view.

    As for the UVs being flipped on the Y axis, it might be caused by the up axis being converted between 3dsmax and Unity (Unity uses Y, 3dsmax uses Z). It shouldn't really matter for lightmaps.
     
    Last edited: Apr 23, 2018
    JamesArndt likes this.
  9. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    230
    As an even more extreme example, here is a Quake 1 map (to be fair it's using updated tools, but still amazing that a game built on 22 year old technology often has less baked lighting issues)

    https://twitter.com/SimsOCallaghan/status/988115982223839232
     
  10. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,677
    Yeah 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.
     
  11. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,677
    Using Unity 2017.3.0f3 and I cannot for the life of me find the docs for Lightmap push/pull dilation and or find the toggle or settings for this in the Editor.
     
  12. Sentionaut

    Sentionaut

    Joined:
    Apr 27, 2015
    Posts:
    10
    Just on update on my previous post.
    I've been baking with Progressive on the other levels of the game, and it seems that timings are not different with this lightmapper, BUT it does look jaggy and noisy. The one that's going way too slow is Enlighten.
    After three days, I managed to bake the lightmaps for the scene I mentioned with Enlighten, which looks better than Progressive right now. I've had to bake the other scenes with Progressive today because they're bigger and I can't afford to spend so much time on them. Fortunately, in these scenes the camera is placed farther away from the camera, so the bad quality that Progressive is giving me it won't be so obvious.

    In any case, none of the lightmaps I have could be used for a final version of the game. We're still some months away from shipping, but I'm worried this won't get fixed soon enough.
     
  13. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    tbh i just hope they really look at the baking tool in the context of actual production, because the UV layout is poor, the shadow mapping is poor, and you cant rely on updates when you are in production. We are stuck at a certain version because newer updates have fixed one issue but broken another.

    I've certainly not enjoyed the process.
     
    Lars-Steenhoff likes this.
  14. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,260
    yes the uv layout is not optimised
     
  15. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,030
    I understand that in 2017.3, the PLM should bake tree shadows on the terrain....but it's not working very well for me. I want to do a Distance Shadowmask, but the baked shadow on the terrain is a huge dark area encompassing the forest, rather than per-tree shadows. See screenshot. I've tried various settings, I've set the tree model to Lightmap Static and Scale in Lightmap to 0, no help. I've increased the Lightmap resolution, no help -- and even here set at 25, it should be plenty good enough.

    The ginormous shadow is the main issue, but the tree billboards also don't have any lighting information, so they look bad (either too dark or too light, depending on the scene) as billboards, and then very visibly get lighting information when fading to tree models on approach.

    Am I doing something wrong?

    Screen Shot 2018-04-24 at 3.22.02 PM.png
     
  16. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,376
    I don't remember having any options like that.
     
  17. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,677
    They were touting this as a feature of 2017.2 some time ago. Not sure if it was exposed or not now that I think about it, says it's "background". I don't why it wouldn't be exposed as it appears to be an important "padding" setting for lower mips.

    Lightmap background (push-pull dilation)

    https://blogs.unity3d.com/2017/10/12/unity-2017-2-is-now-available/

     
  18. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    558
    Did you see my post above? For some reason all the scale in lightmap settings are EXTREMELY high in this version of Unity causing extremely long bake times and large maps. Set them to 0.02 or 0.1 and see if it helps.
    You got to do this on all models being baked for some reason I am pretty sure it's a bug with the scaling.
     
  19. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,677
    Frankly I'm very surprised to see zero responses or activity from any Unity staff. This is a core pinned thread for the Progressive Lightmapper. So many issues I've seen brought up in here and no feedback to get folks and myself the answers we need. My own personal question is very simple: Why are my geometry sections not respecting the baked tags and why are they being moved and flipped and scaled?
     
    Aniow, buttmatrix and SilverStorm like this.
  20. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    As far as im aware, scale doesn't quite work like this, its like a tug of war between scale and Lightmap resolution.

    eg. Object bake scale of 1 and lightmap res of 10 is same as object scale of 0.5 and lightmap res of 20, or an object scale of 2 and lightmap res of 5.

    To be honest its all dependant on how many lightmaps you are able to bake as the scale relates to how much UV space an object is allowed to have. Best bet is to look at which object needs to most resolution and work from there.
     
    JamesArndt likes this.
  21. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    do your materials have 'double sided GI turned on' I was having nasty shadow and bake issues when it wasnt on my trees.
     
  22. adpok

    adpok

    Joined:
    Oct 26, 2017
    Posts:
    28
    yeah i found the A-trous didnt help either, im having to blur shadows in photoshop.
     
  23. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,376
    I remember that. Blender has an option for how big you want the margin to be after baking ambient occlusion, so that no black leaks in. We should have these options exposed too.

    I get nothing like that image you posted. I still have tons of black in my lightmap. There are some of the larger coloured squares, but not the small ones around the edges, which is what I need.

    My lightmap looks ok (not perfect) with Point filtering, but when changing to Bilinear the seams are obvious. It's not doing the correct dilation like in that image. If I zoom into the Object Maps > Baked Lightmap, there is some tiny margin around the UV's, but not enough. I just retried it in 2018.1b9 and it's the same lightmap... Increasing the padding in Generate Lightmap UV's doesn't help.

    I don't see why they can't do a basic dilation like Blender's... It doesn't seem hard.
     
    Last edited: Apr 26, 2018
    JamesArndt likes this.
  24. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,677
    That's why I was asking about. I've spent a ton of time looking at my charts, my baked maps and every other aspect over the last few weeks. I see none of this dilation occurring so I wanted to ask if it was removed or hidden or what's going on with it? I just do not understand why their cannot be a built-in lightbaker for mobile or lightweight stuff. Something as simple as what Beast was. I'm not looking at Beast with glittering eyes either. I just reinstalled 4.72 to test out bake times, quality and quantity of maps, UV layouts, etc. Now I provide my own lightmap UVS so I can't speak for Beast's auto UV layouts, etc...but overall the experience is light years beyond Progressive Lightmapper. Now I know this makes it sound like Progressive is a step backwards. I don't know anymore. With Beast bake times are very, very fast. Quality is good for mobile. It bakes minimal maps out, at least for me. What takes 24 maps in Progressive, bakes about 6 or 8 Beast. Now I don't want to go back to Beast, but can't Unity just implement a simple light baker that works similar. Nothing super fancy with bounces and all of that jazz, just straight occlusion and shadow baking? Take in my UV2 lightmap UVs and don't rotate them, scale them or auto place them, just leave them as they were authored.
     
  25. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,376
    I have noticed another problem - lack of light bouncing. The light won't bounce well through this vent, even at 4 bounces.

    Enlighten then Progressive:
    progressive1.PNG progressive2.PNG

    I assume this is what "Light Transport" in Enlighten does. Unreal also has a result like Enlighten, but Progressive fails to do it even when ramping up Albedo/Indirect Intensity boosts.

    Because of the GPU support, will it be updated with more advanced light propogation?
     
    JamesArndt likes this.
  26. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,030
    Thanks for the tip, but hmm, those options are gray/disabled on my tree materials. I've checked a number of different trees' materials, they're all grayed out. They're all Tree Creator trees, FWIW.
     
  27. Thall33

    Thall33

    Joined:
    Sep 18, 2013
    Posts:
    57
    Can we get an example on how to bake and use the occlusion probe please? There's really no example how to use it :/
     
    JamesArndt likes this.
  28. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,028
    Try adding more bounces.
     
  29. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,041
    What the hell happened to this thing?!

    I was using Unity 5.6 for the longest time with the progressive lightmapper. My 512x512 square meter scene would take 20 minutes to light with 250 samples at resolution of 15 texels per unit. Very, very reasonable. I configured all the prefabs precisely for lightmapping. The lightmapper would bake at about 4+ mrays per second on my core i7 8800.

    My company's project just upgraded to 2017.4 and the lightmapper now bakes at a staggeringly awful 0.5mRays/second, sometimes 0.1 in the same scene. Regardless of the resolution settings, you've bottle-necked the performance somehow.

    5.6 Stats window. This completes in 3 minutes. Look at the bake performance:


    2017.4.2f2 Stats window:
    It says about 30 minutes to bake. But, the lighting never completes. It just keeps churning my cpu.


    Why is Unity only using 10% of the rays that were previously used? Cmon guys! This is killing me.

    Just for a bit of context: it's a nature scene (512x512) where the terrain is a series of large mesh chunks. Those chunk are static, but some are set to 0 atlas size for testing. I also have numerous cartoony mesh trees (no transparency) also with an atlas size of 0 since their lighting will be taken from probes, but I need static shadows.
     
    Last edited: May 21, 2018
    buttmatrix likes this.
  30. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,041
    Bump. I'm actually looking for an answer. Maybe this is a bug?
     
  31. Fallc

    Fallc

    Joined:
    Mar 13, 2015
    Posts:
    48
    I'm not sure if the issue is known,

    but I'm unable to bake a large scene with an atlas resolution of 4096. Unity starts baking with 90% CPU load, then drops to ~15% after a minute. No ETA shows up in the status bar, just "Baking...". Im using 2018.1.1f1
     
  32. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    1,960
    Any update on the GPU lightmapping? Or estimated time
     
  33. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,041
    Unity doesn't respond to this thread anymore.
     
    Last edited: May 21, 2018
  34. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    1,960
    Could you try downgrading to an earlier version?
     
  35. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,030
    @Jesper-Mortensen Any chance of getting replies to this and other issues reported here lately?

     
  36. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,041
    That's not an option. I couldn't build the project in 5.6 using the progressive lightmapper despite it being faster. Now, with a completed scene, it just churns endlessly.
     
  37. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    838
    I use PL and three realtime point lights on terrain.
    When player's camera is around where 2 point lights collide, there happens a blackout: sudden very short black screen.

    1. If I rotate the player's camera for some angle , point light is shut off. If I rotate it again, light is back on. As if light is culled based on an camera angle.
    2. Why is this happening and how to avoid it?
     
    Last edited: May 24, 2018
  38. ArthurianRedux

    ArthurianRedux

    Joined:
    Mar 7, 2014
    Posts:
    2
    Hi Unity Lighting Team!
    I have a quite big scene in my project, about 5000x5000 units.
    There is a heavy artefacts definitely related to direct part of light.
    As soon as you move about 2000 units from origin, and rotate it even a little bit, it appear more and more.
    No problems when rotation is (0,0,0)
    Very easy to reproduce, with standard cubes or any geometry with lightmap UV.
    Please help!!!
    screen1.jpg
     

    Attached Files:

    Aniow likes this.
  39. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    838
    Try to remove directional light. I also have similar artifacts. But, if I remove directional light, they're are gone.

    What pipeline are you using ?
     
  40. ArthurianRedux

    ArthurianRedux

    Joined:
    Mar 7, 2014
    Posts:
    2
    Artefacts are coming from directional light, doesn't matter how it rotated. I'm using very standard pipeline, differed, distance shadow mask, progressive lightmapper, mixed lighting.
     

    Attached Files:

  41. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,028
    So I realise I'm quoting a really old post, almost a year ago, but I also submitted this bug (case 936693) a year ago and at this point I'm kind of losing hope it will be fixed.

    I see in the bug tracker that it's still open, although, weirdly, I see no entry for it on the issue tracker, so I really don't know if it's going to be fixed. I did see something about supersampling in release notes at some point, but I'm guessing it was for something else?

    Because it still happens in 2018.1.4f1 and it's kind of a drag.

    I mean on the bright side, it has turned the baking process into an interactive one, where I hunt down problem areas with prioritise view first so they are clean, but after doing this for so long, I just wish I could just click Generate Lighting and it would just produce the results it should.

    And I mean.

    prioritizeview.png

    Left is with prioritize view and right is with a normal bake. Both with the same settings. Both finished baking.

    I mean admittedly those both don't look great since the texel density is kinda low, but the left is pretty clean and passable and in the normal textured view it looks just fine. While the right side looks needlessly noisy and jittery and it stands out in the scene, and not in a good way.
     
    JamesArndt likes this.
  42. Pr0x1d

    Pr0x1d

    Joined:
    Mar 29, 2014
    Posts:
    27
    Something is wrong with 2018.2.0b9 progressive gl.

    I am trying the book of dead and I cant bake the scene with progressive and its saying that I need to use progressive to have tree occlusion.

    So I made new scene put static plane in there.
    upload_2018-6-20_13-29-14.png
    (Put the smallest setting possible I think)

    It was baking 5+ min, in 2018.1 I can bake it in a second, whats wrong with this version? plese help
     

    Attached Files:

  43. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    388
    Hey! I was not able to reproduce this issue on 2018.2.0b9 using the exact same setup. Does this also occur when you create a new project?
     
  44. Pr0x1d

    Pr0x1d

    Joined:
    Mar 29, 2014
    Posts:
    27
    Just tried new project and it baked like in around 10s so I dont know what was added in the book of dead project that slowed progressive lightmapper.
     
  45. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,028
    Hey devs. I realise you are super busy, but:

    It kind of feels like GPU PLM is strategically ignored/not talked about, and fixes for the CPU PLM are sparse (and new features a pipe dream).

    So all I'm saying: An update on what's going on would be nice, even if it's bad things.
     
    scvnathan and ArchVizPRO like this.
  46. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    348
    Also at Unite Berlin for Progressive GPU was not announced any ETA. :(
     
  47. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,379
    Agree, the current underutilize CPU of PLM are bothers me, it make the lightmap baking quite slow
     
  48. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    201
    We have some fixes for CPU underutilization in the Progressive Lightmapper coming in 18.2. Likely in one of the early patches. And we are working hard on the GPU Lightmapper, have hit some snags with stability on certain common cards but we are working to resolve that. We are mostly feature complete except from some minor options. Plan is still to release GPU PLM this year if everything goes well.
     
  49. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    201
    Yes, this bug is very annoying. We did find something that we believed was the cause but after QA restested on this level it was still reproducing. It is on our radar though, rest assured we will get to it.
     
  50. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,260
    Here's my take in the gpu lightmapper:
    my plan is to buy a new video card when the gpu lightmapper comes out, what ever the ones that works best at that time is the one I will get.
    the times it saves me can easily justify the cost of a new card.

    Would be nice if it comes out this year at least in preview, even when only working on a few cards. final stable version can come later.

    Thanks