Search Unity

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

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

  1. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    @guycalledfrank UVs are auto-generated by Unity using their default settings. Maybe I'll try doing a custom unwrap as well just to see.

    Here's what the wireframe of the facade looks like:



    The arch and doorway are submesh items floating in front.
     
  2. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    With that ftrace error above, I had terrain optimization disabled. Now I enabled it (and Force On for VRAM), and now when I choose a building and do Render Select, it works! -- except that the terrain doesn't get any shadows baked. Terrain is set to Lightmap Static...anything else I should check?
     
  3. Raistmere

    Raistmere

    Joined:
    Oct 12, 2016
    Posts:
    5
    @guycalledfrank Hello, here is the mesh you requested. Let me know if you need anything else.

    I also found something out when turning on the checker preview, it seems like the stretchmarks are offset somehow and might be creating the weird lines. I thought maybe it was due to the edges but then I have other parts of the mesh that are complex and don't have any issues. It seems to be a specific areas that cause it not the whole mesh.

    Thank you for you time and I appreciate the help :)
     

    Attached Files:

    guycalledfrank likes this.
  4. Artificial_Illusions

    Artificial_Illusions

    Joined:
    Jul 24, 2018
    Posts:
    20
    @guycalledfrank For some reason the issue remains the same. Also, every time I restart Unity and open the project, the scene is opened without the lights baked in, no matter how many times I save after light baking, I attached the screenshot. Maybe the reflections have something with this issue?

    upload_2019-3-15_13-47-23.png
     
  5. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Looking forward for remote baking! And you are right, somehow __ExportTerrain is the problem, I fixed it, thanks.
     
  6. ashab1

    ashab1

    Joined:
    Oct 24, 2015
    Posts:
    3
    Some of my lightmapped gameObjects flicker when I build my project, but look great in the Unity Editor. These gameObjects flicker on Windows and iOS devices. If someone would help me I would really appreciate it.


    When I set the flickering gameObjects to static they stop flickering, but my batches increase, which is not acceptable because my project is for mobile devices. This problem is making me pull my hair out...

     
  7. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    Frank I see your reply to luellasfpg about grouping LOD lightmaps and adding support for it. If at all possible could you also consider Amplify Impostors used as a LOD level when you get into that. I could send you a test build in DM with this already set up if you like? still fiddling with the amplify Imposter generator settings but I'm finding their default settings most of the time give black light maps when baked and I needed to increase the vertices to get Bakery to register and generate a usable map not black. Note it looks like the Amplify DEV is also struggling with how to support light map grouping of LODs
     
  8. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    No, not the edged faces wireframe, but the actual unshaded wireframe. My suspicion was that there is some geometry on the other side of the wall, but very close to it.

    On previous attempts (when you had the error), did you also use Render Selected or was it full Render? Render Selected may have problems with terrains.

    Thanks! So the stretchmarks are actual polygons:

    upload_2019-3-16_13-58-7.png


    That's problem #1. Having super-thin and long triangles doesn't play well with many algorithms. Perhaps there are some export options in Magica Voxel to clean up the output a bit.

    upload_2019-3-16_14-0-24.png


    Problem #2: Unity UV unwrapper. The tiny stretched polygon confused it so much, it just collapsed it into a zero-area point. Perhaps you can generate the UVs somewhere else, if you can't clean up the mesh.

    That shouldn't really happen. Does it happen on example scenes as well? Maybe some of your scene files are marked as read-only or something.

    You can already grab a beta from github! :)

    I guess the sun is realtime? That looks very much like shadowmap flickering, not the lightmaps. Does anything flicker if you disable the sun?

    You either need to generate a unique impostor for every differently lit instance or use light probes for them. There is no silver bullet. What is your use case? Does each impostor represent a unique area of the scene, or are they cloned instances?
     
  9. Raistmere

    Raistmere

    Joined:
    Oct 12, 2016
    Posts:
    5
    @guycalledfrank Thanks for the help! Going to figure out what program I am going to use now.
     
    guycalledfrank likes this.
  10. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    @guycalledfrank Like wireframe only?

     
  11. ashab1

    ashab1

    Joined:
    Oct 24, 2015
    Posts:
    3
    Yes, the flickering continues when I disable the sun. Here's a video that shows what happens when I render a lightmap and then disable the sun. Thank you for your quick response!
     
  12. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    OK, can't see anything weird. Can you send this wall to me for debugging as well?

    It looks like you still have the sunlight on (do you have separate lights for road/surroundings?), and the shadows are quite sharp, are they really lightmapped? Kinda looks similar to z-fighting, like if you had 2 buildings with different shaders in one place.
    If you can send me a small Windows DX11 build, I can take a look at it with RenderDoc, maybe it will shed some light.
     
  13. ashab1

    ashab1

    Joined:
    Oct 24, 2015
    Posts:
    3
    Update: I've found out that certain assets are flicking because I created my own texture atlas. I'm guessing that the reduced resolution of the combined textures is what's causing the assets to flicker. However, this is strange to me because all of the assets seen in my videos are all part of the same texture atlas. Whatever the reason, it doesn't appear to a Bakery problem. Thank you for your time!
     
    guycalledfrank likes this.
  14. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    You either need to generate a unique impostor for every differently lit instance or use light probes for them. There is no silver bullet. What is your use case? Does each impostor represent a unique area of the scene, or are they cloned instances?[/QUOTE]

    for this case I am trying imposters as LOD1 for tree models that I hope to use in Gaia, using probes works and maintains the color Hue blend sufficient for distance as importers is intended however its still in Beta and have a few other hurdles get thru. my attempts to bake imposter terrain has been mixed with some models ok and others giving blackout. it would be interesting if we could figure out why.. in your opinion is it worth chasing that rabbit down that hole in regards to gaining performance, is it better to have in probes or light mapped? the target platform is VR
     
  15. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    @guycalledfrank I've attached the building good sir.
     

    Attached Files:

  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Thanks! Seems to be caused by very odd normals. Original model doesn't have proper normals:

    upload_2019-3-18_11-29-15.png

    So I guess you used Unity's auto-generation for normals with the default angle value of 60, but that gave you that artifact:

    upload_2019-3-18_11-29-33.png

    The auto-generated normals are incorrect. For example, they smoothed two walls together:

    upload_2019-3-18_11-31-30.png

    Green are proper normals (separate for each wall), red is what you get with auto-generation, because the angle between two walls is <= 60 degrees. Resulting shading differs too much from the actual geometry, therefore producing artifacts.

    If you try setting the angle to 0 degrees, the problem goes away:

    upload_2019-3-18_11-33-24.png

    In general, I recommend to properly setup normals in your modeling package before importing and don't rely on auto-generation.
     
    xinuxano likes this.
  17. AAK_Lebanon

    AAK_Lebanon

    Joined:
    May 30, 2015
    Posts:
    77
    I am new to this stuff, I just tried Bakery by rendering a scene on my friend's powerful PC, and I copied the lightmaps from his PC to my project, but in my laptop, I can't see the lightmaps applied to the scene ! how I can do that!
     
  18. rolando75

    rolando75

    Joined:
    Oct 30, 2017
    Posts:
    3
    I always get really bad reflections like that, with or without Bakery.
     
  19. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    The easiest way it to just copy the whole project. Alternatively, export only some files as a .unitypackage and import to your laptop. Apart from lightmaps you will need:
    - Scene file
    - Model *.meta files
    - Bakery scripts (or at least the 5 required ones listed in FAQ).
     
  20. psych77

    psych77

    Joined:
    Mar 1, 2017
    Posts:
    55
    My scenes looks strange on build...

    Cannot figure out why this happens. In Editor it looks fine..

    upload_2019-3-18_17-30-37.png
     
    Last edited: Mar 18, 2019
  21. psych77

    psych77

    Joined:
    Mar 1, 2017
    Posts:
    55
  22. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    Awesome! Thanks @guycalledfrank!

    I'll have to investigate as to what might be happening from MODO to Unity, as I had configured smoothing within it.
     
    guycalledfrank likes this.
  23. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Try disabling texture streaming in player settings. I had a similar report that turned out to be caused by a bug in streaming implementation.
     
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    In case you thought the new experimental L1 probes are completely unusable... an important fix just landed on github. Colors should be now correct (for the precision they offer).
     
  25. elamhut

    elamhut

    Joined:
    Sep 13, 2013
    Posts:
    45
    I'll do this test once the GDC crazyness is over, I had to shift priorities to finish a build :/

    Also I'm getting some errors while lightmapping. Sometimes the lightmapper also doesn't start I think is due to out-of-space in the drive, are there any stuff in place to prevent the lightmapper from starting due to unavailable space in the drive? If so it's not giving me a warning and it's not closing Bakery by itself.

    Here are some strange errors I'm getting when trying to bake a scene:


    upload_2019-3-19_13-7-20.png
     
  26. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    Frank is the Bakery Clear Useless Data / debug Script still ok with the latest version?

    also during bakery shader tweaks I get this , not certain if they are actually applied
    Unity 2017.4.15f1 LTS
    Code (CSharp):
    1.  
    2. UnauthorizedAccessException: Access to the path "C:\Program Files\Unity\Editor\Data\CGIncludes\UnityGlobalIllumination.cginc" is denied.
    3. System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:320)
    4. System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
    5. (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    6. System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
    7. System.IO.StreamWriter..ctor (System.String path, Boolean append)
    8. (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool)
    9. ftShaderTweaks.RevertFile (System.String fname) (at Assets/Editor/x64/Bakery/scripts/ftShaderTweaks.cs:94)
    10. ftShaderTweaks.OnGUI () (at Assets/Editor/x64/Bakery/scripts/ftShaderTweaks.cs:412)
    11. 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)
    12. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    13. 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)
    14. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    15. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    16. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    17. UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:107)
    18. UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt) (at C:/buildslave/unity/build/Runtime/UIElements/Managed/IMGUIContainer.cs:183)
     
    Last edited: Mar 20, 2019
  27. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    The NullRef one is strange. Did you have any shadowmasked lights that you later deleted? The error seems to be thrown during scene opening, not baking.
    PPtr-bla-bla error: caused by Unity rendering reflection probes (sometimes even when pressing the built-in button), not my bug, seems to be safe anyway.
    Everything else: doesn't seem to be caused by Bakery.

    Should work fine. Also the useless data clearing is now automatic (since v1.55), so you don't need this option anymore.

    Seems like you need to launch Unity editor as admin. I'm not sure exactly why it's required on some machines, but not all. I should add a writeability check there...
     
    DEEnvironment likes this.
  28. smous

    smous

    Joined:
    Jun 7, 2016
    Posts:
    5
    Hello Franck. First, thank you for the Lightmapper! It's awesome! :D

    Second, i ran into a problem today.
    We have a scene that is quite heavy and we need a lightmap with rather small resolution (5-6 texel)
    There is a Directionnal Light, a skylight and about 200 point light (It's a big building, and each room need some light)

    Everything works fine at export/setup but when he start to bake the light, it crashes at a pointlight (not sure if the same each time, only tried 3 bakes).

    I have this CUDA error coming up

    I searched on the thread, only saw up to date drivers and reducing sample/ disable skylight but didnt work

    Thanks for your time!
     

    Attached Files:

    Last edited: Mar 20, 2019
    guycalledfrank likes this.
  29. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Do you have any terrains? How many shadow samples are used on this light?
     
  30. smous

    smous

    Joined:
    Jun 7, 2016
    Posts:
    5
    8 samples, and we dont use Unity Terrains. Thanks for the quick answer!
     
  31. smous

    smous

    Joined:
    Jun 7, 2016
    Posts:
    5
    Just tried to bake with just the directionnal and skylight but got the same error
     
  32. alex_93v

    alex_93v

    Joined:
    May 22, 2014
    Posts:
    2
    Hi I've been using your incredible lightmapper for quite some time, so first of all thank you for your efforts!

    I have a simple question, can I get access to the "remote bake beta" repo?
     
    guycalledfrank likes this.
  33. RobOuellette

    RobOuellette

    Joined:
    Jun 5, 2018
    Posts:
    10
    Hey Frank,

    We're running into an issue with a bake that we've been trying to solve for the past few days to no avail. This is the rundown:
    --
    This is the scene pre-bake with Unity lights showing most of the lights being used (sans the lamps in the plaza + the lit sign -- they're using the light mesh):



    Now this is the post-bake with all the Unity lights off showing just what should be baked:

    [EDIT: The lights in the back + on the watchtower were accidentally left on and are real-time ^^^]

    It outputs LMs like these (void of any of the warm lights, etc) alongside smaller ones that I believe are for LODs:


    These are the general settings I'm using in those stills (light settings change per light obviously):
    https://www.yourcomputersucks.co/lab/public/Bakery-Settings.jpg

    These are the objects getting baked (plus the terrain): https://www.yourcomputersucks.co/lab/public/UVChecker.jpg

    All assets are using the Bakery shader (our end goal is to use SH, but we're doing test bakes without), we're baking mostly direct into the indirect [one light is using shadowmask], we have ~80 lights that are mostly point lights, and a HDRI skylight.

    We've tried:
    • Dropping and raising the texels per unit
    • Dropping and raising the tile size
    • Toggling AO off and on
    • Forcing GI VRAM optimization on
    • Ramping the intensity on every light + light mesh
    • Transforming the skybox HDRI into LDR + blurring for bake
    • Removing the Skylight from the bake entirely
    • Crying
    • Baked using Unity's Enlighten out of desperation (to see if it was something we were mega F***ing up -- but it worked alright)
    • Deactivated all lights besides the light meshes + key direct [moon] light -- This was the first/only bake where we saw some lights being baked properly (albeit a bit dark relative to Unity's Enlighten)
    Sorry for the mouthful - trying to debug as succinctly as possible (to avoid overloading the thread with Q&A back and forth)! Any ideas on where things are going wrong?

    Thanks! P.S. Bakery is amazing -- thanks for the raw nerd energy + hours you put into this


     
    guycalledfrank likes this.
  34. theorchestrator

    theorchestrator

    Joined:
    Aug 9, 2013
    Posts:
    8
    Damn, you're plugin seems to be pretty good when even activision uses it for COD Mobile ;) Congrats! Unbenannt.PNG
     
    b4th, Gametyme, Adam-Bailey and 5 others like this.
  35. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    I can't tell exactly why it happens, but my guess would be there is either something weird with scene geometry, or it's just very complex. What is your GPU?
    Can you try disabling TDR?

    Sure! Just PM me your github username + invoice number.

    Can you check if it works without any GI? There was one weird similar case, where it was caused by some lights having very high intensity and indirect intensity.
    Also does it work if you replace most of the scene with e.g. just the terrain and a couple of boxes?
    If it still doesn't work, can you send me this (simplified) scene for debugging?

    Noice!
     
  36. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    @guycalledfrank
    Hi, I just noticed something weird with Bakery's lightmaps on Android builds:
    When I render them and Bakery finishes, they look fine, but once I recompile any script, the lightmaps change their gamma and lighten up on dark zones:

    Look at the image in full screen.
    On the left it's how the lightmaps look once render finishes. On the right is how they lighten up once I recompile any script.
    It doesn't seem like much, but it's actually making color banding and texture compression artifacts visible on zones that shouldn't be visible.
     
  37. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Weird... are you sure the shader is not doing anything extra (additional ambient, skybox environment probe, etc)? I can't think of any reason why it can happen.
     
  38. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    No, nothing extra. It's the regular Standard shader.
    Anyway, if it was because of the shader or post effects, it would be like that all the time. It wouldn't change after compiling a script!
     
  39. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Maybe Bakery is reassigning the lightmaps after recompiling scripts?
     
  40. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Definitely not. I wonder if this little constant changes:

    upload_2019-3-20_23-0-9.png

    Can you check it (and possibly other values) in Frame Debugger before/after script recompilation?
     
  41. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I'm making a repro project but it seems a much bigger bug than just some gamma changes, it's happening both in PC and Android builds and it's present happening in Editor and in the final build too! o_O
    It's related to directional lightmaps (dominant). I'll tell you more on private message.
     
    guycalledfrank likes this.
  42. andrewc

    andrewc

    Joined:
    Aug 20, 2008
    Posts:
    180
    Not sure if someone answered you but I had that problem. It was because the total textures in build can't be over 4gb. I used Build Report tool from the Asset store to monitor total textures used for build. I had to get it a little under 4gb to get rid of this problem.
     
    atomicjoe and guycalledfrank like this.
  43. greengremline

    greengremline

    Joined:
    Sep 16, 2015
    Posts:
    183
    @guycalledfrank This sounds like the bug we were experiencing as well
    Whenever a recompile happens (such as exiting and reopening the editor), much brighter & incorrect lightmaps! We're using directional as well for a lot of ours. We had to downgrade to an older version to fix temporarily
     
  44. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    You downgraded Bakery or Unity?
    To which version please?
     
  45. greengremline

    greengremline

    Joined:
    Sep 16, 2015
    Posts:
    183
    I believe 1.45, but we also added a few custom things that were then rolled into 1.55 so I can't say if it will also work for you - it did fix the error for us
     
    atomicjoe likes this.
  46. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    Seems like you need to launch Unity editor as admin. I'm not sure exactly why it's required on some machines, but not all. I should add a writeability check there...[/QUOTE]

    Thanks I will give it a try , this is working thru Unity HUD
    so I need to play around with it bit perhaps
     
  47. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Is your project for Android or iPhone?
     
  48. elamhut

    elamhut

    Joined:
    Sep 13, 2013
    Posts:
    45
    Probably, we decided not to use shadowmasks because we were generating 1,2gb lightmaps per scene and it was becoming crazy. So we changed from Shadowmasks to Indirect but left many lights as shadowmasks and we probably deleted one or two shadowmask lights in the process? Can't guarantee 100%
     
    guycalledfrank likes this.
  49. smous

    smous

    Joined:
    Jun 7, 2016
    Posts:
    5
    Hi! I'll try that, but just to tell you, my friend tried to bake on his computer and had no problem.
    We both have a 1080
     
  50. smous

    smous

    Joined:
    Jun 7, 2016
    Posts:
    5
    Another thing! I spotted that sometimes when i start a bake, during the mesh preparation, it stops at 55% and goes on and on infinitely. I then have to shut unity down for me to access it again. And when i launch unity back, often the lightmaps are completly wrong and have to be rebaked.