Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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

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

  1. MattVLSG

    MattVLSG

    Joined:
    Apr 2, 2018
    Posts:
    43
    Ok sure - though it seems the Unity one is pretty accurate (you can see the shadows falling pretty closely on each checker).

    Great! That did it! :) What is happening though with this option? Because I was always using 'Force On' because - from the docs, "If disabled, and the scene is too big, Bakery may go out of memory."
     
  2. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Magic. It can slow down rendering a bit, but also make huge maps fit into memory.
    I've just sent a PM for you to investigate why it breaks on your scene.
     
  3. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
  4. Balours

    Balours

    Joined:
    Nov 27, 2013
    Posts:
    59
    Hi @guycalledfrank,
    Are you aware of a difference in anything related to the lightmap between the 2018.2.2 and 2018.2.6? I had a scene working perfectly in the first one but now it looks like the UV generated are different so everything is messed up.
    I've checked the changelogs but saw nothing related to that, but when I open the project with 2.6 I can see it's re-importing and doing something on all the meshes with the generates UV lightmap box checked.
     
  5. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Not really, 2018.2.2 was the last version I tested it on.

    Perhaps they changed something about renderer lightmap scale/offset. Does rebaking the scene help?
     
    Balours likes this.
  6. Balours

    Balours

    Joined:
    Nov 27, 2013
    Posts:
    59
    I just tried the "Reimport" option for the model and it seems to fix the issue. So basically the UVs were the same but with an offset.
     
    guycalledfrank likes this.
  7. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Good to know!

    Does anyone want to test LOD support before the release? Send me a private message.
     
  8. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    A hacky as heck solution, but you could give all surfaces a small amount of emission?
     
    DebugLogError likes this.
  9. DebugLogError

    DebugLogError

    Joined:
    Jul 24, 2013
    Posts:
    54
    @guycalledfrank Does every child mesh of a lightmap group selector require its own lightmap group selector? I have two groups of individual meshes, each group needs its own separate lighting even though the groups sit very close together and would be contributing to each other's lighting otherwise (technical constraint). I'm attempting to do this with the lightmap group selector(s) and bitmask properties. I have it very close to behaving how I want - except since each child mesh per group has its own lightmap group selector so it seems like I may be doing something wrong?

    Interesting idea, I'll definitely see how that works out. Thanks!
     
    Last edited: Sep 5, 2018
  10. Archviz3d

    Archviz3d

    Joined:
    Apr 4, 2016
    Posts:
    92
    This looks really good!!! It would be a nightmare to make a good unwrap out of this and have a proper resolution for normal lightmap bake...not to mention the render times would go up !!! Really curious to try this out!!
     
    guycalledfrank likes this.
  11. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Well vertex lightmaps are already out, you can try them since 1.1 :)
     
    Archviz3d likes this.
  12. Scarabay

    Scarabay

    Joined:
    Sep 7, 2013
    Posts:
    15
    guycalledfrank, there's something wrong with the shadowmask mode. The first screenshot is Bakery, the second one is progressive lm:
    bakery.PNG progressive.PNG

    This test scene has 8 mixed point lights with Bakery point light on each marked as Shadowmask.

    And I got an error when I duplicate some light and change its color:


    ArgumentException: Getting control 13's position in a group with only 13 controls when doing ExecuteCommand
    Aborting
    UnityEngine.GUILayoutGroup.GetNext () (at C:/buildslave/unity/build/Modules/IMGUI/LayoutGroup.cs:117)
    UnityEngine.GUILayoutUtility.DoGetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:425)
    UnityEngine.GUILayoutUtility.GetRect (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:385)
    UnityEngine.GUILayout.DoButton (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:34)
    UnityEngine.GUILayout.Button (System.String text, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:27)
    ftPointLightInspector.OnInspectorGUI () (at Assets/Editor/x64/Bakery/scripts/ftPointLightInspector.cs:355)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1374)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  13. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Masks are clipped where there is no light. Are these points or spot lights? Is this abrupt ending actually visible on the final image?

    EDIT: I'm testing a similar scene right now (lots of overlapping points) and found that problem. Investigating now!
    I assume there are warnings in console like "Light Point Light can't generate shadow mask (out of channels)."?

    This is some kind of Unity UI bug - I don't know why it happens, and it's harmless, ignore it.
     
    Last edited: Sep 5, 2018
  14. Archviz3d

    Archviz3d

    Joined:
    Apr 4, 2016
    Posts:
    92
    yeahh already bought it :) ...but still didnt had time to really try it out :)
     
    guycalledfrank likes this.
  15. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    I'd like!! please send to xgits@outlook.com
     
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Found the problem and fixed:

    upload_2018-9-5_16-41-47.png

    Will include this fix in the newer version, and can send a quick patch to you.
     
    Mark_01 likes this.
  17. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Hi.

    I have not yet managed to complete a successful process. The errors are diverse and I try to reduce them by interpreting the messages ... but I can not.

    First of all it gives me an error when exporting the scene:

    I thought it was UV problem so I modified the options. After this, the process "Exporting scene - finishing objects" began. But it's never over.

    Once a message "error creating texture" (or something similar) appeared
    Then I got an error in ttrace or similar

    I have arrived at "rendering lightmaps - preparing" but I have not managed to advance further.

    I have an i7-4790 with 16GB RAM and NVIDIA GTX 1060 6GB

    I have also had memory occupation problems. 13 GB Unity! doing the processes.

    The fact is that I have tried several times changing parameters and other things, but without success. So I have no choice but to come to you and ask how to solve this.

    Thank you very much.
     
  18. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Currently yes. I'm thinking of updating the lightmap group stuff for the upcoming version.

    Currently that means -> 2 Lightmap Group assets and the Selector component on every child with one of 2 groups selected.

    So... do you want them to NOT affect each other? In this case, Groups won't help. What you can do is to separate them into different scenes, bake individually and then put back together.

    Bitmask will allow you to filter lights from being applied to lightmaps, so it kinda works, yeah, but it won't affect GI propagation.

    Generally no, it's not wrong. But I'm going to add a new mode to the selector, so it won't require it.


    Does it also happen with example scenes?
     
    DebugLogError likes this.
  19. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    Hi, i have some problem - every time when i bake my scene, on "Exporting scene - adjusting UV padding..." step unity recalculate UV2 coord with UnwrapCL.exe. It is very long for my scene. Can i skip this step or disable recalc UV2 every time?
     
  20. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    @guycalledfrank I think I have run into a bug on the Mesh Light. We use a mesh that has 2 materials (i.e. with sub-mesh) with only 1 being emissive (set as Light Bakery). When I use this mesh it causes an error in the build. It works if there are 2 materials on a single mesh, just doesn't work with sub-meshes.
    upload_2018-9-5_12-37-45.png

    upload_2018-9-5_12-39-44.png

    It doesn't seem to be handling the second material correctly since it isn't emissive or have a correct texture on it for a bakery light.
     
    guycalledfrank likes this.
  21. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    I have same error too sometimes, but a little different text:
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[System.Collections.Generic.List`1[System.String]].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    ftRenderLightmap.UpdateMaskArray (Int32 LMID, System.String lname, UnityEngine.Light ulht, Boolean denoise) (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:4289)
    ftRenderLightmap+<RenderLMDirect>c__Iterator3.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3885)
    ftRenderLightmap+<RenderLightmapFunc>c__Iterator2.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2466)
    ftRenderLightmap.RenderLightmapUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:1923)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:191)


    After reload project i get another error:

    InvalidOperationException: Operation is not valid due to the current state of the object
    System.Collections.Stack.Peek () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:321)
    UnityEngine.GUI.EndScrollView (Boolean handleScrollWheel) (at C:/buildslave/unity/build/Modules/IMGUI/GUI.cs:1414)
    UnityEngine.GUI.EndScrollView () (at C:/buildslave/unity/build/Modules/IMGUI/GUI.cs:1408)
    ftRenderLightmap.OnGUI () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:824)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)
    UnityEditor.PopupCallbackInfo:SetEnumValueDelegate(Object, String[], Int32)
     
    guycalledfrank likes this.
  22. zagreekie

    zagreekie

    Joined:
    Nov 20, 2017
    Posts:
    29
    @guycalledfrank The issue that @CaptainMurphy is having looks very similar to what was happening to me, (the sci-fi internal wall panels) where I have multiple materials on a mesh only one of which has emissive maps on it.

    I fixed it personally by re-exporting the OBJ from blender with "separate mesh groups" however there is probably a bug somewhere there which is causing this underlying problem.
     
  23. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I got around it by adding a try/catch around that section that does the f.write() and just having it do a write to 0 if it fails.
    upload_2018-9-5_13-4-4.png
     
    guycalledfrank likes this.
  24. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Some tests.
    This is mobile game so all in gamma and low resolution. Love the quality))
    upload_2018-9-5_21-20-20.png
    upload_2018-9-5_21-20-13.png
    upload_2018-9-5_21-20-37.png
    upload_2018-9-5_21-20-43.png
     

    Attached Files:

  25. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    upload_2018-9-5_21-22-36.png
    upload_2018-9-5_21-22-42.png

    Rendering time 190sec on gtx1070!
     
    Last edited: Sep 5, 2018
    Mark_01 and guycalledfrank like this.
  26. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Yes you can. It's the "Adjust UV padding" checkbox in Advanced settings. It utilizes built-in Unity unwrapper (which is slow) to modify UVs. If you disable this step, you may get leaks at UV chart edges. When it's enabled, it may re-unwrap stuff every time "texels per unit" or LMGroup resolution changes.

    Seems like a bug, yeah. Will investigate. Probably don't use Light Meshes with multi-materials for now.
    Also in your case it's not the best idea anyway, as you don't want to emit light from metal.

    That seems like a bug too, but just today I changed shadowmasking code a bit, and I think it shouldn't happen anymore. I can send you a patch to test.

    Nice!
     
  27. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    Thanks, Yes, it`s will be good...
     
  28. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    After swapping all of the lights to use the mesh instead of a point light I now get an error baking the scene.

    upload_2018-9-5_15-8-50.png
    upload_2018-9-5_15-9-9.png

    After hitting OK I get this:
    upload_2018-9-5_15-9-56.png

    I am going to try cutting the detail level down some to see if it bakes at a lower setting.
     
  29. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Sent you a PM.

    Ouch. Is it caused by a particular Light Mesh?
    Can you try disabling the Selfshadow checkbox on all Light Meshes?
     
  30. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I tried both on and off for self shadowing. It appears to be something with the GI pass that causes the issue. If I turn the GI passes to 0 it will bake ok, albeit a bit too precise.
     
  31. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    But it didn't happen before you changed the lights? Or were there any other changes?
     
  32. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I ended up giving up on that route and instead made a cubemap cookie for the lights since point lights were baking fine. In order to cut down on processing I made the cookie have the blurring already in it so there was less casts for lighting.






    Down from 31 hours Enlighten bake time to around 18 minutes. Definitely an improvement!
     
  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Nice! You can also try increasing Shadow Spread on lights to make shadows blurrier. On point lights this value represents the radius of an imaginary sphere from which shadows are cast.
    Mesh lights should still work though. If you'll be able to narrow this problem down to a specific mesh causing the crash on GI, it would be immensely helpful!
     
  34. Scarabay

    Scarabay

    Joined:
    Sep 7, 2013
    Posts:
    15
    Nice job! Yes, please send me the fix. Thanks!
     
  35. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Done!
     
  36. theorchestrator

    theorchestrator

    Joined:
    Aug 9, 2013
    Posts:
    8
    Had the problem aswell, can you send me the fix too? Thanks!
     
  37. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    And done.
     
  38. Scarabay

    Scarabay

    Joined:
    Sep 7, 2013
    Posts:
    15
    guycalledfrank, thanks, it helped, but I ran into another problem. Shadowmask is bigger than a point light range with Bakery (top), and with PLM it looks good. Because of this, some lights are not baked.
    Light Point Light can't generate shadow mask (out of channels).

    So it should be?
    2.PNG
    3.PNG
     
  39. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Hmm, I think I know why it happens. Will try to fix.
    Is it even a real scene? More looks like a test specifically designed to make my code fail :)
     
    w00dn likes this.
  40. theorchestrator

    theorchestrator

    Joined:
    Aug 9, 2013
    Posts:
    8
    Shadows seem to work now but I am still getting weird artifacts on the walls and ceiling.
     

    Attached Files:

  41. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Just sent you both another patch.
     
  42. quabug

    quabug

    Joined:
    Jul 18, 2015
    Posts:
    66
    Hi guycalledfrank,
    Thanks for your awesome plugin, but there's one problem which bothers me for awhile.
    When I switch from Unity, I notice there's shadows from point light which was disabled on Unity light by choose shadow type to 'No Shadows'.
    Is there any way to disable shadow like Unity did?
     

    Attached Files:

  43. yueding

    yueding

    Joined:
    Feb 26, 2014
    Posts:
    3
    more cutout may crash unity editor? may be 20
     

    Attached Files:

  44. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    I avoided all kinds of non-physical behaviour originally, and shadow-less lights are an example of that.
    There is a way you can still hack it for Direct lights - by setting Samples to 0, but I'm not sure it will work correctly for other lights.

    Edit: Actually - try this little patch:https://drive.google.com/open?id=1J4cDvF5nK6WrynHgGodBI9Mo9KA7QU-2
    You should be able to get shadow-less Point/Spot Lights with it by setting Samples to 0 too.

    Do you mean you have many different cutout materials, and it crashes? When? What is the error message?
     
    Last edited: Sep 6, 2018
  45. yueding

    yueding

    Joined:
    Feb 26, 2014
    Posts:
    3
    Here is a test project, SetAlphas or GenerateAlphaBuffer may crash editor
     

    Attached Files:

    guycalledfrank likes this.
  46. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Thanks! Can reproduce. Investigating now.
     
  47. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Mark_01 and Balours like this.
  48. Scarabay

    Scarabay

    Joined:
    Sep 7, 2013
    Posts:
    15
    May be :) It's a simple scene with a plane and several point lights for quick baking lightmaps.

    Thanks again!
     
  49. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,629
    Just added one hacky option everyone was asking about:

    upload_2018-9-6_16-54-56.png

    Can be set per-light. Will be in the next release.
     
    DebugLogError and Balours like this.
  50. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Here is a current bake run. Getting much closer to a final product, and the bake times are crazy short compared to Enlighten. I think my last hurdle is going to be getting the curtains to work like I want with light transmission/shading, but otherwise it is looking great.









     
    JamesArndt, ftejada, Mark_01 and 4 others like this.