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,667
    Thanks! If you ever encounter any errors using GI VRAM optimization again, feel free to PM me with details, as I'd really like to fix it :)
     
  2. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    So, if we whant a group of objects to fall inside the same lightmap, we should create a lightmap group and add the ligthmap group component on the root of theese object group parent gameobject .(I have them al ready grouped in hyerarchy I mean). And in the options choose "simple" and the desired resolution, would that be right?

    edit( you may whant to update the title of the thread to 1.3 released :p)
     
    guycalledfrank likes this.
  3. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    If they have non-overlapping UVs (unwrapped together in a modeling package in a single layout), then yes.
    Otherwise use "Pack Atlas" mode instead of simple.

    Good catch! I totally forgot about the thread title and the 1st post, they weren't updated in weeks! :D
     
  4. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Fun hack: you can bake containers with closed doors so they are lit, but not dark on the inside:

    upload_2018-9-19_23-17-38.png

    Because meshes don't receive lighting from lower resolution LODs, if you put the container to LOD0 and the door to LOD1, this is what you will get. Then disable LODGroups and use it :)
    Obviously it's not the most convenient way, but just a funny misuse of LODs I accidentally came across.
    In the future I'll have to do a proper solution for doors.

    EDIT (dec 2022): attached the example scene. Enable the LODGroups on "door" and "container", bake, disable the LODGroups.
     

    Attached Files:

    Last edited: Dec 13, 2022
  5. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    you're hacking Unity lighting too far. ( ͡° ͜ʖ ͡°)
     
    guycalledfrank likes this.
  6. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    I'm sorry to report that the docked window behavior, while better than in version 1.2, is still broken in 1.3. I am attaching a screen shot showing the problem. The scroll bar now appears as it should, but this window still tries to force whatever tab bar (screen section) it is part of, to occupy the maximum vertical space. In this screen shot, you can see that Bakery's window has its scroll bar, but I am unable to move the horizontal split between Hierarchy+Game and Project+Scene areas upward at all.

    If I undock or close Bakery, the problem is immediately fixed. That being said, it is working better than before, so we're headed in a good direction. :)

    BakeryWindowProblem-2.jpg
     
    guycalledfrank likes this.
  7. MattVLSG

    MattVLSG

    Joined:
    Apr 2, 2018
    Posts:
    43
    Hello, can't seem to get LightProbes to match lighting with the baked scene, they always seem a good amount brighter. When in the shadowed areas (in screenshot), they do darken the Sphere , but barely at all.

    2018-09-20 14_34_59.png

    What could be causing this? I've matched the bakery sky to the Lighting panel sky (cubemap, intensity) as well.

    Thanks!
     
  8. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    No idea TBH. Can you send me this test scene as unitypackage so I can get a closer look?
     
  9. ViperTechnologies

    ViperTechnologies

    Joined:
    Apr 28, 2017
    Posts:
    42
    Well, Completely nothing ! there was a surface facing to area light ... but as a personal experience and advice for whom ever wanted to try the area lights in bakery ... it is not like Unity's Area Light i mean with a value of 0.5 or 1 you wont get a crazy Alienated Eye-Blinder Light ! it is cool to set the values (intensity and indirect multiplier - i hope i address this right) to some thing like 1.8 - 2.5.
    ours was 0.2 for intensity ... and it was that less we couldn't saw the light is being baked (no difference with the amount of ambient light!) :| though i am not sure if it is suppose to happen or not ... but with a raise in the amount of the values problem is gone !

    Thank you Frank :)
     
    guycalledfrank likes this.
  10. ViperTechnologies

    ViperTechnologies

    Joined:
    Apr 28, 2017
    Posts:
    42
    I forgot to tell !
    I think we have another problem !
    We baked the scene we added some Reflection Probes which we was needed and then we select the "Render Reflection Probes" bakery menu. good set ... but when hit play ... the reflection prob is reseted to nothing ! no reflections no nothing !
     
  11. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Reflection probes are rendered by Unity and saved to LightingDataAsset, I barely touch them (I'm calling the same function Unity does when you hit "Bake reflection probes"). Maybe try deleting the asset and baking them again.
     
    ViperTechnologies likes this.
  12. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    I am encountering these shadows b/t all my road modules. I didn't have this issue with Progressive light mapper. Is there some settings I can use to fix this?
    EDIT: I think progressive shows some seam too, but not as evident. It could be a general lightmapping issue with modular pieces...
     
    Last edited: Sep 20, 2018
  13. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Do roads overlap, or do they connect precisely? Are they unwrapped automatically ("Generate Lightmapping UVs" on the asset) or manually in modeling package?
     
  14. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    They do not overlap. They are unwrapped automatically. I'm not sure how to manual unwrap uvs and put then into unity. I use blender by the way.
     
  15. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Perhaps the resolution is just way too low for the roads, and you were using a higher one on Progressive. It still shouldn't happen though... can you try with denoising and seam fixing disabled, will it help?
    Also check if disabling compression on the lightmap asset changes anything.
     
  16. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    when both denoise and fix seam are turned off it seems to fix it.
    Compression doesn't change it.
    Resolution doesn't fix it, but makes the blurry shadow smaller.
     
  17. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Dear Frank, got another question ! What should I do if I want to bake cutoff using my custom shader? upload_2018-9-20_20-9-37.png
     
  18. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Bakery doesn't support custom shader opacity at the moment. This is because using Meta Pass logic for opacity would give insufficient precision. To get cutout opacity working you need:
    - Have "Transparent" or "TransparentCutout" tag in your shader.
    - Have opacity in the alpha channel of a texture named _MainTex in the shader.
    - Have a float parameter named _Cutoff with a corresponding cutoff value.
     
  19. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Interesting! Can you check if it's because of the denoiser OR seam fixer? (or only if they are both on?)
     
  20. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Thanks!!Will try!
     
  21. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Only when both are off then it doesn't have the issue.
     
  22. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    I still have issues with light probe. Please see this picture, the probes are bright even under the shadows:

    upload_2018-9-20_9-11-51.png
     
  23. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Directional is COMING

    fddir2.png
    ftdir.png


    Unless you or MattVLSG can provide me an example unitypackage with this bug, I can't help, because I can't reproduce it in any of my scenes.

    I think I know what's going on. Denoiser is a neural network operating on pixels, trying to find noise. Because you have a very low resolution lightmap, sometimes it seems to think that actual parts of it are just noise and "fix" them. And if it does something weird on one side of the seam, then seam fixer will further propagate it to another side as well.
    Not sure I can fix that - you can try disabling either of denoiser/seamfixer or (better) set Scale In Lightmap on road mesh renderers to a higher value (maybe even set it to 50), so they'll be larger in the atlas.
     
    Last edited: Sep 20, 2018
    CoastKid, ArchVizPRO, Mauri and 5 others like this.
  24. Thee2nd

    Thee2nd

    Joined:
    Aug 18, 2017
    Posts:
    5
    Hi, I'm getting Ftrace error 1 when baking my scene.
    It only happens when I turn on all my area lights.
    tested it with 2 on and a directional light and it worked fine. Ftrace Error.JPG
     
  25. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Hi! It's very hard to diagnose this problem. As with complaints above, I can only debug it if you could provide me an example of the scene (as .unitypackage) where it happens. If you can manage to make the simplest scene possible showing this bug, I'll happily investigate.
     
  26. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    Is it my imagination, or is the dynamic on the Bakery version actually a little better than Enlighten? The surface detail seems a little clearer to me.
     
    guycalledfrank likes this.
  27. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Seems to be the case. Also, for some reason part of the sunlight direction is reversed in Enlighten. I wonder if they give incorrect weights to rays.

    upload_2018-9-20_19-1-50.png
     
    hippocoder likes this.
  28. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Hi. I have many scenes that are not baked with bakery, but when I run those scenes, bakery's ftLightmaps re-imports some of my models and causes my mesh colliders to not work and my player falls through the floor:

    Reimporting to adjust UVs: Assets/custom/blender/houses/bd_1in.blend
    UnityEngine.Debug:Log(Object)
    ftLightmaps:CreateGlobalStorageAsset() (at Assets/Bakery/ftLightmaps.cs:130)
    ftLightmaps:FirstUpdate() (at Assets/Bakery/ftLightmaps.cs:176)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
     
  29. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    I'm not sure how model reimporting affects your colliders though? It's a regular reimport - the same as would happen if you would right click and press Reimport (except I'm also modifying UVs).
     
  30. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    It re-imports my models after I press Play and some how my mesh collider screws up.
     
  31. Thee2nd

    Thee2nd

    Joined:
    Aug 18, 2017
    Posts:
    5
    So i've managed to recreate it again in a new scene when increasing the quality settings.
    This is the error I get in the console

    UnauthorizedAccessException: Access to the path "Assets/Editor/x64/Bakery/shaderSrc/ftrace.cginc" or "C:\Program Files\Unity\2017.3\Editor\Data\Managed\UnityEngine/../../CGIncludes//ftrace.cginc" is denied.
    System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:124)
    ftShaderTweaks.CopyInclude (System.String shadersDir) (at Assets/Editor/x64/Bakery/scripts/ftShaderTweaks.cs:62)
    ftShaderTweaks.OnGUI () (at Assets/Editor/x64/Bakery/scripts/ftShaderTweaks.cs:256)
    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.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:104)
    UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:216)

    any thoughts?
     
  32. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    That definitely shouldn't happen. After the model is reimported, Bakery marks them in ftLocalStorage.asset. If there is a line with this asset's name, it won't reimport. Can you check if it's really there?

    Seems like you are using the Shader Tweaks menu. On some versions/setups of Windows it seems to require Unity being launched with admin privileges. Can you try that? (right click Unity -> run as administrator)
     
  33. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Hi I finally made a project to show you. My shadow mask light settings, with probes, the probes are not correct.
     
    guycalledfrank likes this.
  34. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Sorry you've just included the lightmapper code in your package. Can you delete it please? :) I've downloaded it.
     
  35. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Sorry about that. I deleted the file now.
     
    guycalledfrank likes this.
  36. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    So this is how it looks here. Are they too bright? I didn't rebake, just opened the scene.

    upload_2018-9-20_20-12-2.png
     
  37. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Mine looked like this, notice the 3 probes are same even tho 2 of them are under shadow they are still bright.
    upload_2018-9-20_11-16-27.png

    now if I use full light instead of shadow mask, notice the difference.
    upload_2018-9-20_11-18-27.png
     
    guycalledfrank likes this.
  38. Thee2nd

    Thee2nd

    Joined:
    Aug 18, 2017
    Posts:
    5
    No luck unfortunately.

    Here's a package of my scene
    http://s000.tinyupload.com/?file_id=06811742822867394567
     
    guycalledfrank likes this.
  39. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Perhaps something is different between our Unity versions, but I see what's going on.
    1. You didn't bake with the Occlusion Probes checkbox, and therefore dynamic sun is applied on top of shadowed probes. Try it.
    2. You don't have any Skylight baked in lightmaps, but you have a procedural skybox in the actual scene. One thing which is not exactly obvious about how Bakery renders probes: the actual lightmapper is only used for invisible things like point and directional lights, while area/sky/materials are assumed to be visible in the scene itself, and so I just render a cubemap in Unity instead and convolve it down to a light probe. Therefore light probess *see* the bright skybox above them and the resulting lighting is brighter than lightmapped. Solution: always make sure actual skybox matches skylight (or the lack of it - in this case it should be black).
     
  40. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Thanks, can you please delete it now? As with previous person, you for some reason added my code to the package :)

    Also seems like you forgot the files:

    upload_2018-9-20_20-37-34.png


    Can you send me a proper package through private messages?
     
    Last edited: Sep 20, 2018
  41. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Thanks I think this works! Mainly checking Occlusion Probes fixed it. However, even tho it's done, it's always stuck at 80-100% progress and I can't get rid of this window:
    upload_2018-9-20_11-44-8.png
     
    guycalledfrank likes this.
  42. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Is there any console error (a red one)?
     
  43. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    nope
     
  44. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    That's... really strange then. Does it happen every time consistently, or randomly?
     
  45. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    It is 100% consistent.
     
  46. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    I still think you DO have an error in the console. Maybe you have them disabled?
    Make sure this one is enabled:

    upload_2018-9-20_21-25-48.png
     
  47. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Unfortunately no.
    I also noticed that the light probes seem to only pick up the directional light, it doesn't pick up any bounces, e.g. I have a green floor and the probe directly above it has no hint of green at all. I do have bounce set to 2 bounces, and directional light I have set the indirect multiplier to 3.
     
  48. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    It does. But feels like it's stuck for you after the occlusion probe process and failed to render actual light probes.
    I have no idea why. Does it get stuck on the sample scene you sent to me? (works fine for me)

    Most likely you get stuck waiting for an internal reflection probe to finish rendering. There was a similar problem when "real-time reflection probes" were disabled in Quality Settings, but I fixed it a long ago.
    Maybe the fix doesn't work in occlusion probes mode though... just try enabling them and see if it stops getting stuck.
     
    NestorAlgieri likes this.
  49. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Is there an option where you don't use shadow mask, but full lighting, yet the unity directional real time light is just used for casting shadows?
     
  50. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Well in shadowmask mode, the directional light will only cast shadows from dynamic objects. Or I'm not sure what you mean. What exactly do you like about full lighting that is not present in shadowmask?