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. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    What does the progressbar say when it freezes? How big is your scene?

    I know all that. Thing is, I don't see how to set it on older (before 2017.3) versions of Unity. E.g. here are 2017.2 docs: https://docs.unity3d.com/2017.2/Documentation/ScriptReference/Light.html
    Note there is no bakingOutput.

    Interesting. What is the exact scale and rotation of the object in world space (e.g. if you unparent it from everything)?

    Yeah, it was originally working when the object itself is flipped, but then I extended it to parent. TBH the test is pretty dumb:
    bool isFlipped = Mathf.Sign(obj.transform.lossyScale.x * obj.transform.lossyScale.y * obj.transform.lossyScale.z) < 0;
     
    Vagabond_ likes this.
  2. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    453
    Same here. New version fixed the problem on some negative scale. But I still have black object on some other negative scale.
     
  3. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    What's the exact transform?
     
  4. CGBull

    CGBull

    Joined:
    Feb 12, 2017
    Posts:
    82
    There is no hint. The export scene is always displayed. Then I figured out the solution, just click either ReflectionProbe or LightProbe, and then click Render LightMap to successfully export the scene.
     
  5. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    453
    2018-08-18_00h10_41.png 2018-08-18_00h12_41.png 2018-08-18_00h13_26.png Some screenshot with only a skylight. With Enlighten is impossible to get this quality without using also area light on the windows. Texels 100, render times 45 minutes with a gtx 1070.
     
  6. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    453
    And this one of the object with negative scale that still have problem: 2018-08-18_00h22_15.png
     
  7. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    These are AMAZING :eek:

    I'll test negative scale more thoroughly
     
    Archviz3d likes this.
  8. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    So, i am trying undestand how work with Render Selected with generated by Unity UVs. I am try bake render selection with Group Selector with different settings and without it - in result always lightmaps on not selected objects is broken. Can you tell - how use this feature? Or may be it`s contains errors and you can fixid it in future release?
     
  9. g8minhquan

    g8minhquan

    Joined:
    Jun 18, 2014
    Posts:
    38
    I bought Bakery and a used GTX 1060 and I'm so happy with them.
    Super fast lightmap rendering! Thanks for the great asset!

    Just another noob question, is there a way I can bake lightmap per prefab? Specifically I'm making an endless runner quite similar to Subway Surfer, so the main character position is always at a fixed position in world space, only background prefabs will be instantiated at runtime and moved towards camera. I want to bake lightmap into those background prefabs.
    Thanks
     
    Mark_01, YouDesign and guycalledfrank like this.
  10. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Sounds like a bug :( I didn't test this feature for a long time. Also I should make it work like most people expect, e.g. without adding any groups. Will try to fix as soon as possible.

    You sort of can. In fact it's not that hard, but there is no interface for it (yet?). You'll need some scripting:
    1. Create your prefab in a separate isolated scene.
    2. Bake it.
    3. The most important bit: use a script to find the object named !ftraceLightmaps and unhide it:
    GameObject.Find("!ftraceLightmaps").hideFlags = 0;

    This object stores mapping between objects and lightmaps and applies them on Awake().
    4. Put this object inside the prefab.

    Now if you instantiate the prefab, it should be lightmapped. Note that lightmapping might break if you rebake the whole scene later, so make sure you don't rebake scenes with already baked prefabs.
     

    Attached Files:

    g8minhquan, Mark_01 and YouDesign like this.
  11. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    Thanks. I'm sure, it`s very important function for most people...
     
  12. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Good news: non-lightmapped objects (scale in lightmap = 0) now cast GI :)

    vlm1.jpg
     
  13. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Wasn´t this already working? I mean I had trees with lm scale 0 and they (seemed) to properly render shadows in lightmap.
     
  14. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Yeah, they did cast shadows correctly, but didn't bounce light properly.
     
    TooManySugar and YouDesign like this.
  15. theorchestrator

    theorchestrator

    Joined:
    Aug 9, 2013
    Posts:
    8
    Hi, since updating to v1.1 the scene gets wayyy to bright. It didn't happen with 1.05. I already tried clearing all baked data as well as switching Unity versions. UnityLights are also disabled. Any ideas? :)

    In Editor after bake:
    fine.PNG
    When starting the game in editor and after building.
    TooBright.PNG
     
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Try selecting all your lightmaps and setting Texture Type to Lightmap.
    Also for future bakes set Encoding to Mobile.
    What platform are you running on?
     
    theorchestrator likes this.
  17. theorchestrator

    theorchestrator

    Joined:
    Aug 9, 2013
    Posts:
    8
    Setting them all to lightmap manually helped! Thanks! Platform is PC only atm
     
    guycalledfrank likes this.
  18. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    89
    Hello,

    I'm having a strange issue where materials that are assigned to my prefabs clear off when baked. I have to reapply the materials to every prefab after bake. Do you happen to know why this is happening?
     
  19. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    That didn't happen before - thanks, I'll check and fix
     
  20. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Found the bug, fixed it. Wait a bit for the next update (or contact me to send you a beta via PM) :)

    negscale2.jpg
     
    fuzzy3d, Amin-, Archviz3d and 5 others like this.
  21. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    453
    You are the number one!
     
    Archviz3d and guycalledfrank like this.
  22. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    Can these objects with 0 in scale in lightmap use with Light Probes?
     
  23. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Yeah, they will, as any non-lightmapped object.
     
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Just added some interesting easy tweak to control how much light should pass through a polygon and become visible on backfaces. This is very useful for thin translucent objects like leaves, stuff you usually render with 2-sided shaders:

    ftBackface4.jpg

    ftbackface.jpg

    ftBackface3.jpg

    ftBackface5.jpg

    Ideally it should be material property, but because I have to support existing materials, I'm not sure where to put it, and it's global for now.
     
    Last edited: Aug 19, 2018
    CoastKid, Amin-, g8minhquan and 7 others like this.
  25. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    cool, may be this could be controlled per material. From a manager on the main menu, some sort of dropdown with an array of materials and the value aside. So "leaf" material will have a value of 0.6, "thickleaf" 0.8 ... Like you would add desired materials, not all scene mats listed. default would be thickness 1 for the rest.
     
    guycalledfrank likes this.
  26. ngfilms

    ngfilms

    Joined:
    Nov 18, 2015
    Posts:
    30
    havi
    in my case, . i found unity's lighting data asset file was assigned to global maps from previous unity bakes, removing it solved the problem ( assuming this data asset file is now defunct?)
     
  27. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    when will the directional lightmaps will come ?
     
  28. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    It`s great! Can't wait to try this... It would be good if the Backface GI working with vertex-lightmapping.
     
    Last edited: Aug 20, 2018
  29. Archviz3d

    Archviz3d

    Joined:
    Apr 4, 2016
    Posts:
    92
    you rock :)
     
    guycalledfrank likes this.
  30. ngfilms

    ngfilms

    Joined:
    Nov 18, 2015
    Posts:
    30
    i have a fairly large scene ( 1.7 gigs on unity ) , its almost all static. while Bakery exports, it uses memory above my ram limit of 16gigs which causes the comp to hang. is there a solution for this aside from getting more ram?
     
  31. JohanL

    JohanL

    Joined:
    Apr 15, 2013
    Posts:
    20
    upload_2018-8-20_10-50-44.png

    That would be the transform of one of the objects.
     

    Attached Files:

  32. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Shadowmask will come first. Hopefully even in the next version.

    It should work!

    And just to make sure there is no misunderstanding: Backface GI doesn't bake lighting on backfaces - it only propagates front-face illumination to back faces, so other objects that "see" the backface will be lit by it.

    1. I reduced export RAM usage a bit in the latest (soon to be released) version, but not too much.
    2. What does the progressbar say when it hangs? "Rendering lightmaps - preparing..."? If so, it might be able to work, but doesn't due to a bug I found and fixed just yesterday. Some libraries used during export weren't handling 64-bit memory range properly and that could cause export to crash/freeze on a large scene. Try replacing this file in Assets/Editor/x64/Bakery and see if it helps: https://drive.google.com/open?id=1338poM8Zt1NLtErnCy5TmxlZ0WCqK4WY

    Thanks! That should be fixed now in the newest version (to be released).
     
    Mark_01 likes this.
  33. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    "Shadowmask will come first. Hopefully even in the next version."
    OK now I'm seriously hyped.
    EDIT: unless you whant to keep this as surprise or secret would have nice some progress update on how the shadowmasking part coming out.
     
    Last edited: Aug 20, 2018
  34. ngfilms

    ngfilms

    Joined:
    Nov 18, 2015
    Posts:
    30
     
  35. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    is this same gpu lighmapper that would be coming on unity 2018.3 ??
    or its different?
     
  36. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Different of course. I'm not Unity.
     
    tntfoz and TooManySugar like this.
  37. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    I tried to bake a scene which only has mobile diffuse shader and i added a bakery direct light and i dont see an option for match light with direction light, however i tried to bake the whole scene but all i get is pure black lightmap. using unity 2017.4.1 . :)
     
  38. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Mobile diffuse shader shouldn't be a problem. On which object did you add the light? Matching button only appears when Unity/Bakery lights are on the same gameobject.

    Do example scenes work? If they do, then check for usual stuff in your scene - like if the object with Bakery light is enabled, and there is no huge shadowcasting skydome or something.
     
    lolclol likes this.
  39. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    ok i made a mistake, i didn't add bakery light script to the default unity's direction light. Rendering Again. Sorry
     
  40. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    In addition, do i need to add the bakery light script for unity's point, spot and area light ?
     
  41. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    You don't have to add Bakery lights to Unity lights. It only gives you a button to copy settings from one to another.
    But Bakery only respects its own light components.
     
  42. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Something is coming :eek:

    smask1.jpg
     
  43. Balours

    Balours

    Joined:
    Nov 27, 2013
    Posts:
    59
    Hi!
    Looks awesome. I just tested with a couple a small scene and it worked good, then I tried on a more complexe scene but nothing to fancy and I'm getting this error at 55%:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. ftUVGBufferGen.RenderUVGBuffer (UnityEngine.Mesh mesh, UnityEngine.Material[] materials, Vector4 scaleOffset, Matrix4x4 worldMatrix, Boolean vertexBake, UnityEngine.Vector2[] uvOverride) (at Assets/Editor/x64/Bakery/scripts/ftUVGBufferGen.cs:170)
    3. ftBuildGraphics+<ExportScene>c__Iterator0.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftBuildGraphics.cs:2747)
    4. ftRenderLightmap+<RenderLightmapFunc>c__Iterator2.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:1658)
    5. ftRenderLightmap.RenderLightmapUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:1568)
    6. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:191)
    Any idea where this come from? I'll try removing one object after another to see if it changes anything and come back to you if I find something!
    Thank you,
     
  44. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
  45. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    Hurry up and finish Shadowmask and Directional lightmaps so you can take my money :).
     
    guycalledfrank likes this.
  46. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,666
    Some more shadowmask tests. Sphere is the only dynamic shadow casting object, everything else has baked shadows.

    smask2.jpg
     
    AntonioModer likes this.
  47. Autarkis

    Autarkis

    Joined:
    Oct 10, 2011
    Posts:
    318
    Beautiful stuff.
    Does bakery support SLI setup .. and if not, is it something you're looking to implement?
     
  48. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    @Autarkis I tested it today and perfmon showed both my GPUs engaged (a 670 and a 1060).
     
    TooManySugar and guycalledfrank like this.
  49. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    I'm looking to include Bakery in an automated workflow for multi-scene baking. I apologize if I missed it in the manual and forum, but is there a callback when a bake is complete? It would be nice to have callbacks for completion and error handling. Right now I'm just looking at sticking one at the end of RenderLightmapFunc
     
    Last edited: Aug 21, 2018
  50. Autarkis

    Autarkis

    Joined:
    Oct 10, 2011
    Posts:
    318
    Insta-buy then :)