Search Unity

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

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

  1. JohanL

    JohanL

    Joined:
    Apr 15, 2013
    Posts:
    20
    Whenever I move over to a new scene there seems to be some new issue, so here's another error I got.

    Thanks for all the fixes you provde btw :)

    upload_2018-11-21_11-22-25.png
     
    guycalledfrank likes this.
  2. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
  3. JohanL

    JohanL

    Joined:
    Apr 15, 2013
    Posts:
    20
    Seems like the issue persists unfortunately :(

    upload_2018-11-21_12-25-53.png
     
  4. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Doesn't make any sense. Can you send me the scene?
     
  5. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    YEP! That fixed it!
    Now it works perfectly with Min Resolution set to 16! :D
     
    guycalledfrank likes this.
  6. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    I had a 960 before upgrading and even with that one, it was way worth it.
     
    guycalledfrank likes this.
  7. JohanL

    JohanL

    Joined:
    Apr 15, 2013
    Posts:
    20
    I sent it in a pm! :)
     
    guycalledfrank likes this.
  8. kkqqpp

    kkqqpp

    Joined:
    Aug 13, 2014
    Posts:
    7
    Is Bakery work with multiple scenes? For instance, I put 10 scenes together and bake the lightmap. And then I stream some of the scenes in-game.
     
  9. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Saw it, thanks! I'll give it a proper look soon.

    Yes it does :)
     
  10. kkqqpp

    kkqqpp

    Joined:
    Aug 13, 2014
    Posts:
    7
    I just bought the asset and want to try it in my HDRP project. However, two errors raised. I am using Unity 2018.2.16f1

    Shader error in 'HDRenderPipeline/Bakery Lit': 'GetPositionInput': no matching 5 parameter function at Assets/Bakery/shader/BakeryHDRPShader/BakeryHDRP_GBuffer.hlsl(39) (on d3d11)
    Compiling Vertex program
    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 UNITY_LIGHTMAP_RGBM_ENCODING​

    Shader error in 'HDRenderPipeline/Bakery Lit': invalid subscript 'positionWS' at Assets/Bakery/shader/BakeryHDRPShader/BakeryHDRP_GBuffer.hlsl(39) (on d3d11)
    Compiling Vertex program
    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 UNITY_LIGHTMAP_RGBM_ENCODING​
     
  11. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Yeah, apparently Unity updated the HDRP package and broke any compatibility with my shader. And even if I fix it again, there is not guarantee they won't break it again. Consider using standard render pipeline for SH lightmaps, or use regular HDRP shaders with Dominant Direction mode.
    It would be nice if Unity came up with some way to write custom HDRP-based shaders (and not the shader graph).
     
  12. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Back when they started creating the PBR Standard Shader, making any surface shader that could use it was a nightmare, constantly breaking your shaders at each beta iteration. I was very skeptical.
    However, once the Standard shader was finally released, it was as easy as specify "Standard" on your surface shader code, and that was it!
    I have hope this could be the same once the scriptable render pipeline goes out of "preview" (beta): just toss some macro on your shaders or specify "HDR" on your surface shader and it's done.
    But there was no Shader Graph back then, so, who knows...
     
    guycalledfrank likes this.
  13. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    110
    I read early on , that someone asked for runtime support. You answered, the bake will need seconds and minutes and so it was more aimed at developers. For my usecase, that would be totally ok, to have the user wait in front of a bake at runtime. It's not a game, but an inhouse tool to make thing pretty for show off. Is there a way to add support for baking at runtime (on nvidia cards)?
     
  14. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    You can try it on your own by analyzing the scripts (mostly ftBuildGraphics and ftRenderLightmap), but in general it won't be quick, and it's not a priority task for me. There are many things that will differ, e.g. importing the assets back - there is no asset processing API at runtime, so you will need your own texture loader. There are many pitfalls like that.
    But in general, if you're experienced programmer and ready to:
    - Generate binary files with scene description and bake settings
    - Provide final lightmapping UVs and split the scene into multiple lightmaps on your own.
    - Load and apply the textures.
    Then I can guide you through. It will basically be the same as adapting Bakery to any custom engine (non-Unity) and I did that before. Without caring for lots of corner cases like auto atlas packing, LODs, etc, it's not that hard, may take a couple of days.
     
  15. Jussukka

    Jussukka

    Joined:
    Feb 17, 2016
    Posts:
    25
    Hello! I have just installed your tool and started using it to bake mixed lighting for our game. However, I have a problem that I have no idea how to fix:

    Shadowmasks are only rendered for handful of lights. Most of my lights in the scene are not at all factored in the bake, even though the settings are the same. Our levels are procedurally generated from prefabs so there is no way for me to manually set the bitmasks for each light. I need the lights to automatically bake correctly. I carefully read the manual and random lights do get a shadowmask (or all do if there are only 2 or so lights). All correct checkboxes are checked. Is there any solution for automatically getting support for more than 4 overlapping lights or do I need to look for another baking solution?

    The lights I have are all clones of each other with the exact same settings but only a couple of them get shadowmasks?

    Thanks for your help! If anyone else knows what to do I am thankful of assistance! This seems like an issue that would come up for anyone using the tool in an indoor setting.

    EDIT: manually setting different bitmask for each light helped the shadows to be baked in the lightmap, but the corresponding lights are not masked by those shadows.
     
    Last edited: Nov 21, 2018
    guycalledfrank likes this.
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Not really. And I doubt there is any other baking solution to help. Just try to reduce the radius of the lights so they don't intersect that much.
    Can you show the screenshot with the lights? And, BTW, what Unity version are you on? There might be some shadowmask problems on versions older than 2017.4.
     
  17. Jussukka

    Jussukka

    Joined:
    Feb 17, 2016
    Posts:
    25
    unity 2017.4

    Hmm, so just by tweaking the light radiuses I should be able to get it to work? By keeping the overlap in check.
     
  18. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Yes, you can have more than 4 masked lights, if they don't overlap. The number is unlimited, it's just there are only 4 channels in the shadowmask for 4 lights at single point.
     
  19. Falagard

    Falagard

    Joined:
    Jan 8, 2014
    Posts:
    43
    I'm getting an error with the denoiser:

    Running denoiser "C:\Users\Clay\AppData\Local\Temp\frender/Lightmap1_LM0_final_HDR.lz4" "C:\Users\Clay\AppData\Local\Temp\frender/Lightmap1_LM0_final_HDR.lz4" 128
    UnityEngine.Debug:Log(Object)
    <RenderLightmapFunc>c__Iterator2:MoveNext() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3791)
    ftRenderLightmap:RenderLightmapUpdate() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2549)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

    If I disable the denoiser then the lightmaps finish properly.

    Any thoughts? I'm running unity 2018.2 and my video card is a GeForce GT 740M

    I've only had Bakery for a couple hours and have run it on my one test, which is geometry from SabreCSG.
     
  20. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    What's the error message? The log entry you posted doesn't contain it.
     
  21. Falagard

    Falagard

    Joined:
    Jan 8, 2014
    Posts:
    43
    It only says error 505, but I'll double check

    It shows a message box with:
    denoiser error: Unknown error (505)

    The log shows:

    Error: Unknown error (505)
    Trying fallback 0
    Error: Unknown error (505)
    Trying fallback 1
     
  22. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Oh, this one usually means you should update the GPU driver :)
     
  23. eblumrich

    eblumrich

    Joined:
    Nov 12, 2015
    Posts:
    105
    Heya!

    I bought the Bakery asset yesterday, and tried adding it to my main (Open world) scene.

    Unfortunately, it seems as if my computer simply doesn't have the memory to render the lightmap for that particular scene. It will probably be more handy, when it comes to indoor scenes.

    Now- when I tried to revert the settings, and then remove the Bakery elements from my scene:

    It seems as if a heavy, heavy fog has descended upon my world.

    I went through the camera and light settings, and I just can't seem to find where this problem exists- or remove the heavy fog.

    I know this occurred after I tried implementing Bakery into the scene...

    Any idea why this might be happening?
     
  24. Falagard

    Falagard

    Joined:
    Jan 8, 2014
    Posts:
    43
    Probably the change from gamma to linear :)
     
    guycalledfrank likes this.
  25. Falagard

    Falagard

    Joined:
    Jan 8, 2014
    Posts:
    43
    I read your blog post about the technical pitfalls of baking lightmaps and it was enlightening ;-)

    The funny thing is that I used the "bake to a render texture using UV space" method as my first try a long time ago also (2007), including using a pixel shader to get rid of seams by expanding into adjacent empty pixels.

    https://forums.ogre3d.org/viewtopic.php?t=37128

    Denoising is working now that I've updated my drivers, thanks :)
     
    guycalledfrank likes this.
  26. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Try going to Window>Rendering>Lighting Settings ,click on the little arrow next to "generate lighting" and click on "Clear Baked Data"
    (disable Auto Generate if it's on)
     
  27. eblumrich

    eblumrich

    Joined:
    Nov 12, 2015
    Posts:
    105
    Kosher- thanks!
     
  28. GenOli

    GenOli

    Joined:
    Apr 21, 2013
    Posts:
    139
    @guycalledfrank

    Is there a reason why Enlighten is used to generate Realtime GI (if box in Bakery is ticked) and not Progressive?
     
  29. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Be sure to manually select Progressive in the Unity's Lighting Panel>Lightmapping Settings>Lightmapper
     
    guycalledfrank likes this.
  30. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    Btw, related to that weird channel skip stuff it seems to be fixed (or it was in my last bake at least).
    I don't know what of these changes solved it, or if it was a combination of them:
    - Instead of always forcing on, I let VRAM optimization on 'AUTO'. (Tried 'OFF' but the bake ran out of memory I think because when I checked Unity had crashed).
    - Instead of bulking all the lightmaps of all scenes inside the default output folder, I created a folder-per-scene.
    - My lightmaps max res and min res were 2048 both, I reduced min res to 1024.

    Anyways, I hope it is gone forever lol
     
    guycalledfrank likes this.
  31. Jan_Hasse

    Jan_Hasse

    Joined:
    Sep 11, 2017
    Posts:
    21
    Hey Guys,
    im looking for a solution to make my non static object look less "out of the world". Are there nice techniques which do this automatically or do i have to adjust the color of the doors in my szene manually?
    The corpus of the cupboard is baked but the doors need to be interactive, thats why they look so different.

    Greetings

     
  32. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    You should try using Proxy Volumes.
     
    guycalledfrank likes this.
  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Because Progressive simply can't do that.
    Or in case you mean you pressed the Render button and it started baking with Progressive instead - then read atomicjoe's answer :)

    Well they should be properly lit by probes. And in fact the probes (as little spheres) appear to be fine on your screenshot, so I'm not exactly sure why the doors are so dark. Perhaps you have another probe behind the door, and it's dark?
     
  34. GenOli

    GenOli

    Joined:
    Apr 21, 2013
    Posts:
    139
    Bakery won't let you use it, says to select Enlighten before continuing.
     
  35. Jan_Hasse

    Jan_Hasse

    Joined:
    Sep 11, 2017
    Posts:
    21
    One more question: Does Bakery blur the normalmaps? Because the texture of my cupboards is completly gone after baking.


     
  36. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    - Bakery doesn't touch your normal maps.
    - However, if you're using "Baked Normal Maps" directional mode, normal map detail will be baked into the lightmap and therefore may appear blurred.
    - If you don't use any directional mode at all, normal mapping won't work. Check page 7 of the manual.
     
  37. GenOli

    GenOli

    Joined:
    Apr 21, 2013
    Posts:
    139
    @guycalledfrank

    I've noticed that Unity crashes sometimes with a large scene and it seems to be system memory related (not VRAM), is there any way to limit/manage system memory so it doesn't overload?

    Specs:

    Ryzen 1800x
    16GB DDR4 (page file is also enabled)
    1080ti
     
  38. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    During the bake process or when? Is there any error specific message?
     
  39. HenriSweco

    HenriSweco

    Joined:
    Aug 8, 2016
    Posts:
    28
    You can try the hack below as mentioned by guycalled frank, or just bake them without casting shadows. You can still move baked objects, they just might not look absolutely correct after moving.

     
    atomicjoe and guycalledfrank like this.
  40. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    bakery is adjusting uv padding on many items, why does it need to do that and is it possible that it will break things?

    PS. I think it would also bean improvement if you could resize this window, I cant actually see the exact files its adjusting.
     
    Last edited: Nov 23, 2018
  41. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I am getting this error:

    IndexOutOfRangeException: Index was outside the bounds of the array.
    ftBuildGraphics+<ExportScene>c__Iterator0.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftBuildGraphics.cs:3510)
    ftRenderLightmap+<RenderLightmapFunc>c__Iterator2.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2886)
    ftRenderLightmap.RenderLightmapUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2549)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:191)

    also getting
    ftrace error cant decompress uvgbuffer normal (5090)

    Im close to thinking this wont work for me to be honest, back to enlighten ;-/
     
    Last edited: Nov 23, 2018
  42. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    I'm baking light probe, anyone know how this happen? upload_2018-11-23_14-18-24.png
     
  43. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    Hello guycalledfrank, hello everyone,

    I bought Bakery yesterday, and i have to say that i really enjoy it. It really is a time saver and the lightmap quality is better than enlighten's. I just went into an issue causing some light artifacts (had some bigger ones but after restarting unity they went away)


    And i couldn't manage to find how i can use emissive materials (without Bakery Light Mesh) to light up my scene.

    Any ideas ? Thanks ! :)
     
    guycalledfrank likes this.
  44. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    It does it only once or after object resolution in the atlas changed. It can be disabled.
    Why: because Unity does a poor job at unwrapping meshes, assuming every mesh can have the same padding value.
    Padding adjustment shouldn't break anything, but it reimports the models if affects.
    Here's a detailed explanation: https://forum.unity.com/threads/bakery-gpu-lightmapper-v1-45-released.536008/page-22#post-3771211

    Perhaps check if you have enough free disk space and/or RAM.
    Also try setting GI VRAM optimization = Force Off in Advanced settings.
    And also try reducing the resolution, it's highly likely you're trying to generate way too many huge lightmaps. Start with Texels per Unit = 1.

    Looks like you're using an outdated version. v1.45 has many bugfixes AND proper error messages instead of codes.

    It's hard to say what's going on by this pic... are you using any directional mode? And if you do, does it also happen in non-directional bakes?

    Well they should just work. Check the curtains in example_sponza_evening. Also make sure your material has Global Illumination switch set to "Baked":

    upload_2018-11-23_11-12-5.png

    If you don't have this option in your shader's UI, you can enable it via script by setting

    material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive;

    Previously Bakery baked all emission from all shaders, but then I started getting complaints from people who wanted SOME emissive surface to be only realtime, so I had to respect the globalIlluminationFlags property.
     
    Last edited: Nov 23, 2018
  45. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    Indeed, it works perfectly.

    Actually, don't mind about the light issue for now, i just set the area light wrongly (shame...) :oops:

    Anyway, very great job for this nice asset!
     
    atomicjoe and guycalledfrank like this.
  46. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    Hey me again,
    remember when i said "had some bigger ones but after restarting unity they went away" talking about light artefacts.
    Well here is one that came back (first pic is with bloom on)

    The only lights in this room are 2 area lights, one for the windows behind and one one the ceiling.



    I'll try restarting my PC because restarting Unity doesn't fix it, but if you have any idea where this is from.. :)

    EDIT: restarting everything did nothing. I don't know why it worked yesterday when i had the same issue.
     
    Last edited: Nov 23, 2018
  47. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Very interesting, I saw some people reporting similar problems before, but I wasn't able to track it down yet. If you can send me this scene (or any other that exhibits the problem), I'll debug.
    It's also likely connected to some objects having very low resolution and possibly confusing the denoiser. If some objects get this artifact often, try increasing the Scale In Lightmap property on them.
     
    Yuvii likes this.
  48. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I had similar issue with progressive lightmapper - i think when i "ForceStop" it and i think it only appeared when lightmaps are compressed ! The actual pixel can not be edited in image editors. ( Just may be, the image compression does not like some specific values ) !
     
    Yuvii and guycalledfrank like this.
  49. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    I'll try that.

    I can't really share this scene since it's for work, but i'll definitely try to make a similar case in an other scene.

    As far as i can see, it looks like this artefact doesn't "move". I mean, if i move the little bench on my left, the artefact will then be on the chair on my right

    Lightmap Settings for this specific bench :
    Scale in Lightmap : 1
    Prioritize Illumination: false
    Stitch Seams: true

    i'll play with these parameters and keep you informed
     
    guycalledfrank likes this.
  50. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Only scale is used by Bakery, other options are only relevant for built-in lightmappers. Also check Vagabond's suggestion and see if disabling the compression changes anything.