Search Unity

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

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

  1. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    Scale in Lightmap set to 3, looks like it fixes something.


    Now trying without compression. Is it the "Compress Lightmaps" in the Lightmap window ? Didn't find anything about compression in the bakery window.
     
    guycalledfrank likes this.
  2. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    so this adjusting uv padding thing happens everytime it seems and it always gets stuck on a particular model, but the path is too wide to see exactly which one it is. It seems to hang unity too.. highly frustrating.
     
  3. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    No, it's on assets Bakery generated, the lightmap texture files. They have regular asset importing options.

    Go to advanced settings -> disable "Adjust UV padding".
     
  4. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    Well, weird, because turning back the Scale in Lightmap to 1 and turning off this Lightmap compression get rid of the artefact (?) or maybe just luck ?


    Disabling the Compression didn't change anything

     
    guycalledfrank likes this.
  5. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    then it just hangs on "exporting scene - preparing". Then I need to close unity in task manager. No error in the console. Maybe you could log whats actually happening during preparation on the dialog.

    Only error I see is complaining about x86_64 dll and a 64 bit one too.

    Im using 0.1 texels per unity, could being a float crash it?

    PS- it appears im in gamma mode, could that be an issue?

    EDIT: actually it hadnt hung, just doing lots of work, but now i see error:
    "cant fit tree_4 nan nan", I have gi vram turned off.

    any ideas? I will turn off tree_4 and try again.

    Edit2: ok with tree4 off it seems to have got past preparing stage, the cpu is doing something but I cannot tell what, does it usually have a progress bar somewhere showing you its working? I dont see one.

    edit3: LOL sorry for this ridiculous post with all my edits :) I minimised unity and cpu usage went to 0.4% and no disk usage so im assuming its not doing anything.
     
    Last edited: Nov 23, 2018
    Yuvii likes this.
  6. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Everything during scene export gets logged to Unity console. Based on what you say it sounds like you either have huge ultra-detailed geometry or huge Texels Per Unit value (relative to scene size).

    That shouldn't happen. Are you on 32 or 64-bit Unity?

    OK, then Texels value is not a problem. Float is fine. Perhaps the problem is some geometry. You mentioned UV padding adjustment took forever, but it actually was just re-running standard Unity UV unwrapper with different arguments. If it takes forever, some model must be really complex.

    No, color space doesn't affect the overall process.

    Something must be wrong with UVs on tree_4 (UVs have NaN values?) or possibly another object. Please make sure the UVs are ready for lightmapping.

    If it's still the "preparing" stage, then it usually doesn't take much time, and so no additional sub-stages are shown on the progress bar.

    Perhaps a good idea would be to first test Bakery in a small scene with some of your objects before attempting to bake the full one.
     
    Last edited: Nov 23, 2018
  7. Yuvii

    Yuvii

    Joined:
    May 20, 2014
    Posts:
    55
    false alert about the compression stuff. Nothing works.
    I'm trying to reproduce the same issue on a blank scene
     
    guycalledfrank likes this.
  8. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Thanks for the help. Im on unity 2018.2.16f1 64bit I have 3 d3dcompiler_47.dll in my project it seems, assets/plugins/x86_64, assets/plugins/x86 and assets/editor/x64/Bakery

    I wonder if another asset has also used the same name for their dll, seems unlikely though.

    Also note my scene is HUGE.. Been working on it for 7 years :) But actually I think it might have beena dodgy model, I foolishly had printing turned off in console so I did not see what it crashed on. Now I can see it much better :) I have removed another offending model so will try another bake.
     
    guycalledfrank likes this.
  9. almertineshop

    almertineshop

    Joined:
    Dec 29, 2017
    Posts:
    14
    Hi guycalledfrank,

    I'm excited and I want to buy the asset since there's the Black Friday sales, but I still skeptical, I'm not sure if it's going to work properly on my project. can I get trial or a watermarked version to test before buying?
     
  10. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    I'm getting a random issue with some scene objects (set as lightmap static) suddenly appearing oddly coloured. It's happening while I'm working on other elements in the scene (e.g. non-lightmapped NPC characters' AI scripting and animation, etc.), so not sure how or why it's happening. No errors in the console that I've seen - but as I say, because I'm not working on these objects, I'm not aware of exactly when this gets triggered, and console messages may have appeared without me realising (but then got 'cleared on play' while I'm doing other things).

    Appears this way in both scene view and in-game (play mode).

    I can confirm that rebaking fixes the issue, temporarily at least, although it then happens again randomly at a later time.

    Is this a known problem? Anything I can do to stop having to regularly rebake?
     
  11. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    There is no trial unfortunately.

    Try the "Update Skybox Probe" button.
     
  12. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    @guycalledfrank Sorry, that didn't do anything. Any idea what it could be?
     
  13. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    That's weird. Are there any light probes in the scene? And if not, can you try creating them - just an unedited LightProbeGroup somewhere above the map, and then rendering them? Will it fix this?
     
  14. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    So yes there are already light probes and a lightProbeGroup in the scene. I just did a 'Render light probes' and again , no change. Only a full 'Render' seems to do the trick.

    Here are my settings, in case that helps:

     
  15. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    So my bake went much further by removing semi dodgy models. But Im still hitting this error on quite an important model:

    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    ftModelPostProcessor.AdjustUV (UnityEngine.Transform t) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:202)
    ftModelPostProcessor.AdjustUV (UnityEngine.Transform t) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:228)
    ftModelPostProcessor.AdjustUV (UnityEngine.Transform t) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:228)
    ftModelPostProcessor.AdjustUV (UnityEngine.Transform t) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:228)
    ftModelPostProcessor.AdjustUV (UnityEngine.Transform t) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:228)
    ftModelPostProcessor.AdjustUV (UnityEngine.Transform t) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:228)
    ftModelPostProcessor.AdjustUV (UnityEngine.Transform t) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:228)
    ftModelPostProcessor.OnPostprocessModel (UnityEngine.GameObject g) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:64)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    UnityEditor.AttributeHelper.InvokeMemberIfAvailable (System.Object target, System.String methodName, System.Object[] args) (at C:/buildslave/unity/build/Editor/Mono/AttributeHelper.cs:161)
    UnityEditor.AssetPostprocessingInternal.PostprocessMesh (UnityEngine.GameObject gameObject) (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:419)
    UnityEditor.AssetImporter:SaveAndReimport()
    <ExportScene>c__Iterator0:MoveNext() (at Assets/Editor/x64/Bakery/scripts/ftBuildGraphics.cs:2026)
    <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()


    Whats the best way around this?

    Im putting in some debug values to check the value of padding at 202.

    Also as for my .dll issue do I just delete the 2 in plugins and keep yours?
     
    Last edited: Nov 24, 2018
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    You mentioned the object is Lightmap Static. Does it have a lightmap assigned (check the Baked Lightmap rollout on mesh renderer)? Or does it have Scale In Lightmap = 0?
    In any case, this bug usually happened due to unitialized skybox ambient probe, that's why I asked to try the "Update Skybox Probe" button. Such probes are only used on non-lightmapped objects. So there are at least 2 things that confuse me: the button doesn't seem to update anything for you, and the object is actually (?) lightmapped. I wonder if you have any other 3rd-party assets messing with objects. Also what Unity version are you on?

    Can you try it with this updated script?
    https://drive.google.com/open?id=1GxDd5B_utZSnAkR9XAy0XGtsy8YZIHyH
    Also just wondering... does this model have single meshes with lots of verts/tris?

    It shouldn't affect anything, you can keep it like that.
     
  17. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Well I got a bake! Stunning fast compared to using unitys own systems. Amazing work!

    One problem is im going from enlighten realtime gi to baked lighting, so things look a little different, for example it almost seems like emission on materials is not working (I have neon signs that used to feel really glowy), or maybe it only seems that way because the scene is brighter? I used 5 bounces so I am thinking that could have made it too bright etc. I recall that even with enlighten baked light seemed to looked a heck of a lot worse than the realtime precomputed GI stuff, I could never work out why really. But Im glad this works so I am going to play around with the settings and compare results with using enlighten realtime gi stuff, maybe its all in my mind :)

    As for the problematic models, it turned out to be one of my main ones that was built by me in sketchup, and I have noticed sketchup models seem to cause issues a lot (plus I dont know how to model properly and probably messed something up). I would say it isnt that complex a model, mostly cubes to be honest, but there is a small part where I used other models like fridges and things like that, and I suspect they could have been badly made/too many vertices etc. I could send it to you if it will help pin point any issues.

    Anyway I will have a good play with this now it runs for me, thanks for all the help, great product. Should only be a week or so before unity offer to buy this off you lol.
     
    guycalledfrank likes this.
  18. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Make sure you have "Global Illumination" set to "Baked" on the material as explained in this post.

    Just to check - can you try setting Index Format on the problematic model asset to "16 bit"?

    Glad it's finally working for you :)
     
  19. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Thanks, its already 16 bit, and yes all my emissive materials were set to realtime, thanks again.

    PS, just realised I havent even added Bakery Light components to my lights, can you explain slightly what the purpose of the script is and how results differ without it?
     
    Last edited: Nov 24, 2018
    guycalledfrank likes this.
  20. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    If you didn't use the components, none of the lighting you saw was baked apart from emissive surfaces. Bakery only bakes its own light components.
     
  21. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    Hi, just bought this asset because I'm looking for the best looking with highest performance solution for Android. What would be the best lighting preset using Bakery for this?
     
  22. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Hi! Bakery currently doesn't have presets, although it's planned. Default settings are quite good in terms of quality. For runtime performance the only thing that would make sense to tweak is the resolution (Texels per unit, Max resolution, Min resolution).
     
  23. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Ah, you should make it a feature so it can add the scripts itself and disable the light source etc, so people can test without going through a lot of work converting all of their lights.
     
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Bakery lights have some settings that Unity lights don't, so it's a good idea to properly check what you're doing.
    If you want to do it quick, there is still a way: type "t:Light" into the Hierarchy window to see all your lights, select all Points/Spots, add Bakery Point Light and press "match to real-time", then do the same with Directionals and Area lights.
     
  25. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Great thanks, I was just doing that but with a script - Im just wondering why BakeryPointLight has no "range" variable I can access via script?

    What a good tip though, you know after 7 years of unity I did not know you could search by type like that!!! Is there any way to select only point lights in the heirarchy without manually doing it, I have so many lights here.
     
  26. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    It's just called "cutoff"

    Yeah, I stumbled upon it on Twitter by accident, and now it saves me time every day :)

    I don't know a way to filter by light type. But if they differ by name (e.g. have a word "Point") then you can search by both ("Point t:Light")
     
    radiantboy likes this.
  27. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    That's amazing, thanks, very easy now to select only what I want. So now added scripts and re-rendering, but it appears to be doing all the uv padding adjustments again. Does this happen when you save scene to a different name or something?
     
  28. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    No, but it can happen if the lightmap resolution for some objects changed.
     
  29. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I think Ive got it working, everything looks just as nice as it did before, frame rate seems much better. So this might be a dumb question, but how can I be sure Im seeing baked light and not just normal real time stuff? :-o

    edit: Looks great on the whole, quite a lot darker than before somehow though. And reflections seems to be different too. I cant put my finger on it but it definitely looks different. Im going to make a video of each so I can compare by eye. Frame rate is incredible when baked which is my main draw to baked of course.

    Must admit I am very impressed by your asset! Great work.
     
    Last edited: Nov 25, 2018
    guycalledfrank likes this.
  30. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    If you have Unity lights disabled, then you see baked lighting ;)

    Unity could apply unrealistic constant ambient factor on top of actual lighting, making it brighter. Bakery doesn't have that.
     
  31. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    For example, using Unity's lighting the
     
  32. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    Hmmmm... While I do think the bake actual look better, it looks like Bakery adds a lot more artifacts and seams.

    upload_2018-11-25_14-35-53.png
     

    Attached Files:

  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    By "Unity" do you mean realtime lighting or one of the built-in lightmappers?
    Seams: make sure "Adjust UV padding" is enabled or/and increase lightmap resolution.
    The artifact: caused by compression. Inevitable, not specific to Bakery. Select lightmap assets, set compression to none, it will go away. Built-in lightmappers aren't immune to it either.
     
  34. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    No I'm not using realtime lighting in Unity, here is a comparison side by side of my settings:

    upload_2018-11-25_14-57-12.png
     
  35. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    So you're using 50 texels per unit in Enlighten and 20 in Bakery. Also the lighting is quite different. Why "Unity" screenshot is dark and "Bakery" one is bright? Perhaps the lights are set up differently?
     
  36. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    I'm not sure about the darkness either, I just added the Bakery Direct Light script to my directional light and clicked on the "Match lightmapped to realtime" and hit Render, that's it, I haven't changed anything.

    I'll try changing the texels to see what happens.
     
  37. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    Oh okay, yes increasing the texels to 50 got rid of the seams. The artifacts stayed and the lighting is still brighter though.
     
  38. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Bakery doesn't have the "gradient" environment lighting, so perhaps that's why it's brighter. Try using the same sky color for the Skylight component and also the Hemispherical checkbox, so everything below equator isn't bright. All ambient lighting is produced by the Skylight, environment settings from the lighting window are ignored.
    As for the artifact, I explained it before. In the Enlighten version you have solid color, so no compression artifacts are visible. In Bakery version you have a light/shadow transition, and texture compression produces artifacts. Texture compression is performed by Unity the same way for all textures. You can select lightmap files in your Project window and change their compression settings, just like with any texture assets.
     
    gsneto and EmpireStudios like this.
  39. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    So you dont use this for Point Lights correct?
     
  40. Fmo080308

    Fmo080308

    Joined:
    Oct 6, 2013
    Posts:
    2
    Hi!
    Using Unity built-in light baking i get 0 increasing in batch (drawcall)
    Using your plugin, which is extremely fast - really great, but i get additional batches.

    Is it a part of the plugin? Or i can do something to prevent it? Thank you!
     
    guycalledfrank likes this.
  41. gsneto

    gsneto

    Joined:
    Feb 10, 2018
    Posts:
    2
    Hi. Any plans to add support to unity's ambient light? I understand the skylight approach is more 'correct', however sometimes you just want everything to be a little brighter and the scene geometry won't allow it without a constant ambient light.

    This is a great asset by the way, thank you very much for making and supporting it.
     
    guycalledfrank likes this.
  42. hyperjxz

    hyperjxz

    Joined:
    Nov 21, 2015
    Posts:
    4
    Hello. I can't get this to work? It throws error when I press render. It says Can't create pixel shader. uvnormal.pso? Any ideas. Thank you.
     
  43. ViewportAU

    ViewportAU

    Joined:
    Mar 26, 2014
    Posts:
    26
    Hello Frank. I am getting the following error:
    NullReferenceException: Object reference not set to an instance of an object
    ftBuildLights.BuildLight (.BakeryLightMesh obj, Int32 SAMPLES, System.String outName) (at Assets/Editor/x64/Bakery/scripts/ftBuildLights.cs:266)
    ftRenderLightmap+<RenderLMDirect>c__Iterator3.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:4918)
    ftRenderLightmap+<RenderLightmapFunc>c__Iterator2.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3416)
    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)


    My scene has no fancy or weird things, in fact Bakery was working really good but then it got broken for no apparent reason. The problem happened right after I set a Bakery Group selector just to play with. but then since I was getting the error I deleted and revert it, but the bug remains. I have also tried this hotfix https://drive.google.com/open?id=1GxDd5B_utZSnAkR9XAy0XGtsy8YZIHyH to see if it was fixing it but didnt. Thank you

    EDITED

    Might be the problem is Area lights get a Mesh Filter on it while is baking and then they are removed once it finished... but if there is any crash - bug , Bakery leaves [none] (Mesh Filter) on area lights and that is way there is NullReferences? Potentially bakery could check if there is any null mesh filter on every area lights every time before to bake, and destroy it if it is null.

    It fixed my problem (manually though)
     
    Last edited: Nov 26, 2018
    guycalledfrank likes this.
  44. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Why not? Point lights can be baked.

    Are you using RNM or SH mode? Are you using Bakery shader?

    Thanks! I never planned adding a constant ambient factor - most of the time you can brighten up the scene in a more realistic manner with just Skylight and GI. As a last resort or stylized option, you can always boost the Indirect Intensity of any light to get brighter bounced lighting. Constant ambient just looks very flat early-2000-like.
    As a super-last-resort you can create Bakery Direct Lights with shadow samples set to 0, so they don't have shadows. They will basically shine through everything, so having one top and one bottom light (or maybe even 6 from all sides) will give you fake constant ambient lighting with normal variation.

    Bakery needs Unity editor to be running in DX11 mode, which is the default one, and I'm not sure if you can change it. But perhaps you're running it with another graphics API?

    Thanks for noticing - yeah, seems like a bug. Originally Bakery only supported pairing Light Mesh components with MeshFilter+MeshRenderer to define the mesh as a light source. Later I also made it possible to combine them with built-in Area Lights, but to make it work it simply created temporary MeshFilter+MeshRenderer and then executed existing code. Seems like having an already added MeshFilter on the area light object can confuse it. Fixing it now.
     
    gsneto likes this.
  45. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    I've seen subtractive mode mentioned a few times but I can't seem to get it working, is there any trick to it? Doing the bake using the Unity GPU lightmapper works fine, but I'm not sure what settings (what render mode, settings on directional light etc) I need to use with Bakery to make it work. Thanks!
     
  46. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Subtractive mode is engine-side, it doesn't require any special maps to be baked. TBH I never tested it, maybe someone else in the thread can answer.
     
  47. Fmo080308

    Fmo080308

    Joined:
    Oct 6, 2013
    Posts:
    2
    Turn out the problem comes from the Cut out shader (Unity Standard shader). Any solution? :D
     
  48. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    Yeah that's what I saw you said before. It seems like something must be getting set at bake time, because if I do a Unity bake in subtractive mode it's all good, but *switching* to subtractive mode (using Unity or Bakery) does nothing.

    EDIT: OK, I've got it working. You need to run the Unity GPU lightmapper (with subtractive enabled) first, and then run the Bakery lightmapper and 'overwrite' the lightmap. If you clear baked data and then run Bakery, it won't work. Currently digging around to see if I can find what's being set.

    EDIT 2: OK, I can skip the GPU lightmapper step if I manually set the light baking output on the main directional light after running Bakery.

    Code (CSharp):
    1. LightBakingOutput output = GetComponent<Light>().bakingOutput;
    2. output.isBaked = true;
    3. output.lightmapBakeType = LightmapBakeType.Mixed;
    4. output.mixedLightingMode = MixedLightingMode.Subtractive;
    5. GetComponent<Light>().bakingOutput = output;
    6. GetComponent<Light>().SetLightDirty();
     
    Last edited: Nov 26, 2018
    guycalledfrank likes this.
  49. hyperjxz

    hyperjxz

    Joined:
    Nov 21, 2015
    Posts:
    4
    Thank you for replying. It says <DX11 on DX10 GPU> at the top and it throws me this error after "Can't create pixel light".
    "The current working directory was changed from ***/bakery to *** bakery/assets/Editor/x64/Bakery. This is not allowed! If you are setting the current working directory from script temporarily, then please make sure to set it back to Unity project folder immediately after you are done.

    ftRenderLightmap:Render#lightmapUpdate() *** at ftRenderLightmap.cs:2554 , 2549"
    I have a NVIDIA Quadro FX 3700M on this machine, maybe it is too old..
     
  50. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Weird... I don't do anything special about cutout shaders. Perhaps the difference in batches can be explained by the different amount of generated lightmaps. Bakery sorts the scene into atlases differently, so some objects could end up using a unique lightmap instead of shared.
    You can try increasing the Min Resolution value in advanced settings to force Bakery generate larger lightmaps shared with more objects. However, some of these lightmaps may end up not completely filled.

    Nice find! I'm gonna add it to the next version. One problem though is that pre-2017.4 Unity versions don't have the LightBakingOutput class, so I'll need to reverse-engineer it a bit or just make a 2017.4+ only feature.

    Unfortunately it is. Kepler is the oldest supported GPU architecture (GTX 6xx). I didn't check which Quadro series are comparable before and their names are a bit confusing, but a good rule of thumb is that the card should be at least from 2012, and yours seem to be a 2008 GPU.
    Feel free to ask for a refund. I'm gonna add a more detailed warning about unsupported cards.
     
    adslitw and hyperjxz like this.