Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. hyperjxz

    hyperjxz

    Joined:
    Nov 21, 2015
    Posts:
    4
    I see... I have a pc with gtx750ti. It should work on this I think. Then I can import lightmaps into this I guess. Your asset still should be useful. I will keep it anyways. I will take the time to setup this other pc rig. Thanks again.
     
    guycalledfrank likes this.
  2. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Yeah, this one definitely works :)
     
  3. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    @guycalledfrank
    hi,
    is it possible to split large scene with tons of objects and baking separately [in groups or selective of objects] but without any illumination lags?
    i mean bake first selected object, then others and so ...

    coz the forced GI VRAM optimization option does not working correctly!? :\
    just working on export scene and loading data to baking lights and generating lightmap atlases, but on final gi calculation i got memory limit too and broke the process!! :\
     
    Last edited: Nov 26, 2018
  4. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Silly question (not so silly):
    Does Bakery support skinned mesh lightmapping?
    Yes, I know lightmapping is for static geometry and I know backing lightmaps on a skinned mesh is not what you usually want to do. (that's what lightprobes are for)
    Nevertheless, imported skinned meshes have the option to generate lightmapping UVs in the import tab, and it can be very usefull for baking things that don't need to move a lot or will be lit similarly all the time (like parts of the scene, statues or even characters that you know will never leave a specific room)
    Bakery has the (very convenient) option to use the original UVs of the mesh, instead of the ones generated for lightmapping. This would be perfect for baking character's lightmaps, who usually have non overlapping UVs.

    The problem is I can't make Bakery to bake skinned meshes. Even making them static.
    This is a known regression from back to Unity 4 (!), back then you could lightmap a skinned mesh. Now Unity doesn't support it because "Enlighten doesn't support it".
    So what about Bakery?
    Is there any way?
     
    guycalledfrank likes this.
  5. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    You can bake each group in its own scene and then load all scenes together either by LoadScene() or by making the Lightmapped Prefabs and then just them dragging into the final scene.

    Sometimes it doesn't, and I currently don't have any scene where I could crash it. If someone finally sends me such a scene, I'll happily debug. There are lots of factors at play. Optimization is designed to solve out-of-memory problems.

    Currently it doesn't.

    Fair enough. Noted. Will implement.

    As a workaround, you can import the same character with the same set of UVs as a static mesh, bake it, then apply the lightmap by script.
     
  6. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    :D
     
    guycalledfrank likes this.
  7. DigvijayTiwary

    DigvijayTiwary

    Joined:
    Dec 2, 2016
    Posts:
    44
    I'm getting this error with shaders on Unity 2017.3.x On my build settings only DX11 is enabled because of CTS.
    Shader error in 'Bakery/Standard': 'FragmentSetup': cannot convert from 'half4[3]' to 'float4[3]' at Assets/Bakery/shader/Bakery.cginc(614) (on d3d11)
    Compiling Vertex program with LIGHTMAP_ON DIRLIGHTMAP_COMBINED UNITY_HDR_ON BAKERY_SHNONLINEAR BAKERY_VERTEXLM _NORMALMAP BAKERY_VERTEXLMSH BAKERY_SH BAKERY_RNM BAKERY_BICUBIC
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME
     
  8. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Interesting. I'm a bit confused now which Unity version uses half and which uses float, because I'm pretty sure it did work on 2017.3...
    In any case, you can fix it by opening Bakery.cginc and replacing all occurrences of

    #if UNITY_VERSION >= 201740


    with

    #if UNITY_VERSION >= 201730
     
  9. DigvijayTiwary

    DigvijayTiwary

    Joined:
    Dec 2, 2016
    Posts:
    44
    Sorry my bad.. I had switched to Unity 2017.2.4 Is there any fix for that ? The above mentioned fix didn't work. There are more errors.
    upload_2018-11-27_16-59-39.png
     
  10. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Then change it to

    #if UNITY_VERSION >= 201720


    :)
     
  11. DigvijayTiwary

    DigvijayTiwary

    Joined:
    Dec 2, 2016
    Posts:
    44
    Aha, thank you so much that did it. Sorry, I'm a noob with codes.
    Just one more question, if I want to use real-time lights with Bakery (Distance shadow mask) what light settings should I set to in unity?
    The manual wasn't really clear on it. I should use mixed lighting only, and progressive preview or enlighten? These are the setting on example scene, but they seem like quite high.

    upload_2018-11-27_17-18-48.png
     
  12. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Should they move during the game? Or do you want them just for dynamic shadows/specular?
     
  13. DigvijayTiwary

    DigvijayTiwary

    Joined:
    Dec 2, 2016
    Posts:
    44
    Both, I have scene with day and night cycle, and another for just dynamic shadow/specular.
     
  14. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Moving lights won't have GI. You just create them as regular Unity lights without any Bakery components.

    Stationary lights can have real-time specular and shadows from moving objects but also baked GI and baked shadows from the static stuff. You can use Shadowmask mode for that:
    - Set render mode to Shadowmask in Bakery window.
    - Add both Unity and Bakery components to your light. One for real-time lighting, another for baked.
    - Enable "shadowmask" checkbox on Bakery light.
    - Bake.
     
    Mark_01 likes this.
  15. DigvijayTiwary

    DigvijayTiwary

    Joined:
    Dec 2, 2016
    Posts:
    44
    So I don't need to do anything on unity lighting window ? bake light probes, and reflection probes using bakery?
     
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Yep.
     
    DigvijayTiwary likes this.
  17. DigvijayTiwary

    DigvijayTiwary

    Joined:
    Dec 2, 2016
    Posts:
    44
    Thanks for all the help and quick replies :D
     
    guycalledfrank likes this.
  18. StayUpLate

    StayUpLate

    Joined:
    Jul 29, 2018
    Posts:
    59
    Got a hard crash on breakpoint exception

    GTX 980Ti
    Win10 x64
    Unity 2018.3b11

    Gaia terrain with all rocks and sheds marked static
    Vegetation Studio Pro
    Some Speedtrees

    https://imgur.com/a/Akk68lM
     
  19. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Unfortunately I never tested these assets, and Speedtrees are currently unsupported. There are many ways 3rd party assets can generate geometry and UVs. Perhaps try baking simpler scenes first, e.g. just the terrain, or just the rocks/sheds, until you find what causes the error exactly.
     
    SteveB likes this.
  20. aeldred28

    aeldred28

    Joined:
    Dec 16, 2017
    Posts:
    30
    Do you know how I can make unity realtime lights only have an effect on dynamic objects in my game? I cannot use light probes because the map in my game is instantiated at runtime and I cannot use both baked lighting and point lighting without getting too much exposure or unrealistic results. When I was messing around with baking I noticed that one of my point lights only had an effect on dynamic objects and not the baked object, but I dont know how to replicate that. Currently my game's dynamic characters are not illuminated since bakery baking doesnt affect them, and I dont want to use too many shadowmask lights.
     
  21. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Sure, you can use layers. Lights have a Culling Mask property.
     
  22. aeldred28

    aeldred28

    Joined:
    Dec 16, 2017
    Posts:
    30
    That worked, thank you.
     
    Last edited: Nov 27, 2018
    guycalledfrank likes this.
  23. gsneto

    gsneto

    Joined:
    Feb 10, 2018
    Posts:
    2
    Nice hack! That'll certainly work for me. Will give it a try, thank you!
     
    guycalledfrank likes this.
  24. DigvijayTiwary

    DigvijayTiwary

    Joined:
    Dec 2, 2016
    Posts:
    44
    Is it safe to ignore this ? It happens when I bake scenes with bakery on 2017.2.4.
    Lighting data asset ‘LightingData-0’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt.
    UnityEditor.AssetDatabase:Refresh()
    <RenderLightmapFunc>c__Iterator2:MoveNext() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3752)
    ftRenderLightmap:RenderLightmapUpdate() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2549)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
     
  25. iamfemic

    iamfemic

    Joined:
    Feb 14, 2017
    Posts:
    3
    Hi,Can I use GTX1050Ti 4G ?I Click Render and After Process Over, show error: denoiseDir error: Unkown error (505)
     
    Last edited: Nov 28, 2018
  26. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Sure - it should work great ! I am using 750Ti and it works good !
     
    guycalledfrank likes this.
  27. iamfemic

    iamfemic

    Joined:
    Feb 14, 2017
    Posts:
    3
    Thanks, but i show error: denoiseDir error: Unkown error (505) and i use noteboook pc
    When I Click Render and After Process Over, show error: denoiseDir error: Unkown error (505)
     
  28. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Yes, it's fine. LightingData assets are per-scene files. Bakery only uses LightingData for probes (unlike built-in lightmappers using it for all baked lighting). If you didn't bake the probes for the scene it complains about, then the LightingData asset is not updated since it was generated on an older version of Unity. It still seems to work.

    Update the drivers :)
     
  29. iamfemic

    iamfemic

    Joined:
    Feb 14, 2017
    Posts:
    3
    Thank you very much. I'll try it. :)
     
  30. nightfrost

    nightfrost

    Joined:
    Feb 23, 2013
    Posts:
    2
    When I use prefabs on Android - they works ONLY if instance is included in scene beforehand. Can it be checked, fixed?
     
  31. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
  32. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Can you elaborate? Do you mean prefabs created by Instantiate() only work if the same prefab was already in the scene? What happens when they don't work?

    I have no idea. If they're compatible with regular lightmapping, then probably yes. If they can generate normal meshes with non-overlapping UVs, then likely yes.
     
  33. nightfrost

    nightfrost

    Joined:
    Feb 23, 2013
    Posts:
    2
    No lighting, for example there are black rooms. In Editor it works normally
     
  34. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,081
    Awesome plugin.. Still testing things out:

    1. How is the Bakery Sky Light intensity calculated? It doesn't seem to be matching any typical float value that I can find (ambient intensity, indirect intensity, sky exposure, blah..).
    2. Reflection probes get wiped out if I hit recalculate light probes.
    3. Transparency on my object isn't being considered in light calculation. The geometry is casting the shadow. It's a custom shader using alpha test so I probably need to change something..
    4. It'd be nice to have system where we can intelligently switch between Unity light components being enabled without lightmaps applied and vice-versa. This is useful for iterating in "Full Lighting" mode.
    5. Recalculate selected reflection probe would be great, or "render unbaked."
    6. Does anyone have tips or documentation on enabling SH or RNM in my custom shaders? I use Amplify Shader as I'm sure many others do.
     
    guycalledfrank likes this.
  35. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Hmm. I will debug that, thanks. Not sure what could cause a problem though.

    In the most straightforward way. Light = Texture (linear) * color (linear) * Intensity.
    Note that there are problems with Android projects and Gamma color space in the latest released version, making HDRI textures have incorrect intensity. I have a fix for that already, can send it to you if it's the case.

    Yeah it's a problem because Unity stores both in the same LightingData asset. I have lots of complaints about this design (thread with dev answers). Basically until Unity makes a proper APIs for the asset, I can only do nasty hacks, workarounds and reverse engineering, therefore some things don't work the best. Lightmaps are immune to it though, as they can be modified without touching the asset altogether.

    - Currently Bakery only supports cutout transparency. Semi-transparent materials don't work (or work as cutout).
    - Opacity maps are taken by name (see docs) unlike albedo and emissive (which can come from any custom shader). This is because writing opacity to Meta Pass would inevitably cause loss of detail. Basically you need opacity to reside in either _MainTex.a or _BaseColorMap.a. They will be sampled directly in the lightmapper using UV0 and highest possible resolution. Other maps are resampled using lightmap UVs, just like in Enlighten/Progressive.

    Fair enough, and I'll try to streamline this process a bit.

    I did help one developer to add directional specular to Amplify, and it was quite easy. Perhaps you can send me your version of Amplify shaders, and I'll add it. Or you can analyze Bakery.cginc yourself.
     
  36. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,081
    Oh sorry. I meant the inspector property field for the skylight intensity. Where is that number derived?
     
  37. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    So it's just a linear multiplier. I'm not sure how exactly it matches existing Unity settings, but basically if you set it to 2, you'll get exactly 2x intensity.
     
  38. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    @guycalledfrank I've been using the asset for a little bit now and so far I am very pleased with it. I have a feature suggestion that I hope is simple enough to implement. When we are working on our projects, we like to keep all of our stuff from the asset store in its own folder in order to keep the project clean. However, when the Bakery folder wasn't in the topmost part of the Asset folder, I was getting errors. Is there any way to specify a custom location like with a config file or scriptable object so I can move Bakery to a different folder? And if not, how feasible would that be to implement?
     
    guycalledfrank likes this.
  39. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    It's a bit of a mess right now, and not super-quick to fix (lots of different libraries), but yes, it's planned. I'll try to solve it for the next update.
     
    Vagabond_ likes this.
  40. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    @guycalledfrank Awesome! Thanks! :)
     
  41. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    @guycalledfrank Also, I know that it isn't there now, but is there any plan to add progressive light mapping in the future, or a means of mapping the lighting that the scene camera is currently looking at so we can get faster feedback on adjustments to the scene? I am already extremely impressed with it, but I was just curious if this was in the roadmap for this asset at all.
     
  42. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    No, because Bakery algorithms are not progressive. Instead of progressively shading samples, it uses a multi-pass approach, where each light is baked with full quality one by one, and then each GI bounce follows. Visualizing it is not too useful, and would also take too much memory from the baking process itself.

    However, I'm planning to add a "camera preview" feature, which would rely on a completely independent GPU path tracer and focus solely on rendering one viewpoint. It should be much faster than lightmap baking and would give you an idea of how the final bake will look.
     
  43. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    nice :]
     
  44. aeldred28

    aeldred28

    Joined:
    Dec 16, 2017
    Posts:
    30
    upload_2018-11-29_19-27-40.png Is there a particular way to get a sharp shadow bake out of lights? or is it a limitation that requires you to use an extremely high map size
     
  45. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Lightmaps are just regular textures. You can:
    - Increase the lightmap resolution. You can do it for the floor only by tweaking "scale in lightmap" on Mesh Renderer.
    - Increase the "shadow spread" on the light to get slightly blurrier shadows (yeah, it's the opposite of what you want, but then they won't be jagged).
    - Bakery -> Shader Tweaks -> enable bicubic interpolation (might require Unity being launched with admin rights). It won't make shadows sharper, but will filter out most jaggies (diagonal lines will look straight).
     
  46. KarolisO

    KarolisO

    Joined:
    Feb 2, 2014
    Posts:
    30
    Firstly, I'd like to thank for a fantastic product. My team is already using it in production.

    I am running into an issue and was wondering if anyone had any insights. The light probe intensity doesn't seem to match the rest of the environment. The table and cube are using the same material. What could be causing this?
     

    Attached Files:

    • dds.jpg
      dds.jpg
      File size:
      250.5 KB
      Views:
      719
    guycalledfrank likes this.
  47. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Hmmm things like that were supposed to be fixed in v1.45. Is it an Android project or are using Gamma color space, by any chance?
     
  48. KarolisO

    KarolisO

    Joined:
    Feb 2, 2014
    Posts:
    30
    • Unity (2017.4.13f1)
      • Color Space is Linear.
      • Lights using linear light intensity.
      • Camera
        • Forward rendering.
        • HDR enabled.
        • Unity post-process stack.
      • Bakery (v1.45)
        • Settings: Simple.
        • Render mode: Full lighting.
        • Directional mode: dominant direction.
      • Shaders
        • Standard style shader made with Amplify Shader Editor.
    The project is targeting Windows Standalone.
     
    Last edited: Nov 30, 2018
  49. greengremline

    greengremline

    Joined:
    Sep 16, 2015
    Posts:
    183
    For some reason, it seems like sh light maps aren't getting their data pushed to our version control system (git) making them unusable for our team project

    On the computer they are generated on, things look fine:


    However, on any other computer (or on the original computer with a fresh download of the project):


    We even tried copying the bakery folder from the original pc to the new one as well as the prefab, but no dice. Our artist mentioned that this might be because the data is saved to the model for sh lightmaps, is there a way to fix this?
     
    Last edited: Nov 30, 2018
  50. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Can you check if using the regular standard shader produces any difference? Everything else doesn't look suspicious.
    If the problem persists, can you reproduce it on a simpler scene? Can it be linked to specific lights or materials?

    What Unity version are you on? Versions older than 2017.1 may have some synchronization problems.