Search Unity

Official Progressive CPU Lightmapper

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

  1. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Excellent! This is looking very good. I spent an evening just enjoying moving lights around, watching the update and doing full bakes that took only 20 minutes.

    Only complaint is that it was a bit of a downer going back to work the next day, where we use A Different Engine with a classical lightmapper. Workflow as follows:
    1. Adjust light.
    2. Wait five minutes for lowest quality bake of the whole scene to get an impression.
    3. Adjust light again, because it was still off.
    4. Wait again.
    5. Adjust again.
    6. Wait again.
    7. Run out of patience and accept a "almost close enough" solution, other tasks need doing.
    8. Wait for day to end to start a two hour production quality bake.

    Progressive Lightmapper == Gamechanger.
     
    Jaimi, KRGraphics and McMayhem like this.
  2. McMayhem

    McMayhem

    Joined:
    Aug 24, 2011
    Posts:
    443
    It really does ruin you for other lightmappers. How often do you get an increase in both quality AND speed?
     
  3. HeliosDoubleSix

    HeliosDoubleSix

    Joined:
    Jun 30, 2013
    Posts:
    148
    Transparency doesn't quite work how I would expect, say a cube intersecting another cube with the one being transparent say with railings texture that is strips of 100% and 0% opaque. It ends up causing either very dark intersection or worse lots of back face culling glitches if the transparent object has exposed back faces

    Below with solid cubes
    upload_2017-3-3_12-56-44.png

    Marking the meshes as transparent in the gi settings makes no difference either.

    below with planes with exposed back faces:
    upload_2017-3-3_13-3-35.png
     
  4. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Yeah, it is invalidating the stuff inside the cube as that is seeing mostly backfaces, we are working on a fix for this, can you try setting backface threshold to 0 for the wall? The new 'texel validity' scene view should show whats up too.
     
  5. HeliosDoubleSix

    HeliosDoubleSix

    Joined:
    Jun 30, 2013
    Posts:
    148
    Ok thanks, setting threshold to 0 on the wall is a work around sure, it only has a slight darkening then ( no AO on either )

    0 alpha shows darkening:
    upload_2017-3-3_13-29-2.png

    upload_2017-3-3_13-28-53.png
     
  6. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    We'll open a bug for this - clearly shouldn't happen with alpha 0.
     
  7. HeliosDoubleSix

    HeliosDoubleSix

    Joined:
    Jun 30, 2013
    Posts:
    148
    Gets a bit weird still with shadowed areas:

    upload_2017-3-3_13-31-36.png
     
  8. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    What does the `texel validity` view show?
     
  9. HeliosDoubleSix

    HeliosDoubleSix

    Joined:
    Jun 30, 2013
    Posts:
    148
    Just all green, just using Unity primitive cubes and planes

    The baked lightmap view shows them as opaque also:

    upload_2017-3-3_13-39-1.png
     
  10. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    The baked lightmap view just shows whats in the lightmaps, doesn't show transparency etc. I guess it should be darker inside the cubes (or planes) with the banisters enabled as less light gets there, but the problem may be that the paths that hits the opaque part of the banister (on the backface) get terminated and don't continue bouncing, which makes it too dark and unnatural, we need support for 2 sided materials in the lightmapper to fix this. I have that mostly working, so keep tuned. What happens if each plane has a matching backface so two places near each other to simulation 2 sidedness?
     
  11. HeliosDoubleSix

    HeliosDoubleSix

    Joined:
    Jun 30, 2013
    Posts:
    148
    if I give them matching back faces it makes no difference

    And below I made it even more transparent to be more obvious:

    Look as if it is opaque to indirect light and only transparent to direct light

    upload_2017-3-3_14-7-43.png
     
  12. HeliosDoubleSix

    HeliosDoubleSix

    Joined:
    Jun 30, 2013
    Posts:
    148
    Looks opaque to this emissive object:

    upload_2017-3-3_14-15-22.png
     
  13. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Ok, we'll investigate this as a bug, any chance of a copy of project so we can verify after we fix it?
     
  14. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    Really impresive the new features of the lightmapper. Two question

    Could we use real falloff for the lights?
    Could we have a different emission power for the GI?
     
  15. Kellios11

    Kellios11

    Joined:
    Jun 6, 2016
    Posts:
    6
    Hello,

    I was wondering if there was going to be any plans to implement a directional specular-like system into the progessive lightmapper that is fully baked? Are we going to be forced to always have a realtime light in scene in order to get specularity? We are working on a VR game, so naturally we don't want to have realtime lights when they aren't needed. Our team has been happy with the results of directional specular (even with its quirks) and losing all of its functionality going forward is a giant regression in visual quality for us.

    I've tested out some of the beta here - but it still lacks the basic functionality of baked directional-specular from 5.4 and earlier. I'm currently stuck now at how to proceed, since my team is being forced to upgrade to Unity 5.5 for other bug fixes needed in that version, but if I have to rebake lighting, I will be unable to. Deprecating directional specular in 5.5 but NOT implementing an alternative solution has really been frustrating and a bit of a blocker for our team.

    If anyone has additional information, I'd love to hear. Thanks so much.

    tl;dr
    have VR game, forward rendering, lightmaps - losing directional specular 5.5 and beyond regresses game visually (no baked in spec highlights), no apparent replacement? Help please! Thank you!
     
    buttmatrix, WildStyle69 and Ostwind like this.
  16. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Not sure if it's been pointed out but my scene still takes up around 3GB when the scene is baking. When the bake is finished it still remains at about 2.8 GB.

    Also Alpha/Transparency baking still doesn't work, it seems the alpha issue and the mem issue still persist. Futher baking tests show that the mem usage is now 5GB.

    Also sorry to ask but where did the option to turn lightmaps off temporarily go?

    Beach Hut.png
     
    Last edited: Mar 11, 2017
  17. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Unity and @Jesper-Mortensen -- please can we get a reply on this point? For us VR developers this is a big deal and we need to understand what is happening.

    Thanks!

    // WildStyle
     
  18. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    We are working on adding physical falloff for lights.

    Emission power can be adjusted, but we will improve the range so we are no longer limited. Also WIP.
     
    AlbertoVP likes this.
  19. AlbertoVP

    AlbertoVP

    Joined:
    Dec 6, 2016
    Posts:
    42
    I was talking about to have two GI values, one for the GI and other for the shader emission.

    Thanks for the work!!
     
  20. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    You can achieve that by customizing your meta pass:
    https://docs.unity3d.com/Manual/MetaPass.html

    That gives you full control of what is used internally for emission.
     
  21. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Any word on my post earlier?
     
  22. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    We do not unload the temporary data for a bake until we do another bake and then we reuse the buffers. We will fix this soon, we are working on that.

    Transparency baking should work although there are still some bugs. See above:
    https://forum.unity3d.com/threads/progressive-lightmapper-in-5-6-beta-6.454362/page-2#post-2980278

    "option to turn lightmaps off temporarily" what option is this? There is a little light bulb in the scene view which does that I think but I never use it.
     
  23. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Directional specular worked in very few cases so we decided it was not the right way to go. For specular, reflection probes and SSRR should be the right tools - and we are investing heavily in those going forward.

    Shadowmask lighting mode lets you render realtime lights without the cost of shadowmapping which will lets you have realtime direct specular. For VR you should probably avoid "distance shadowmask" which uses shadowmasks only in the distance, within the shadow distance all shadows are realtime.
     
    buttmatrix, Kellios11 and WildStyle69 like this.
  24. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Any info if this will be fixed before final?

    At the moment I can't figure a way how to fix architectural type lights where the actual lights are usually inside the light mesh. With the progressive lightmapper the light stops inside the mesh ignoring the backface type and everything is dark either cause of the mesh or it casts the mesh as a shadow. I was originally thinking unchecking cast shadows would solve the issue if it would be supported. With enlighten everything works as expected which makes it hard to upgrade older projects to use progressive lightmapper.

    Simplest test case to this is to add a plane, sphere and put a point light inside sphere.
     
  25. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Please don't forget GPU rendering :)
     
  26. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    I get one error when baking with progressive

    OpenRL reported error code 502: OpenRL error occured: RL_INVALID_OPERATION: Too many output rays emitted from frame program 'ProbeBakeFrameShader'. (rl_OutputRayCount = 1725)

    Any idea how I can prevent this?
     
  27. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    And why is the resulting texture coverage so unoptimised?

    There is a lot of empty space, any way I can optimise this with settings?
     

    Attached Files:

    JamesArndt likes this.
  28. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Using 5.6f1, Terrain trees don't seem to be casting shadows into the terrain lightmap, and the billboard trees are very bright, switching to very dark when converting into a mesh tree.

    Are these things going to be fixed?
     
    WildStyle69 likes this.
  29. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    Crashes for me when I press bake. Here's the call stack:
    > mono.dll!get_hazardous_pointer(void * volatile * pp, MonoThreadHazardPointers * hp, int hazard_index) Line 293 C
    mono.dll!mono_jit_info_table_find(_MonoDomain * domain, char * addr) Line 396 C
    mono.dll!mono_sigfpe_signal_handler(int _dummy, _EXCEPTION_POINTERS * info, void * context) Line 4952 C
    mono.dll!seh_vectored_exception_handler(_EXCEPTION_POINTERS * ep) Line 214 C
    [External Code]

    EDIT:

    I set the lightmap resolution to 4 texels per unit instead of 5 and it stopped crashing. I don't know why it was set to 5.

    EDIT2:
    Not only do the results look much better, it has also reduced my bake times (for a test bake) from over an hour to only a minute. Great job guys!
     
    Last edited: Mar 20, 2017
  30. Kellios11

    Kellios11

    Joined:
    Jun 6, 2016
    Posts:
    6
    Hi Jesper,

    Thanks so much for taking the time to answer. I still do have a couple questions/concerns though - while yes of course we are utilizing reflection probes, SSR is not an option at this time for VR, nor is it forward rendering compatible. I understand too you guys are working on those tools - I do hope you're keeping VR in mind, as many trick normally used in a non-VR game just aren't an option in VR (realtime lights with realtime shadows, SSR, SSAO, most camera/post-processing effects in general...).

    Is Unity taking strides for VR optimized content like that? For many of us working in VR, what would be a proper workflow? Of course VR still being a new technology so nothing is standardized yet, but what with all the developers using Unity as their engine for VR creation, I would hope there's some desire on Unity's part to help improve these areas. And while I don't doubt Unity is making strides for VR, it's sometimes difficult to know from an outsider's development perspective.

    Thanks again. Looking forward to all the improvements.
     
    WildStyle69, KarelA and Ostwind like this.
  31. LittleRainGames

    LittleRainGames

    Joined:
    Apr 7, 2016
    Posts:
    97
    If this is the case what about when your poly count exceeds the maximum and gets split into multiple meshes? I'm still using 5.5 but I literally had to chop my mesh into almost 10 parts, because if I didn't it would do it anyways except be all over in random places.

    I would also like to say I want to thank you and the rest of the Unity team for all your hard work. i've seen too many people here tell staff "Well maybe you should hire more people", and "Really? More releases with an untested bug?", and just plain rude things like that. It infuriates me to hear their arrogant self-entitled orders. They need to realize how much work there really is to make an engine, and that its hard to test everything corner of it. The only real possible way to find some bugs is put it out there for the community to find. Hah sorry, and thanks again! </endRant>
     
  32. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874

    Create a new lightmap parameters and set Backface Tolerance to 0.4 or 0. It should solves black holes problem
     
  33. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Is Mixed Lighting Mode supported yet for the Progressive Lightmapper?

    I'm using Mixed mode in my scene, but no realtime lighting or or shadows on my realtime objects.
     
    JamesArndt likes this.
  34. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    Can you post your lightmapping settings? Mixed mode works for me.
     
  35. UziMonkey

    UziMonkey

    Joined:
    Nov 7, 2012
    Posts:
    206
    Mixed mode is not working for me either in 5.6.0f2. I don't know if it's not enabled, it's broken or I'm doing something wrong.
     
  36. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    I believe Mixed Mode still not available in f2 using the Progressive Lightmapper. But judging by the release notes:
    • GI: Progressive Lightmapper (Preview): Lighting Modes are not supported (coming soon).
    Should be available post 5.6...
     
  37. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    With the progresssive lightmapper? Mixed mode works fine for me with the Enlighten lightmapper. But if I rebake with Progressive, it doens't work.
     
  38. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    Yes, with the progressive lightmapper. The wooden tiles are dynamic, the rest is all statically baked with the progressive lightmapper.
    upload_2017-3-29_16-42-43.png
     
    buttmatrix likes this.
  39. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Can you clarify this a bit? In realtime mesh formats, a vertex can't hold more than one normal and more than one same-channel UV coord. By "watertight welded meshes", did you mean ensuring that meshes don't have gaps in surfaces (with seams made up by exactly identical vertex positions being fine), or did you mean ensuring that meshes don't use any seams at all? Welding usually refers to merging any similarly positioned or position-matching vertices. If it's the latter, that would mean that lightmapper is unable to work with hard edges (split vertices with duplicate positions but different normals) and UV edges (split vertices with duplicate positions but different UVs), so I'm probably misunderstanding what you meant by "welding". Archviz and environment art typically involves using enormous number of hard edges and UV seams, hence my interest.
     
  40. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Still not done this one yet. Once we finish Mixed Lighting and Baked LODs we'll sort it out. The aim is that the lightmapper will be feature complete during the 5.6 cycle of point releases.
     
  41. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    This is a WIP. It is still unproven tech but once we have done some more work on this, we will share our findings here.
     
  42. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    We have fixed this. Grab the latest 5.6.
     
  43. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Try the latest 5.6 - we have fixed some serious crash bugs. If you still can consistently reproduce this we would like to get a reproducer for this.
     
  44. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Yes, we are very much focused on VR. Currently we are working hard to ship the progressive lightmapper though. The aim for specular reflection would be to use:
    1) Reflection probes.
    2) Realtime lights with prebaked shadow masks (coming with mixed lighting). This will only be evaluating the BRDF and won't need to render shadow maps since they can be prebaked. An extra benefit is that you can adjust the color and intensity of such lights at runtime.
    3) SSR - we are heavily optimizing this. It might still be outside the perf budget for VR though.

    We will look into the performance characteristics of these options and have budgeted some time to look into cheaper alternatives for specular.
     
    Kellios11 likes this.
  45. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    We are landing mixed mode for the progressive lightmapper in a patch release to 5.6. We are putting the final touches on it as we speak.

    There should be a warning to that effect in the lighting panel under the mixed mode setting.
     
    Last edited: Apr 2, 2017
  46. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
  47. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
  48. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
  49. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Works with any kind of seams in UV space. What @kemalakay is referring to is that exposing a large amount of backfaces leads to artifacts since lightmaps texels that "see" a large amount of backfaces will be invalidated. For instance if you place a plane in your scene - then by default geometry directly behind the plane will be invalidated and look incorrect. We are working on a fix for double sided GI calculations to better handle open meshes. Until then try and close your meshes and make sure your geometry isn't exposed to too many backfaces.
     
  50. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    JamesArndt and buttmatrix like this.