Search Unity

Bakery - GPU Lightmapper (v1.96) + RTPreview [RELEASED]

Discussion in 'Assets and Asset Store' started by guycalledfrank, Jun 14, 2018.

  1. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Woah. That should be FAST ;) Just wondering, how long does it take for you to bake the daylight Sponza example?
     
  2. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    as an alternative to progresive lightmapper you could add a feature to isolate selected elements and perform a test bake on theese. Its totally nuts that till today Unity does not have a right click isolate. But unity is an expert in forgetting basic mandatory stuff at the bottom of the todo list.
     
    DavidJares and guycalledfrank like this.
  3. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    You can do that right now by adding a Group Selector component on these elements (with the same group) and pressing Render Selected. Though I admit it's not that intuitive.
    I can add this function, it's not too hard.
     
    Mark_01 likes this.
  4. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Thanks for the explanation. When directional light and shadowmask are working it sounds like this is worth picking up. Just to confirm, this works as is, without any special setup?
     
  5. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    This not work good - lightmapping on the not selected elements after baking selected broken.
     
    guycalledfrank likes this.
  6. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Combining real-time lights with baked GI? You select Indirect mode in the render window, and it should work like that.

    Hmm that looks like a bug - will fix.
     
    YouDesign and Mark_01 like this.
  7. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    May be. If you need example with this behavior, i can show. In any case, this feature very important and we will wait, when you fixing it...
     
  8. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Oh I'm sorry, I meant regular light baking. Meaning, there isn't anything extra to do. Just make the scene like I would for the built in Unity light baking, hit your bake, and it just works? Or are there additional steps not needed in the buit-in lightbaking?

    Essentially, are there any limitations or changes between the built-in lightbaking and your product, or should I expect whatever bakes with the built-in will bake with yours (just faster ;) and I know we're waiting on directional, etc, I mean the setup).
     
  9. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Should work just like that right now. Create lights, mark objects as static, hit Render, done.

    Apart from directional/shadowmask and custom shader GI being in the works right now, there aren't many differences. Bakery also uses its own light components independent from Unity lights, but there are buttons to easily make them match Unity lights in appearance in one click.
     
    YouDesign and DGordon like this.
  10. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    457
    Hello
    First of all, thank you for your great work. Seems impossible what you did, but it's true!
    I am doing some test with my last asset, ArchVizPRO Vol.6.
    In Enlighten, at a resolution of 80, baking times was around 12 hours. With Bakery around 20 minutes!
    But I have some errors:
    Library.jpg Sofa.jpg
    Any ideas?
     
    CoastKid, Archviz3d, Amin- and 4 others like this.
  11. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    457
    Seems I found the reason.
    Books and sofa use negative scale. Isn't it supported in Bakery?
     
    guycalledfrank and TooManySugar like this.
  12. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Test Bakery just now. I'm confused by uv paker. Why so many lightmaps? How to setup resolution same as unity?
    I set texels per unit is the same as unity. It Should be 2 lightmags 2048х2048, not 14! This is completely wrong behavior.
    upload_2018-8-10_13-15-11.png

    P.S. Cast shadow option doesn't work(
    upload_2018-8-10_13-18-53.png
     
  13. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Interesting! So does it look fine if you fix the scale? Can you share screenshots? It should work fine even with negative.

    Texels Per Unit value may act a bit different to Unity's. Try lowering the value.

    Yeah at the moment it doesn't - gonna fix that.
     
  14. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Some times have this error.
    And some times unity crashe while scene exporing.
    upload_2018-8-10_13-43-32.png
     
    guycalledfrank likes this.
  15. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    I think I know why - just fixed one weird bug yesterday that could lead to lightmapper trying to read maps that didn't exist. I'm going to release v1.1 next week, with this fix included.
    (also you can contact my by email or PM, and I'll send you the beta now)
     
  16. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Trying low value, but still have many of small lightmaps. This is not good for static batchng(
    upload_2018-8-10_14-31-3.png
     
  17. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    It's basically a balance. With Unity you have 2 huge lightmaps (more memory wasted - it can't fill them completely, less draw calls), with Bakery you have 9 smaller lightmaps (less memory, more draw calls). I don't think a difference in 2 vs 9 draw calls is a problem, even for mobile. And it shouldn't create TOO many of them.
     
  18. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Now, you are wrong! I have 60 batches whith 2 lightmaps and 770 with 9 lightmaps! It's unacceptable for mobile.
     
    emptyxu and Vagabond_ like this.
  19. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Yep, lightmapping breaks batching. Much better to fit as many objects into a single lightmap !
    I am just dealing with this now !
     
  20. Kubic75

    Kubic75

    Joined:
    Jan 2, 2017
    Posts:
    83
    Nice, looking forward a HDRP-Version of VOL6! ;-)
     
    jjejj87 and guycalledfrank like this.
  21. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    457
    I have isolated the problem of the Negative Scale. Some screenshot to illustrate the problem:
    Test_NegativeScale.JPG Test_Scale.JPG
     
  22. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Breaking the batching---> I dislike. I also noticed when testing the Sponza that it generates several lower res than inputed on inspector. I really suffered in lowering draw calls by attlasing my buildings textures to now go blast this, please put it in the todos after the current major things in the making.

    I've not yet gone trouhg docs, just testing the sponza. First bake was so fast that I cranked up all to the max
    upload_2018-8-10_15-20-2.png

    resssults:
    upload_2018-8-10_15-36-21.png

    upload_2018-8-10_15-36-28.png
    upload_2018-8-10_15-36-54.png

    baking this took 15mins with a GTX1080, not latest drivers, updating now

    EDIT
    I see GI samples can go higher than 64, its an editor limitation as you can directly input.
    I saw it here.
    https://forum.unity.com/threads/bakery-gpu-lightmapper-released.536008/page-2#post-3554083
    But I'm getting way worse performance than the displayed times. Hope updating drivers help. Using Unity 2018.2.0f2
     
    Last edited: Aug 10, 2018
    guycalledfrank likes this.
  23. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I managed to crash it.
    I updated the drivers and exported a package of an scene I whanted to bake to a clean project.
    In there I tryed to bake sponza and got this err.
    upload_2018-8-10_17-43-23.png
    May be it was drivers may be it was just a one time crash .
    upload_2018-8-10_17-44-6.png
    I did re run same issue.
    I did reboot and now it stalls . It directly goes to progress 55% and stucks in there.
    upload_2018-8-10_17-55-20.png
    I'll delete temp files and see if it does the job

    EDIT:
    deleting temp files heped for the bake to start but I get same CUDA error as before... I think I screwed by updating the nvidia drivers to 398.82
    EDIT: sponza dusk is baking properly.
    EDIT: it baked in 156.302 seconds, so fast it looks impossible XD. Sample count 16 unlike your higher sample count tests. Still so freaking fast. SO I asume I screwed something form the setup in the Sonza day Scene, but I believe I just opened a freshly scene, so dunno.
     
    Last edited: Aug 10, 2018
    guycalledfrank likes this.
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    *sigh*
    OK, let me explain.
    After Unity added LightingDataAsset, they broke custom lightmapScaleOffset. I'm going to create a bug report right now actually. If you're setting it via script, batching ignores it and sets it to default value, apparently using unitialized LightingDataAsset instead of your value. And LightingDataAsset is a black box, you can't read it or write it.
    However, I added a bunch of workarounds to fix that. The problem is that I also needed different workarounds for editor play mode and builds.
    For builds, I replace some Unity's internal batching methods to use proper lightmapScaleOffset, and it works. For play mode it doesn't work - apparently because it reloads UnityEditor code and performs batching before any custom code is executed. So yeah - in play mode batching may break, and I'll try to fix that, but it works correctly in builds. Make a dev build, connect the profiler to it and see yourself..
     
    karonte likes this.
  25. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    as long as it is fine in builds I don´t care that much, but huh. Hope they add something so you can avoid having to do cumbersome things. Hope they expose the shadowmasking interface too, I've seen ppl struggling with this before.
     
    guycalledfrank likes this.
  26. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Yeah, bounces are basically unlimited, you can type in any values. Samples don't have hard limits as well, but (depending on your GPU?) driver may kill some overly long loops, so I wouldn't set any samples to > 256 (fun fact: GI and Skylight samples are actually squared later, so when set to e.g. 16, it will result in 16*16 = 256 real samples, and if set to 256 -> 65536).

    Is there anything special about this scene? How many lights does it have? Are there any Lightmap Group Selectors? Terrains? Can you try to create a minimal example that crashes and send it to me as unitypackage?
     
  27. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Sure, I'm open to sendind you all you need. But fun fact it was sponza scene. Freshly imported into a blank project that had prior to Bakery imported a big scene I wanted to test to bake. I had previously imported Bakery into a blank project and played with the sponza scene without issues. But that was also prior to drivers update.

    Squared ray numbers? XD. that sounds tempting yet dangerous imagine 1000 editor samples ... XD.

    I'll keep testing after finishing the manual if keeps craship will zip and send you a pckage.
     
    guycalledfrank likes this.
  28. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    definitelly sponza day scene has something seriously trashed
    upload_2018-8-10_19-30-16.png

    When this happens my monitors get no signal for a moment, and the I get the err mssage.
     
  29. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    What if you delete bushes?
    Also, you don't have any new lightmap groups on top of existing Sponza?...
    My feeling is that it has to do something with groups.
     
  30. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Deleting the bushes didnt help.
    This time editor crasehd.
    So I've the dump and the logs.
    I'll prepare the sponza and send you a PM may be you find out something.
     
    guycalledfrank likes this.
  31. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Look, something weird. When trying to package sponza I get a msg saying system can´t find an specific file. So may be dunno, something imported unproperly when decrypting package.
    upload_2018-8-10_19-57-56.png
    gonna reimport.
     
  32. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Here the unity crash log
     

    Attached Files:

  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Hmm do you have enough space on the hard drive?
     
  34. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I see changes when reimporting. TBH I don´t recall touching anything. Aside the API update when firs importing.
    upload_2018-8-10_20-6-24.png
     
  35. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    oh men I did actually check!!! I may have missread MB by TB!!! C: is about to collapse and there is where temp folder si. Now I've overwriten already but I've not made more space. Gonna check
    upload_2018-8-10_20-9-40.png

    EDIT: After reimport sponza does bake : | strange.
     
    guycalledfrank likes this.
  36. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Definitelly gonna add a button to clear Bakery temp folder in the next update - it can quickly bloat.
     
    Mark_01 likes this.
  37. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    nice, and the temp folder should be a global variable instead cause I did set and switched scene and meeec bloated C XD
    Its great that ligthmap settings are per scene but something like temp folder should be under something like Bakery--->GlobalPrefs

    EDIT: Testing to lightmap a building on a big scene. 6gb of temps so far XD.
    scene is this one.
    https://forum.unity.com/threads/progressive-lightmapper.454362/page-14#post-3592184
    Surprisingly, PLM onv ersion 2018.2 is able to handle it (at low lightmap resolutions, 0.5) in about 3-4hours. It did crash before.
     
    Last edited: Aug 10, 2018
    guycalledfrank likes this.
  38. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    I wish you luck and hope it will finish without any problems :)
     
  39. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Good news - while making a repro case to submit the lightmapScaleOffset bug, I realized it was my bug. I was wrong to blame Unity for this one... will include this fix in the next update :D
     
  40. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I was getting and error and then I realized I had a variation of standard shader, I made an script so that all materials are swapped by a white material, it has correclty gon trough the process but it is stalled at 100%, I've noticed unity icon renders a progress bar after 100%, but it has finished and still displaying 100% . It may need more time but a bit more info on this stage would help with nerves. I will leave it and see tomorrow morning if ended up working.

    EDIT ok!! it was not that long after all, lik 5+ tense minutes XD. White material was not great choice should have selected gray.

    Rendering finished in 2135.4 seconds
     
  41. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    upload_2018-8-11_1-56-33.png
    upload_2018-8-11_1-58-21.png
    upload_2018-8-11_2-2-35.png

    bit burnout but resolution ia amzing for the size of the map, how can this be computed in 35 mins lol!
    Was thinking that may be solution or alternative to shadowmasking could be ScreenSpaceShadows.
    I'll try to do more test tomorrow
    cheers
     
    guycalledfrank likes this.
  42. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    I wonder what are these vertical lines on the 2nd pic though?
     
  43. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    follow up on the scene baking.
    got some Errs
    upload_2018-8-11_13-59-44.png
    upload_2018-8-11_13-59-49.png
    upload_2018-8-11_14-1-19.png

    Then I recalled I've some roadmarkings that I did merge in editor and theese won´t have uv mapping, lightmap group and atlas packing should solver this, for going quick I removed from lightmap static.

    The It startet to bake normally (after unity restart cause it did not respond)
    Then it was oding fine then I found
    upload_2018-8-11_14-1-32.png
    But was because I had reimported the scene and so the prefs reseted and the temp was targeting C and bloated m C drive...
    Reboot unity and map properly the temps folder.

    All was going fine till I get this one
    upload_2018-8-11_14-2-25.png

    As the manual states, for big scenes Vram optimization should be forced on, I guess the 1080 is not master race anymore XD.

    trying to bake without rebooting and even after reboot causes unity to close, so I've wiped the temps and see if it bakes. Will edit the post with ressults, the thing is I give it full priority and pc freezes a bit and I don´t whant to lose the err images I captured.

    Suggestion, may be should detect objects without UV2 and warn before start baking. edit[ok, validate UVs was unchecked XD]
    Also unity needs reboot after a crash, if possible to avoid would be nice.

    Now I'm bak
    With check UVs I can see that uvs are a totall mess in the UV2 channel, I aded lm group but to teh root of a yerarchy and not sure if this will apply for children, the check seems to be performed before the atlasing anyway so gonna uncheck it. But Unity keeps closing now :\

    LOG ATTACHED:


    EDIT. enablign emm warning I see725mb use stimation this is way below the available on the card. When enabling mem warning nI see also an err afterwards Object __ExportTerrain was destroyed mid-export. The it stops baking, if Mem warning is not enabled I can see
    "__ExportTerrianParent" + "__ExportTerrianParent" and unity crasehs right after. I've unchecked terrains from lightmap static but keeps happening. Is there some config file created somewhere? I would like to delete it as this scene has been able to finish bakes other times.

    EDIT:
    deleting ftGlobalStorage.asset
    allows for bake to start again, lets see if it manages to finish.
    attched as txt extension was .asset

    It stalled. now same story again unity closes. Bakery need to provide a way to reset all because it is happening similat to what happened to me with Spoza scene.

    EDIT
    ok so I already was workign on a blank project where I had imported my exported scene package. But I did re export for even cleaner build, kept crashing. I did my best to kleanup any presence of bakery files but the scene config file is hiding somewhere as when reimporting it was showing the temp folder correclty etc..
    I noticed an err when importing my scene like terrain 1 there are 2 had no splatmat and having had issues in previous bake with terrain I directly deleted them. After that it is baking.. But I would say they where set as not lightmap static but who knows... so many changes so far XD. OK no luck. Ftrace error :1001 I wish there was more feedback on what each error means. At least realunching the bake does not break unity and is baking again. The temp drive has like 85Gb free. It happened again, the 1001, it was doing quite well, gonna lower bake specs.
     
    Last edited: Aug 11, 2018
    guycalledfrank likes this.
  44. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    LOGs, this time looks lie is packing issue
     

    Attached Files:

  45. Emerald_Eel_Entertainment

    Emerald_Eel_Entertainment

    Joined:
    Mar 30, 2016
    Posts:
    120
    This is an interesting plugin; I'll add it to my watch list. I take it this plugin is recommended for static meshes only?
     
  46. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    and this is the log after romving the group. crashes equally but I see nothing strange
     

    Attached Files:

  47. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Only static, this is as if it was BEAST from unity 4.x
     
  48. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Less ambitious specs produced a very fast bake
    upload_2018-8-12_0-19-59.png
    Rendering finished in 1961.273 seconds, dont know if this time counts the time after 100% finished till the lightmaps are assigned.
    26 non direciton lightmaps 20x4096 3x2048 2x256 1x128 -->300MB dunno if this is size compressed.

    When failing It was 10 texels per unity and 33 GI samples with 3 bounces.

    When I found out the reason to vertical seams in second peac I laughed cause I did not recall this geometry. When textured this is a doucle sided cutout that represetn the trusses of the structure.
    upload_2018-8-12_0-22-33.png
    Some artifacts appear as black boxed dot areas ocasionally,
    upload_2018-8-12_0-24-26.png

    some strange pink dots, I've seen some sparse but this facade has many
    upload_2018-8-12_0-27-58.png

    upload_2018-8-12_0-30-8.png
    lacks some detail, not sure if direct light may be washing out some or is lack of samples, I guess more samples would be needed.
     
  49. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Increased GI samples to 22 an crashes somewhere around50% of the bake :\ I attach the crash dump and log files I wont be doing more tests as reading the log seems not a hardware resource lack. Hope you can guess what it is.
     

    Attached Files:

  50. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I lied... I did another test XD.
    Rendering finished in 2221.774 seconds
    texels per unity 5
    GI
    bounces 2
    Samples 12. (So this values is Samples per unit???) I guess is because otherwise in an scecen this large would not have that output.

    This time I took the harbour scene with textures!. As I did previously missunderstud the err, as the issue with can´t map texture was not due to the custom shaders but tu the in editor merged roadmark geometries missing UV2. The lightmaps are ridiculously fast for the output resolution and even with "low" sample count the output is pretty neat.
    The lightmap view is amazing.
    upload_2018-8-12_14-18-59.png
    Some jadded edges that I believe would look fine if I upgrade the shader as shown in the manual (or when realtime shadowmasking is available.
    upload_2018-8-12_14-20-9.png

    upload_2018-8-12_14-21-4.png
    upload_2018-8-12_14-24-54.png
    upload_2018-8-12_14-31-16.png