Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Bakery - GPU Lightmapper (v1.45) [RELEASED]

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

  1. kevenson

    kevenson

    Joined:
    Jul 14, 2015
    Posts:
    6
    No worries--my project is huge and would be a pain to share at this point. I think there's something screwy with this model--everything seems to be working fine until I add it in. I'll see if I can get a new one from the creator to see if that fixes it. Thanks for the help though.
     
    guycalledfrank likes this.
  2. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    91
    Awesome - there's only one issue with this, currently we have to make a new scene for each of our bakery prefabs even though the scene doesn't seem to be important afterwards (we can delete it, etc)

    Is there any way to avoid this?
     
  3. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    947
    I'm having issues trying to use Post-Processing together with this asset. I can't get past compile errors. Removing it fixes it, that's as far as I've gotten. Is there a fix or work around? Thanks.
     
  4. ViewportAU

    ViewportAU

    Joined:
    Mar 26, 2014
    Posts:
    11
    looking forward to see it in the next update.
     
  5. wagamama

    wagamama

    Joined:
    Feb 10, 2013
    Posts:
    7
    Hello ! Can you record some Tut videos?

    Is it bake process still better than the GPU Progressive Lightmapper now unity 2018?
    I am thinking to buy
     
  6. Howard-Day

    Howard-Day

    Joined:
    Oct 25, 2013
    Posts:
    121
    Yeah, strongly better and faster, with much higher quality results and far more options. This is a rockstar product, and one that makes me DEARLY wish I had a unity project to work on right now. :p
     
    Mark_01 and guycalledfrank like this.
  7. MattVLSG

    MattVLSG

    Joined:
    Apr 2, 2018
    Posts:
    32
    What is the motivation for this approach? As there's never any way to tell which LOD's will be visible at which time (...as in, ahead of time, as it's dependent on the camera position, camera FOV, lodbias... etc), I would have thought packing as much as possible into single maps is the best bet?

    Regarding your code change suggestions... that did help a bit, it took it from ~33 maps down to ~24! :) But there were still textures with only, say 30-50% used. Thanks for the suggestion and explanation anyway! :)
     
    guycalledfrank likes this.
  8. ViewportAU

    ViewportAU

    Joined:
    Mar 26, 2014
    Posts:
    11
    Question about Backface GI...
    is backface GI=1 a global parameter? What is the correct workflow for a scene with solid meshes (building) and single side planes (vegetation). Thank you.
     
  9. maart

    maart

    Joined:
    Aug 3, 2010
    Posts:
    70
    Can someone upload a demo video and an executable (something like an archviz pro scene for comparison) please?
     
  10. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    It shouldn't be necessary after I add the component - you'll be able to bake multiple prefabs in a single scene at once.

    Never heard of this problem before. In fact even my Sponza example scene uses post-processing (tonemapping). What kind of posteffects are you using and, most importantly, what do compile errors say?

    Actually, I can. What would you like to see in such videos?

    Current version of GPU progressive is rather limited and buggy. I don't think it's usable for production at the moment.

    The only motivation is that it makes it easier to split lightmapping tasks into a set of clearly defined batches where every lightmap has an optimal static world model to trace rays against. What I really should do is to combine the maps AFTER baking in this case, and it's planned, just not there yet.

    Hmmm... That shouldn't happen though. It would be super helpful if you could replicate this problem on a simple scene and send to me as .unitypackage for debugging.

    Currently yes. It was added as a rather experimental option, but proved itself consistently useful. Let me see if I'll be able to make it per-material in the next update (the only problem originally was avoiding slowing down a perf-critical path in GI calculation, but I should be able to optimize it...).

    What would you like to see in the video/executable?
     
  11. maart

    maart

    Joined:
    Aug 3, 2010
    Posts:
    70
    What would you like to see in the video/executable?[/QUOTE]

    something like a demo we could compare like sponza or even better one of the archvizpro secenes from the asset store.

    as far as i understand this works with ies lights, hdri image light input, gi/radiosity, but only for static objects correct?
     
  12. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Yes. It also generates light probes to use on dynamic objects. It also supports mixed lighting, where dynamic shadows can be mixed together with baked.

    Good idea - I can do something like that.
     
    ArchVizPRO likes this.
  13. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    947
    Regarding the post processing issue I'm having. I started over with an empty project and imported Bakery. I'm checking the example sponza scene for a post processing setup. The camera missing script error. Are you using the post processing version 1? And it looks like I should import that myself? Which is great by the way, I hate it when as asset includes all of the post processing files and it makes a mess when importing. I checked your documentation and it appears to mention post processing once, and in the context of version control. I don't have access to the post processing version 1. The package manager brings in the new one that uses volumes. When I bring it into the project I get the error in the image, which is actually with the post processing install. I get the same error when installing it after removing your example scenes. How is this supposed to work? Thank you for your time.
    bakery-post.PNG bakery-post-2.PNG
     
    guycalledfrank likes this.
  14. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Ah. That shouldn't be a problem, you can safely ignore it. It just means there'll be no tonemapping in play mode in this particular scene, and it's not critical. You can remove the missing script from the camera.
     
  15. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    91
    That sounds great - one more question. If my designers have a really large room that can't bake the full shadowmask because of all the lights, would it be possible to split up the prefab under the root and have say three child transforms, then bake a separate lightmap for each of those three transforms? As in, instead of adding the new component to the root gameobject, we would add one to each of the three child transforms (eg: stairs, hallway, room) - this would then work for any size prefab as long as we did the work of splitting them up correctly, and store multiple lightmaps into the prefab, one for each 'chunk'
     
    guycalledfrank likes this.
  16. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    947
    That's fine, but what about the issues importing Post Processing V2?
     
  17. MattVLSG

    MattVLSG

    Joined:
    Apr 2, 2018
    Posts:
    32
    Actually, I think part of this is due to poor UV2's on some of our assets. It's obvious why it appears the packing is not optimal when the lightmap bounds of an asset are so wasteful. We'll get back to you if it happens with better unwaps (ie. splitting that long mesh into 2 or 4 UV islands for the 2nd UV)
    2018-11-09 18_04_49.png
     
  18. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Sounds like you should use existing Lightmap Groups for that instead of prefabs. This way you can manually sort groups of objects into lightmaps already AND use the bitmask property to filter out the lights you don't want affecting a particular group... except it currently doesn't help the shadowmask. Looking into fixing it now.

    Hmm just tried that and didn't have any problem:

    upload_2018-11-9_14-19-5.png


    Empty space around a rectangular UV layout is fine. Bakery uses bounding boxes of UVs to crop that away. Empty space inside the bounding box can be a problem.

    upload_2018-11-9_14-44-13.png
     
    Last edited: Nov 9, 2018 at 11:44 AM
  19. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    ... aaand I've just fixed it. Shadowmask baking now respects bitmasks set on lights and groups. Here is a scene with 8 overlapping shadowmasked lights, but they work because of filtering by bitmask and culling mask :)

    upload_2018-11-9_17-4-17.png
     
    Mark_01, Cyberdyne, CoastKid and 3 others like this.
  20. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Another bug found and fixed: apparently point lights had a problem generating sufficiently uniform random numbers, resulting in ugly banding - that should be gone now:

    upload_2018-11-9_17-39-50.png
     
  21. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    91
    Dude this is awesome, really appreciate your support! If there's a way to support you beyond the initial asset purchase please let me know.

    Another thing I'm wondering about...when something with this lightmapper component loads, will everything get instantiated in the same frame? I stream content dynamically, I need to asyncify things as much as possible to avoid frame lags when loading prefabs. Would it be possible to time-slice loading so that it happens over some number of frames?

    This might already happen, and I have not profiled performance yet so apologies if this isn't an issue, I figured I'd ask before the next update to see if it would be possible
     
    guycalledfrank likes this.
  22. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Lightmap references are stored on an invisible object in the scene, and Unity should be aware of them when asynchronously loading a scene. When the component awakes, they should be already in memory, so it only applies them. Applying shouldn't be too slow... but it can be if you have tens of thousands of mesh renderers. I suggest to profile and see if it's a problem. Time-slicing the applying code would make some objects lack lightmaps for a couple of frames (or show wrong lightmaps).

    We recently debugged a few streaming problems with nepoez. They have a large world with many async loading (and unloading) sectors. v1.4 has some problems with that (namely it loads too much and never releases), but the upcoming version will handle it properly. Scenes now never reference lightmaps they don't use, and unloading a scene will unload the lightmaps.

    Well I have a patreon :)
     
    Mark_01 likes this.
  23. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    91
    Awesome, that sounds great - and great to know about the patreon! Maybe you could expose async loading as an optional option on the new prefab lightmap component, with some max ms per frame configurator? We only load rooms that the player can't see for quite a few frames, so for up to X frames the room might not look correct until everything is applied, and already time slice most of our objects' initialization (don't use Awake(), OnEnable(), but our own IStreamable system) - I can of course make the change myself but wouldn't want to have to redo it every time you updated. Most of our room prefabs are pretty good but a couple have a TON of renderers. We are optimizing ahead of time following the INSIDE paradigm of trying to keep our streaming ms within 4-5ms max per frame, and of course the lower the better - I think this change would help a ton for people that are trying to stream worlds, especially for those that have larger worlds then us

    But sure, I will definitely be profiling this as we switch over all our rooms
     
    Last edited: Nov 10, 2018 at 7:04 PM
    guycalledfrank likes this.
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    The way resources are loaded is up to Unity - Bakery code doesn't manage that. LoadSceneAsync should do a good job already. Awaking the component for a room shouldn't bring too much overhead. I definitely recommend start with profiling first and see what's the slowest.
     
  25. maart

    maart

    Joined:
    Aug 3, 2010
    Posts:
    70
    I guess you need special shaders for this to work. (are sshadergraph samples provided) what render pipeline's are supported i guess standard is, how about lw & hdrp? How does the ligtmapper use uv coordinates? Uv1 or uv2? How do you handle assignment of objects to lightmaps. Could you please provide a workflow video? It would help me to get a better idea of how the package works.
     
  26. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Only for RNM/SH/vertex modes. Everything else is compatible with existing lightmap-able shaders. Check the "Feature support across shaders" section of the manual.

    UV2, if present. Otherwise UV1.

    Like suggested here: https://support.unity3d.com/hc/en-us/articles/206869046-Using-external-lightmaps-in-Unity-5-0

    I'm busy preparing the 1.45 release at the moment. I'm gonna take some time recording proper videos after it's done, but not at the moment.

    ---

    A "I didn't expect it to work" moment: lightmapped prefabs can contain lights with baked shadowmasks, and can be properly cloned (even at runtime):

    upload_2018-11-11_14-11-3.png
     
    Mark_01 and maart like this.
  27. nepoez

    nepoez

    Joined:
    Sep 11, 2011
    Posts:
    270
    Hi. I could be wrong, but seems like everytime I bake, Bakery will alter the meta file of my models like:
    "
    - '#BAKERY{"meshName":["Module_Road_003","Module_Road_025","Module_Road_011","Module_Road_002","Module_Road_LOD"],"padding":[84,83,84,84,124]}'
    "
    And When I have different scenes using the same model, baked separately it causes "burnt marks". e.g. Scene 1 uses modelA. Scene 2, also uses modelA. I bake Scene 1 and bakery adds the meta data. Now I bake Scene 2, bakery modifies the meta data again. Scene 2 will look fine. When I load scene 1, scene one will be weird because the meta data is modified and I get this kind of burnt marks:

    upload_2018-11-11_7-14-20.png

    instead of:
    upload_2018-11-11_7-16-22.png
     

    Attached Files:

  28. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Yes, this is how it works in v1.45, and you see that because I sent you a beta :)
    It doesn't cause the problem you found though, but only simplifies version control. The problem was there forever.

    One model can only have one optimal padding value, so if you have the same model baked with different resolution in different isolated scenes, it will confuse Bakery, as it doesn't know which scene is more important.
    If you have many instances of the same model in the same scene (or baked together in a multi-scene setup), each using different size, then the smallest one will be used to define padding. This can, however, lower the quality on the large object, by adding more wasted space between charts and generating more charts in general.

    I don't know how to solve the problem for completely separate scenes with the same model / different resolution elegantly, but there is at least one workaround for it in v1.45. Go to Experimental settings and enable UV padding: increase only. Then, first bake the low resolution scene, and then the high resolution one. If this option is set, padding will never get smaller.
    Other options:
    - Don't use UV padding adjustment. You can disable this checkbox in Advanced settings. You'll get more leaks though, but it will not be worse than what built-in Unity baking produces.
    - Have 2 separate models for different scenes. They'll get different optimally adjusted UVs.
     
    Last edited: Nov 11, 2018 at 3:00 PM
    nepoez likes this.
  29. nepoez

    nepoez

    Joined:
    Sep 11, 2011
    Posts:
    270
    Thanks for the info. That's helpful for sure!
     
    guycalledfrank likes this.
  30. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    214
    Hi,

    I have 2015 macbook pro with Iris Pro 5200 card only, probably I cannot use this asset, right ?
     
  31. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    That's right, unfortunately only nvidia cards are currently supported.
     
    MoribitoMT likes this.
  32. Garret2727

    Garret2727

    Joined:
    May 5, 2014
    Posts:
    7
    Seem I made an error. I selected a bunch of light sources in one of my maps added "Bakery Point Light" to all of my lights, including directional light and area light. Tried to bake, and it wont move on from "Adjusting sample points..." Takes me to a blank Unity scene as well. I let it run for a few hours on a small world and project, but nothing happens. I rebooted my computer as well.
    https://imgur.com/a/LYty8At
     
  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Are there any errors in console?
     
  34. Garret2727

    Garret2727

    Joined:
    May 5, 2014
    Posts:
    7
    Last thing in the editor log when this happens:

    Win32Exception: ApplicationName='C:\Users\ripja\Documents\VR Chat Project 5.6 TGerror's Project\Assets\Editor\x64/Bakery/ftrace.exe', CommandLine='fixpos12 "C:\Users\ripja\AppData\Local\Temp\frender" "uvpos_arteria3dPACKINCLUSIONmedievalfarm_LM0.lz4" 2 0 2', CurrentDirectory='C:\Users\ripja\Documents\VR Chat Project 5.6 TGerror's Project\Assets\Editor\x64/Bakery'
    System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process)
    System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process)
    System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo)
    ftRenderLightmap+<RenderLightmapFunc>c__Iterator2.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3475)
    ftRenderLightmap.RenderLightmapUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2468)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorApplicationBindings.gen.cs:249)
     
  35. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Yeah, the reason here is this little apostrophe in your project name. There are problems with funky characters in the path currently.
     
  36. Garret2727

    Garret2727

    Joined:
    May 5, 2014
    Posts:
    7
    Oh Lol. That's kinda funny. Let me fix that.
     
  37. Garret2727

    Garret2727

    Joined:
    May 5, 2014
    Posts:
    7
    guycalledfrank likes this.
  38. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    37
    Hey again Mr. F! I have some inquiries:

    Inside Bakery's documentation it is mentioned that: 'One Light Mesh with many polygons is faster to bake than many simple Light Meshes.' If I have a few dozens of area lights in my scene, it is worth in speed-baking-terms the trouble of converting them to Light Meshes and merge those as one single light mesh?

    Secondly, I have an issue that seems to happen randomly (and for now, only in one of my biggest scenes). Sometimes when Bakery delivers the lightmaps, these appear with no green channel, no idea why. This seems to happen in at least 50% of my testing bakes of this scene. I will try this night to bake again when I optimize/merge the number of objects in this scene, because that's the only difference I can think of compared to the rest of scenes.
    what1.PNG
    LightmapChannels.png

    Lastly, I seem to have some white arbitrary splotches which I can't get rid of. In worst case scenario I could fix them modifying lightmaps manually, although sometimes it is a pain to locate them inside so many maps. Any idea what could be causing them? (I've tried raising the number of samples with no success). They seem to stick to certain areas.
    WhiteSplotches.PNG

    Thanks!
     
    Last edited: Nov 12, 2018 at 3:12 PM
  39. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    91
    So I'm getting some weird errors in a build. The lightmapped rooms all appear to glow at quasar strengths:


    Any idea what could be causing this? Our room prefabs are loaded from asset bundles. I've made sure to add the bakery shader variants from these rooms to the preload section, thinking maybe it was a shader issue with asset bundles, but no dice. Everything looks totally normal in editor both in the scene and game views

    EDIT: These are our shader tweaks
     
    Last edited: Nov 12, 2018 at 4:03 PM
  40. Balours

    Balours

    Joined:
    Nov 27, 2013
    Posts:
    35
    Hi,
    I'm trying to bake a scene, exported as a package from another project, but I can't get it to work on the new project. It works perfectly on the first one, I'm using the same settings, the same lights, the same meshes, the same import settings, but got different results :
    - In the first project 15 maps (dir and final) are generated versus 1 for the new project
    - Some objects UV's are totally different on the new project, as a result lighting doesn't make any sense, lot of black spots / looks like UV of some objects are on top of others.

    What did I miss?
    Thanks,
    (I can send you screenshots privately if needed)
     
  41. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Yes, it should make baking slightly faster. But don't attach too many of them together - after all, the more you attach, the more "samples far" you need to use. If one light looks good with 256 far samples, then 4 lights should use 1024 to get comparable quality. And I don't recommend going over 4096. As for "samples near", this value is unaffected.

    That's totally impossible. I can't think of any reason why it could happen, the only clue I have is that pink color = some shader failed to compile (?). I have never heard of any similar reports before.

    That might be fixed after the upcoming v1.45 release.

    Does it work with standard shaders? What directional mode do you use?

    Just wait for v1.45 (or I can send you a beta in PM). There are fixes related to scene transfer/version control.
     
  42. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    123
    Hello

    I want to remove BAKERY from my project, but there is no way.

    I delete the folder BAKERY, I delete the folder that is in EDITOR / x64 and ... it reloads everything.

    How would the method to uninstall correctly?

    Thank you.
     
  43. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    - Close Bakery window.
    - Press Bakery->Clear baked data.
    - Delete Assets/Bakery and Assets/Editor/x64/Bakery
     
    Barritico likes this.
  44. Balours

    Balours

    Joined:
    Nov 27, 2013
    Posts:
    35
    I'm done for testing the beta, waiting for your pm, thanks!
     
  45. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Unity forum is weird. I don't see a PM button in your profile (somehow I see it for other users?). Can you write me?
     
  46. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    91
    After talking with my artist, as far as we know this problem only started once we switched to 'rnm' directional mode - I could swear that a room baked without that worked perfectly even using the bakery shader Once again, this only happens in builds, things look just fine in the editor (both in edit and play mode)

    We also bake specular to the shader, if that matters - here is a screenshot of our material settings


    EDIT: Just tested unchecking 'allow RNM lightmaps' on some materials and rebuilt the asset bundle, the textures on those materials are working in a build again (no weird blinding light, etc)
     
    Last edited: Nov 12, 2018 at 7:20 PM
    guycalledfrank likes this.
  47. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Is that very bright object actually baked? Does it really use Bakery shader? Does that sound like a similar problem? https://forum.unity.com/threads/bakery-gpu-lightmapper-v1-4-released.536008/page-27#post-3853642
     
  48. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    91
    Yup, this is the shader settings for one of the baked objects (the walls)


    This works, as you can see it has a baked normal map - if I check 'Allow RNM Lightmaps', then it will stop working in builds. I can see the material changing as I check the checkbox and it looks fine in the editor or in play mode, and the renderer is listed in the baked renderers


    And good catch - this is actually the room from that post, but the issue is happening to all materials with that checked including ones using the correct shader (not just the plants, using the double sided shader), and not just on that room
     
    Last edited: Nov 12, 2018 at 8:23 PM
  49. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    548
    Well that's weird, you say you're using RNM, but the shader doesn't have RNM enabled, it has SH enabled instead.
     
  50. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    91
    That is correct, I manually unchecked the RNM checkbox after the bake in order to test if that was the issue, and re-bundled the asset without the RNM checkbox checked which caused it to work in build mode
    However, the asset's shader originally had the RNM checkbox checked. As you can see, there are RNM lightmaps included in the component