Search Unity

  1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  6. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

Progressive Lightmapper

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

  1. Kuba

    Kuba

    Unity Technologies

    Joined:
    Jan 13, 2009
    Posts:
    373
    Dear beta users,

    The latest Unity beta (5.6b6) includes an experimental version of the new Progressive Lightmapper. We are super excited to bring this feature to you and hope that it will considerably improve the workflow of those of you who work with baked lighting.

    Preliminary docs:
    https://docs.google.com/document/d/18dN_KWdF52ou7NXgbqhdB36kVFEyfmojn_JlCeoLN9Q

    We still have a few features incoming (see below) and some bugs to iron out. At the same time please note that the release in 5.6 will initially be marked as experimental.

    Coming very soon:
    • Directional mode support.
    • Transparency support.
    • Terrain Tree baking support (they affect the surroundings, but are using light probes themselves).
    • Improved area light sampling.
    • Filtering improvements

    Coming soon:
    • Support for Mixed lighting modes.

    Coming later:
    • Support for baking big scenes without high memory usage.
    • Baked LOD support.
    • Importance sampling of emissive surfaces.
    • Light cookies support.

    Known issues:
    • Probes positioned inside geometry can in some cases have non-finite values leading to bad probe lighting - please place probes outside geometry.
    • Undoing light probe editing can cause errors in the console, these should be benign.
    • Currently there is a maximum of 3000 lightmap static objects in the scene, more than that will fail.

    Hope you’ll enjoy it and rest assured that we’re working full steam to get the remaining features and improvements to you as soon as possible.

    Best regards,
    Lighting Team
     
    Vagabond_, Jaimi, spryx and 2 others like this.
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    4,040
    I'm assuming that includes any light with baked soft shadows, right? (because those are kinda noisy too and they never resolve)
     
  3. v3d

    v3d

    Joined:
    Apr 1, 2009
    Posts:
    65
    Very cool feature, long time awaited !

    A bug on negative scaled objects has been submitted : Case 877021 (posted screenshot on another post, Progressive vs Enlighten)

    One suggestion : Indirect Resolution should be greyed out when using pure static baking with Progressive, since it has (if i'm correct) no influence at all in the new Progressive Lightmapper !

    Keep up the good work !
    Thanks
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    4,040
    Also, it seems like the preview for the progressive lightmapper is clamped. I mean some overbright areas in the lightmap seem clamped while it's baking, but once it's done it seems they appear properly.

    Is it a bug, or is it done for performance reasons?
     
  5. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    149
    Hey @v3d
    Currently, this is by design and in future, there will be a better way to handle backfaces (a two sided flag will be added) and for now, the workaround is to set the backface tolerance to zero in lightmap parameters (see the attached GIF below)
     

    Attached Files:

    Last edited: Feb 2, 2017
    buttmatrix likes this.
  6. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    In the next build large Area Lights will converge much quicker. You will also be able to specify how many samples to use for direct lighting (currently its locked to 32). This should allow any soft shadow to converge properly.
     
  7. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    Thanks for submitting the bug. Yes we will grey it out if you also disable realtime GI.
     
  8. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    What exactly does clamped mean? But no it pretty much does all the compositing while baking progressively. It does not do the lightmap compression though.
     
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    4,040
    Clamped means... clamped :) High brightness values are clamped. return clamp(color, 0, 2);

    Example:

    I have a VERY bright point light next to a wall.

    Here is how it looks while it's baking:

    notdone.jpg

    Here is how it looks after it's finished:

    done.jpg
     
  10. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    Do you have any reflection probes in that scene just wanted to make sure that its purely baked direct lighting thats clamped. What does the 'Baked Lightmap' scene view look like in those two cases?
     
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    4,040
    I don't have any reflection probes no.

    And it's not just baked direct, it's any light, it could be indirect if you somehow manage to get it really bright.

    Baked Lightmap view looks "correct", since all the materials are white. It mostly happens when using dark materials.

    To reproduce you need a really bright light source (more than "2"), and a dark material (darker than 128,128,128).

    (I can make a repro, but it'll have to wait until tomorrow)
     
  12. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    Wow... this progressive lightmapper is freaking sweet... and in my Sanctuary level, the lighting looks even...
     
  13. Owers

    Owers

    Joined:
    Jul 7, 2012
    Posts:
    27
    Exciting stuff, I'm really looking forward to this. One issue so far: the light attenuation between dynamic and baked lights don't seem to match in the progressive lightmapper, baked lights always seem to be a bit brighter than dynamic lights, even when using linear colour space. When using Enlighten backend they are almost a perfect match (but only in linear colour space). This could become a problem because there will be visual discrepancies between static and dynamic lights, and I can see some users struggling to maintain consistent lighting in their scenes if they use mixed lighting modes. I've attached some screenshots for comparison:
    enlighten.png progressive.png

    It would be great if you could bring back the "Show Lightmap Resolution" toggle, for some reason it has disappeared in the 5.6 beta. It would be nice to turn off the checkerboard pattern so we can see the quality of our lightmap bakes.
     
    buttmatrix and Peter77 like this.
  14. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    I am truly liking that I can see my scene lighting in one spot before it is finished... but sometimes when you build a level, not everything is built in one whole piece. Is there a way I can implement a blocker mesh to keep the light from spilling through? Example, that harsh light on the roof? In reality, that would never happen like this... Screenshot 2017-02-02 22.16.53.png
     
  15. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    True, we haven't matched the point/spot falloff yet. We will prioritise this.

    "Show Lightmap Resolution" toggle will be back - this is a bug. In the whole UI refactor it somehow got lost.
     
    buttmatrix likes this.
  16. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,734
    I've just downloaded the Beta to try it for myself a little. Just with a probuilder test so far. But before I try to find the time to dig deeper into this I have to say:
    So far the most useful thing about the progressive lightmapper has to be the ETA of the bake!
    It's so great to actually see (and not only guess) how much a setting will influence the bake time. This makes prototyping so much easier and better, throughout. Can't wait for this feature to progress into a stable work version. :)
     
    Roni92pl and KRGraphics like this.
  17. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    +1. And the fact that I can focus on ONE AREA where the camera is facing and bake that... the one thing I do ask is if we can try to revert to the pre-Enlighten behaviour of baking lightmaps to prefab... thus is extremely important especially for prefab heavy assets like UFE
     
    Last edited: Feb 5, 2017
  18. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    21
    I must to tell that the new progressive lightmapper is impressive. I have used the system in old scenes that was impossible to obtain a good solution with enlighten and now i see perfect all the assets. Really good work.
     
  19. KarolisO

    KarolisO

    Joined:
    Feb 2, 2014
    Posts:
    9
    So far the progressive lightmapper is nothing short of impressive.

    There is still one issue I would like to see addressed that made Enlighted completely unusable for my projects - the lack of lightmap dilution/padding. There is no reason to have any non-padded pixels on a lightmap.

    The progressive lightmapper seems to generate some padding, but it is not nearly enough to avoid black lines when looking at surfaces from far away.

    I hope this issue will be addressed.
     
    Ostwind likes this.
  20. jldevoy

    jldevoy

    Joined:
    May 2, 2014
    Posts:
    31
    I wish i'd found this forum earlier, spent ages trying to fix the negative scaling problem. So far i like the new lightbaker, gives you a much faster idea of what it's going to look like.
     
  21. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    149
    Hey @KRGraphics

    If I understand you correctly, you want to use prefabs with baked lightmaps in your scene, right?

    If so, that's already possible regardless of which backend you use. I'm attaching a project that allows you to perform what you describe.

    In the project, you will find two scenes. Open the scene `LightmapInstances` and play the scene. Press on left mouse button, all the instantiated spheres are prefabs with baked lightmaps from Progressive Lightmapper.

    You can bake your lightmaps in another scene. In the project, you will find another scene called `BakeLightmapPrefabs`. You will find a baked directional light in the scene and some lightmap static prefabs. What you have to do is to attach PrefabLightmapData.cs as a new component to your prefab, add your prefab to this scene (BakeLightmapPrefabs) and then, press (Assets > Bake Prefab Lightmaps) button (It's important that you don't bake the lightmaps using `Generate Lighting` button but instead, use this custom button).

    Now go back and open `LightmapInstances` scene again and press play, you should see that prefabs read their lightmap data. Another important point to highlight is that this scene also needs lighting data asset, so even if there are no lights, you should still generate the lighting. Lightmaps generated through `PrefabLightmapData` will overwrite the existing lightmaps in the scene and use the lightmaps you previously generated.

    I hope that answers your question. Let us know if this solves your problem.

    Thanks!
     

    Attached Files:

    KRGraphics likes this.
  22. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    Yes, we will address this issue ASAP. We are aware of this and it is on the roadmap.
     
  23. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    Kinda. When I do a standalone build for my game, all of the lighting is lost. In UFE, the levels are actually prefabs of your scene... when a standalone build is done you lose ALL of your lightmaps.

    And I've used a similar script and that stuff doesn't work correctly
     
    Last edited: Feb 6, 2017
  24. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    149
    Please ensure that auto mode is disabled. If you try the project attached above, that shouldn't be the case.

    Thanks
     
  25. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    I'll test the scene and do a standalone build to see what happens
     
  26. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    So it looks like it works in the standalone build...but only if I hit play. THANK YOU!! I've been trying to get this to work in 5.5 and it is very flaky. Hopefully, I will be able to use this with UFE once they update their toolset to work with this... And it is easy to set up... would it be possible to add an option to this for the Progressive Lightmapper?
     
  27. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    302
    is this the real life? is this just fantasy?

    can we bake a scene in this beta and somehow use this bake info in the same identical scene in version 5.5
     
  28. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    Compatibility with earlier versions of Unity is not something we are supporting. With the addition of lightmodes the lighting data is very different. Also, we have removed directional specular. Also, the version of Enlighten (for realtime GI) is different now. There might be some narrow scenario where this would work - but I very much doubt it.

    Possibly you could grab the lightmaps and extract the per instance offsets and scale, but again its not something we support.
     
    hakankaraduman likes this.
  29. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    263
    Is the 3000 object limit is a memory restriction at the moment?
    Going forward will additional LOD's be considered part of the object limit if they are included in the bake data?

    Many thanks for all your work on this guys, its a fantastic feature!
     
  30. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    Does anyone know how to use blocker meshes with this? Trying to figure out how to stop the photons from leaking through? Thanks
     
  31. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    4,040
    No photons. This is a brute force method. So leaking is something else.

    Try disabling filtering and see if that helps. If it doesn't, post an image, since I can't think of anything else without seeing the scene.
     
  32. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    Screenshot 2017-02-09 12.35.32.png

    Taking a little more time with the progressive lightmapper, and I am still seeing the same issues I ran into before when using this... and I notice that light probed objects will stick out like a sore thumb...

    Even with LPVs.

    Screenshot 2017-02-09 12.56.19.png


    I may as well just stick to just using straight up light maps, just to keep the look consistent... Most of my levels will be small so it is not an issue. Will there be a way to fix this so that I will be able to use light probes on moving objects and it will look consistent?
     
  33. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    It is probably because of the way I modelled my dojo level... in pieces... and sorry, I am used to using mentalray so photons always slip out lol...

    Here is an image of what I am dealing with. Unless this is the actual behaviour of this, it is probably something I am doing.

    I also don't have textures on my model since they are part of another scene in 5.5 and I don't feel like bloating my hard drive on the beta...

    See that bright light on this corner? Unless this is intended behaviour, I shouldn't worry too much... my favourite part of this lightmapper... I can see how much time it will take... and the results are always consistent...
    Screenshot 2017-02-09 13.07.15.png
     
  34. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    4,040
    Hmmm, I can't really tell what is going on.

    Do you use high multipliers for indirect? It kinda looks like it's bounced light from the floor outside?
     
  35. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637

    My light intensity is 1.5 for the sunlight. In 5.5, I have Shoji screens covering the windows with a transmission shader... and I have no textures in this test
     
  36. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    149
    Hey @KRGraphics

    You can use mesh blockers with one texel that are invisible to camera to author your lighting. In progressive lightmapper, it is utmost importance that you have watertight meshes (i.e. vertices of your mesh are welded) to achieve correct results, otherwise you can easily end up with artifacts/unwanted results.

    What do you mean by this? Like, adjusting the brightness of your light probes?

    What AcidArrow asks is about the indirect intensity of your light source and not the intensity (direct). Have you perhaps modified that value?
     
    buttmatrix likes this.
  37. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    I set that indirect intensity to 4. Though I should dial that down in the final test, mainly because the room gets very dark unless I tone map.

    And unfortunately, when I modeled the dojo, I approached it architecturally and have it in pieces.
     
  38. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    Indirect intensity of 4 will generally cause a scene to look incorrect if combined with bright albedo colors. Try dialling that down somewhat. If it is too dark (because not a lot of light is entering) you probably need some fill lights inside if you want it to look brighter. Pieces should be fine, try using the "Texel Validity" visualzation mode in the scene view to see if non-watertight meshes are causing issues. Large visible areas of red would mean there are issues.
     
  39. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,637
    I used that feature, and I saw a few bits of red that didn't bother me much... and also too my goal for this level is to simulate light coming from outside... it's an old dojo, like the scene from The Matrix, when Morpheus was fighting Neo... In Unity 5.5, the light is dialed down considerably and in its place, I am using tone mapping...
     
  40. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    137
    I gave it a shot today and we can't use it, as long as we don't have support for transparencies (which is on the roadmap, as I've read above).

    What I noticed is, that most of our shaders need at least a recompile (change shader file, undo, save) in order to work.
    Some didn't work at all ... the meshes just were invisible. Don't have anymore time left right now to try to fix them.

    @Kuba You state, that the lightmapper will be flagged as experimental on release.
    What does this mean in terms of enlighten lightmapping?
    Will this remain in the build for the whole 5.6 life cycle?

    With our current game project, we will be stuck with 5.6 for at least the next 1.5 years (due to the drop of Win 8 support after 5.6) and we need a 100% working lightmapping solution (which enlight right now would be).
     
  41. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    257
    Enlighten isn't going anywhere. You can pick which lightmapper to use.
     
  42. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    21
    One question about features.... which features we will see in the first release 5.6?
     
  43. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    21
    Does the system ignore the "cast shadow" property of a mesh?
     
  44. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    149
    Hey @AlbertoVP

    We'll add directionality, transparency, filtering improvements and area light sampling improvements very soon and within 5.6 cycle, we plan to add mixed light modes support, memory improvements and LOD support. We're doing our best to deliver them.

    And yes, in progressive lightmapper `cast shadow` property is currently ignored, that'll also be added later, it is a known issue and in our to-do list.

    Thanks
     
    Last edited: Feb 15, 2017
    Gametyme and Lars-Steenhoff like this.
  45. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,101
    great stuff! and while looking at shadows, perhaps you also can smooth filter the realtime shadows, as they are blocky.
     
  46. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    149
    Addressing shadow maps are on the roadmap ;)
     
    Lars-Steenhoff likes this.
  47. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    This is amazing! The speed of iterating lighting is unbelievable. Good work!

    I was searching around a bit and looking for one option, baking direct lighting into light probes? Is it currently supported?
     
  48. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,434
    Is it a known bug or by design that the progressive lightmapper completely ignores the cast shadows property of a mesh renderer? It works with Enlighten.
     
    Last edited: Feb 22, 2017
  49. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    We didn't get to that yet but will add it very soon.

    Cheers,
    Jesper
     
    Ostwind likes this.
  50. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    98
    Yes that is supported, however the awesome new lightmodes that we added in 5.6 are not supported yet in the progressive lightmapper, but they will be very soon.

    Cheers,
    Jesper