Search Unity

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

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

  1. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Cool thanks! I will update the plugin then.
     
    guycalledfrank likes this.
  2. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    873
    https://andi-siess.de/rgb-to-color-temperature/

    From what i can tell the colors seem to line up well with these values. Perhaps it can just assume based on the color value? Better than nothing at all imo.

    Also there is a light color to RGB value...

    Unity - Scripting API: Mathf.CorrelatedColorTemperatureToRGB (unity3d.com)

    Also in other news Bakery seems to not like the URP "Simple lit" shader. which i'm using to optimize some scene assets.

    upload_2020-9-12_11-5-59.png
     
    guycalledfrank likes this.
  3. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Frank, there is a new way to check for the main color and main texture of a material that was added recently:
    https://docs.unity3d.com/ScriptReference/Material-color.html
    https://docs.unity3d.com/ScriptReference/Material-mainTexture.html

    This gets you the main color and texture either by name or by the new property attributes:
    https://docs.unity3d.com/Manual/SL-Properties.html
    (check [MainColor] and [MainTexture] )

    Also, I posted a fix for the preview memory leak on the github issues.
     
    Mark_01 likes this.
  4. GTBrother

    GTBrother

    Joined:
    May 29, 2017
    Posts:
    7
    Any idea for this one? :(
     
  5. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Bakery has to run some C# to apply the lightmaps, because it's the only way (for external lightmaps) since Unity 5: https://support.unity3d.com/hc/en-us/articles/206869046-Using-external-lightmaps-in-Unity-5-0

    Not sure how to avoid it except reimplementing ftLightmaps.cs in LUA :(

    Ohh... OK, that should be easy to add then. Will take a look.

    Who could've thought. Really nice. I'll add a branch to use this property.

    Yup, added :)
     
    atomicjoe and Mark_01 like this.
  6. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    873
    guycalledfrank likes this.
  7. BPR

    BPR

    Joined:
    Jan 4, 2013
    Posts:
    56
    Did some benchmarks now with GT1030 vs my old GTX970:

    Scene had one directional light with 16 samples and one skylight with 64 samples. One non-directional lightmap with 2048px, default settings.
    • GTX 970 (1664 CUDA cores): 40s
    • GT 1030 (384 CUDA cores): 129s
    upload_2020-9-13_20-41-8.png
     
    guycalledfrank likes this.
  8. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    more CUDA cores = more better :D

    Remember kids:
    A newer graphics card is not always faster than an old one.
    You can expect the 70 series to replace the 80 series each generation, but that's all.
    (except with the new 30X0 series, where the 3070 replaces the 2080ti )
     
    guycalledfrank likes this.
  9. AlexTuduran

    AlexTuduran

    Joined:
    Nov 26, 2016
    Posts:
    27
    I am aware of the real-time preview tool, but I remember that during baking the partially baked lightmap would update in scene view (much like the behavior of built-in GPU lightmapper). Perhaps I'm just remembering a different tool.
     
  10. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    No, Bakery never did that.
    The preview plugin is 50% on sale right now by the way. You should get it, it's really worth it.
     
    guycalledfrank, Mark_01 and Crayz like this.
  11. Crayz

    Crayz

    Joined:
    Mar 17, 2014
    Posts:
    193
    Bakery is awesome, all I have to do is click render and the result looks great. Same level of quality you'd expect to be built into a mature game engine.

    One question: I've converted my project to HDRP and the real-time preview is slightly darker, I need to slide Exposure up to max. Is there something I need to adjust for HDRP + RTPreview?
     
    Last edited: Sep 15, 2020
    guycalledfrank likes this.
  12. omnimon3000

    omnimon3000

    Joined:
    Oct 7, 2018
    Posts:
    1
    Help! I have a big scene and ever since I prematurely cancelled a bake it's now giving me these errors "Argument INDEX OUT OF RANGE"
    upload_2020-9-15_21-6-16.png

    I already tried reimporting the whole project and regenerating all uv maps.
    Enlighten finishes using experimental GI.
    Also tried it without the experimental and it still fails to bake. It's definitely on something on the bakery side. HELP! I already tried deleting and reinstalling bakery as well.


    EDIT: OH Fixed it. When I cancelled the render there were these weird _ExportTerrain file that remained where my terrain was located at the hierarchy. It was the thing preventing the baking

    Sorry for taking your time. And thank you for the nice baking system!
     
    Last edited: Sep 15, 2020
    guycalledfrank likes this.
  13. Jakub-Pilar

    Jakub-Pilar

    Joined:
    May 18, 2015
    Posts:
    48
    Yes, with built-in lightmappers it's working perfectly. So maybe some setting in Bakery?
     
  14. Jakub-Pilar

    Jakub-Pilar

    Joined:
    May 18, 2015
    Posts:
    48
    I'm afraid that converting decals to meshes is not possible there (but I asked this on their forum). It's strange that with built-in lightmapper it's working perfectly, but with Bakery it doesn't:-( Thanks anyway for your advices.
     
  15. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Hi, Is this possible to only Bake one part of the scene with Bakery? I want to change my multi-scene game to single scene but the problem is, for a single scene, when I hit Render button, it'll bake all objects at once, taking a lot of time. Is there any possible way to just bake one prefab and save it's lightmaps into separate folder and then follow same steps to bake others. I am using Lightmapped Prefabs. I can use different scenes for baking and then spawn prefab through a script but that's kinda time consuming work so I was looking for a workaround. Thanks.
     
  16. FuzzyPaya

    FuzzyPaya

    Joined:
    Jul 17, 2017
    Posts:
    6
    Hi everyone! I hope someone can shed some light on a strange issue I'm having.

    The problem happens within a Bakery Lightmapped Prefabs, but it might not have anything to do with it as I think I prefabbed the models originally to try and combat this issue.

    When I view Scene A in the editor, lightmaps appear normal. When I build only scene A, the lightmaps appear normal. When I build multiple scenes, then specific models in scene A (from the same .fbx) have scrambled lightmaps. From the scale of the texture, it looks like it might be switching the UV0 and UV1. It could also be that it's referencing the wrong lightmap once it's inside a build. This is happening in multiple scenes and the affected objects are completely unique to each individual scene. In the case of the screenshots, it's the .fbx containing the entire ceiling.
    I have no clue and it's incredibly hard to troubleshoot as everything appears normal in the editor. I've tried rebaking the scene, but I won't know whether the broken object is fixed or if another one broke until I've seen it in a build.
     

    Attached Files:

    Last edited: Sep 17, 2020
  17. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Disable UV adjust on the bakery render options and bake again. Check the manual for info.
     
  18. FuzzyPaya

    FuzzyPaya

    Joined:
    Jul 17, 2017
    Posts:
    6
    Thanks for the reply. I assume you mean the UV adjustments that toggling Asset UV Processing enables. I don't use that as it gave too many problems with our multiple scenes and didn't sync properly with our version control.

    I did rebake one of the scenes last night. It looks the same in the editor, but as far as I can tell all the objects also look correct in the build this time (as I hoped for). I didn't do anything different from last time bake wise, so I don't know why the lightmap was disconnecting in the build. I'm getting in the habit of making my own Lightmap UVs - maybe that helped the affected objects remain correct in the build. Maybe it was just an abnormal occurrence.

    It doesn't ease me though, since if the problem happens again during another bake I won't be able to tell in the editor and won't know until later when I build multiple scenes together. Usually, I can find a forum page of someone having similar issues to me, but not this time so it's likely an isolated case, which means a heap of factors like unity version, graphics driver/card, etc, could all be a factor in my problems. I'd love for it to just be incorrect settings on my part. This particular project is just cursed in general - but it's also the largest project I've been part of using Bakery so that increases the odds of running into problems.
    For now, doing extra rebakes seems to do the trick, but if anyone has a clue please share. I dread ever having to rely on Unity's built-in lighting so I'm gathering my own list of good practices when working with Bakery to avoid as many issues as possible.
     
  19. RegdayNull

    RegdayNull

    Joined:
    Sep 28, 2015
    Posts:
    68
    Can you please implement Unity builtin lightmapper optional behaviour _TransparencyLM as separated alpha for lightmapping. At least basic implementation where white - fully transparent, black - fully opaque. Heavily optimized prepass shaders with separated alpha textures does not work with Bakery well.
     
    Last edited: Sep 18, 2020
    atomicjoe likes this.
  20. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Ok, if it's happening in build only, it's surely related to the Player Setting -> Optimize Mesh Data. Disable it completely and build again.
    I have heard of many weird stories because of this single setting.
    Once you are sure it's because of this, you can try to enable it but disabling the UVs optimization.
    Fingers crossed ;)
     
    guycalledfrank likes this.
  21. FuzzyPaya

    FuzzyPaya

    Joined:
    Jul 17, 2017
    Posts:
    6
    I tried with Optimize Mesh Data disabled and sadly that didn't make a difference. I also have stripping level at disabled so my baked prefabs don't go black.

    I tried re-baking the scenes. Scene A with the ceiling got fixed. Yay for that. For Scene B however, the first time around it didn't fix the issue. At first I attributed it to bad practice (I'd switched a mesh through the mesh renderer context menu instead of properly replacing it). Once i cleaned that up it baked correctly/displayed correctly in the build. I thought it was all fixed.. That is till I saw that the issue had jumped to the meshes of a different .fbx in the scene instead.

    Come Monday I'll see if another rebake sorts it out, and if not I'll replace the affected mesh and rebake again until i find no more problems in my build.
     
  22. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Have you tried completely deleting all Bakery data on all scenes (Bakery - Utilities - Erase Data) and rebaking?
     
  23. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    :)

    RTPreview's own exposure slider is a simple linear multiplier. The resulting image is gamma-corrected, but there is no built-in tonemapping. With HDRP you have some complex postprocessing being enabled by default, including a specific tonemapping algorithm.
    Also if you are using "render in scene view", the image is already clamped/corrected, non-HDR. If you apply Unity's tonemapping on top, it may look darker/brighter. I'm planning to fix this by sending a full HDR image from preview to Unity.

    Ouch! It happens sometimes. Will fix!

    Given I have no idea how these decals are implemented, not sure I can give any good advice. If Decalicious' author is OK with it, you can send me a little test project to debug it.

    Kinda possible, maybe some info here is useful: https://geom.io/bakery/wiki/index.php?title=How_do_I...#How_do_I_lightmap_a_large_world.3F

    My guess would be "optimize mesh data" as atomicjoe said. Also possibly shader stripping: https://geom.io/bakery/wiki/index.p...iated_at_runtime_in_a_build_have_no_lightmaps
    Not sure what else could do it... How do you bake "specific models"? Do you build asset bundles? How do you load them?
    Do all scenes always look good in the editor (so it's not that case when baking scene A breaks scene B in the editor)?

    Huh, I didn't even know it existed. Any problem utilizing _MainTex alpha for the same thing?
     
  24. RegdayNull

    RegdayNull

    Joined:
    Sep 28, 2015
    Posts:
    68
    Yes. I my shaders in _MainTex alpha packed AO, alpha is in separated single channel BC4 texture for performance reasons.
     
    guycalledfrank likes this.
  25. swantonb

    swantonb

    Joined:
    Apr 10, 2018
    Posts:
    172
    Last edited: Sep 21, 2020
  26. FuzzyPaya

    FuzzyPaya

    Joined:
    Jul 17, 2017
    Posts:
    6
    no, and it's not an option. It would take too much time to rebake all the scenes and their components in this project. As soon as the last scene is working in the build, it's being delivered to the client.

    I looked closer at the mesh that was looking weird in the build. It's the only mesh in its lightmap group (to preserve original UV). So far it's been consistent that it's a whole lightmap group that's affected, so I don't think it's necessarily the .fbx itself anymore. That would also explain why the problem jumped to a mesh that wasn't an issue before if it's not connected to the .fbx but the assigning of lightmap through the lightmap group selected.
     
  27. FuzzyPaya

    FuzzyPaya

    Joined:
    Jul 17, 2017
    Posts:
    6
    I've tried with both "optimize mesh data" toggled off and stripping at none. I've also added the Bakery standard shader to always loaded.
    We're not building asset bundles.
    All scenes look good in the editor (it's not the UV adjustments wreaking havoc).

    The lighting is not baked in the main scene. The interior (an apartment) and exterior (a skyrise view of a city) are two lightmapped prefabs with its content sorted into multiple lightmap groups. Each have a dedicated baking scene. The prefabs are then referenced into the final main scene.

    At first, I thought there was something wrong with certain .fbx files, but I'm inclined to believe it's the lightmap group that is getting mixed up in the builds. I have some dedicated lightmap groups for certain props, hence the confusion. It would explain why that when one lightmap group of objects got fixed, the issue jumped to a different lightmap group.

    Everything looks just fine in the editor. It also looks fine when I only build the troubled scene. But if I build the entire project with all its scenes, then the troubled scene has its objects from one lightmap group referncing the wrong lightmap, or its lightmap UV is scrambled.
     
  28. marenin

    marenin

    Joined:
    Sep 22, 2019
    Posts:
    10
    Bakery is awesome!

    I got minor issues with skylight rotation.. sry)
    When i use cubemap in background, reflection probes .. etc, i got 0° cubemap rotation. But when i use same cubemap with skylight it gives 180° cubemap rotation by default. Not a big deal, but would be cool to synchronise.
    Of course these ruin setup for some users, but maybe it can be done when "correct rotation" cheker is on?
     
    Last edited: Sep 21, 2020
    guycalledfrank likes this.
  29. kanestudio

    kanestudio

    Joined:
    Jan 29, 2018
    Posts:
    7
    Hello! I have a directional light to lightup the whole scene, and a few spot light to lightup the interior. The result is Outdoor scene is okay, but the indoor scene have some bad error as the picture shows. How i fix?
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      75.5 KB
      Views:
      391
    • 2.jpg
      2.jpg
      File size:
      141.1 KB
      Views:
      389
    • 3.jpg
      3.jpg
      File size:
      44.9 KB
      Views:
      385
    • 4.jpg
      4.jpg
      File size:
      53.3 KB
      Views:
      378
    • 5.jpg
      5.jpg
      File size:
      62.5 KB
      Views:
      386
  30. FuzzyPaya

    FuzzyPaya

    Joined:
    Jul 17, 2017
    Posts:
    6
    You need more global illumination samples when baking interior spaces. Try 30 instead of 16.
     
  31. swantonb

    swantonb

    Joined:
    Apr 10, 2018
    Posts:
    172
    I think i got an answer to this, using shadowmask works very good in URP because of Bakery but been searching the google upside down for the next problem that i encounter now is that i cant get additional lights in my scene to cast shadows, not even spotlights which i read that should in URP. Am i doing something wrong? Anybody else could get shadows in URP for spotlights on dynamic objects?
     
  32. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    I’m a bit confused now. Was using Substractive because Shadowmask is not supported by URP. Are you saying Bakery’s doing something special so Shadowmask’s working under URP ?
     
    Last edited: Sep 23, 2020
    guycalledfrank likes this.
  33. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Sometimes I have a strange issue with baking.
    Look at the right chair which looks very different than the left one.
    Important is, that we have one mesh here that contains both chairs:
    In 3dsmax I started with the left chair (original), doublicated the polys, moved them to the right and rotated them 180 degrees. I do so because of reducing objectcount (if this improves performance is another story).

    The same is for the stand of the table.

    That "damaged" geometry also produced black spots on the floor.

    I´m pretty sure that this is not a Bakery-issue, because the right chair looks a bit darker even before baking.

    In 3dsmax I have insured that the normals are all fine.

    upload_2020-9-23_8-5-13.png

    Any idea?
     
  34. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Yes: Don't use 3dsmax normals. Force rebuild normals and tangents on the model's import tab inside Unity.
     
  35. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    You mean "Normals" > "Calculate" ?
    upload_2020-9-23_11-47-57.png

    Don´t find "Force rebuild normals and tangents"... using Unity 2019.3.8
     
  36. swantonb

    swantonb

    Joined:
    Apr 10, 2018
    Posts:
    172
    yup XD i was surprised too. Not sure what happens exactly but my shadowmasked baked sun places a extra shadow inside all buildings and the shadow of the player blends with it when u get in. But now i seem to not be able to get additional lights provide me shadows. Are u able to get shadows from additional lights on dynamic objects in substractive? i tried all ways not only shadowmask, i might be doing something wrong. I mean i get shadows on the player but the player doesnt cast shadows on the floor
     
    Last edited: Sep 23, 2020
    f1chris likes this.
  37. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Yes. Try both with Calculate and Import and check if it makes any difference.
     
    Cascho01 likes this.
  38. Xephyleph

    Xephyleph

    Joined:
    Sep 19, 2020
    Posts:
    1
    I'm having a bit of trouble with the Lightmapped Prefabs.

    The original building looks great once it's rendered, but when I add the prefab into a scene, it looks like this:
     

    Attached Files:

  39. tranvanhoa1296

    tranvanhoa1296

    Joined:
    Nov 21, 2019
    Posts:
    1
    Why does the large model with a Bakery GPU lightmapper on unity 2019.3.0f6 produce black light like this, and the whole model when baked is black?

    But after I turned off one model, when using the bakery to bake it again, the light after bake in model was no longer black?


    This is the configuration of Bakery Gpu Lightmapper on unity, and graphics card parameters of my computer.


    Can you point out the cause for me to fix this baking bug on Bakery Gpu Lightmapper!
    Thank you!
     

    Attached Files:

  40. ArnoldCarterWong

    ArnoldCarterWong

    Joined:
    Sep 26, 2017
    Posts:
    31
    is there any chance to have it work in dx12?
     
  41. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    What do you mean? Bakery has nothing to do with DirectX. The generated lightmaps will work wherever Unity works: DX11/12, Vulkan, GLES...
     
  42. ArnoldCarterWong

    ArnoldCarterWong

    Joined:
    Sep 26, 2017
    Posts:
    31
    the rendering won't start in dx12 with hdrp and instantly crash
     
  43. aloneandsuffering101

    aloneandsuffering101

    Joined:
    Apr 21, 2018
    Posts:
    15
    Getting error on version 1.71 using Unity 2019.4.10f1 - Denoiser Error: Unknown error (1)

    Checked denoiserlog.txt and it says:
    "2020-9-27
    Init...
    Error (1537): A supported NVIDIA GPU could not be found"

    I am using GTX 770 with the latest drivers, any ideas?


    EDIT: I was able to finish rendering with no issue by using "legacy denoiser"
     

    Attached Files:

    Last edited: Sep 28, 2020
  44. CmartinezSaltoki

    CmartinezSaltoki

    Joined:
    May 21, 2020
    Posts:
    10
    Hi everyone!

    My team and I are thinking about buying Bakery and we read it was tested on every version from Unity 5.6 to 2019.3.4 but we're wondering if it works correctly on 2020.1.3f1. Did anyone test it on this version? Did you bump into any major issue?

    Many thanks in advance!
     
  45. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    OK, added. Try latest github version. New logic is:
    * If "_TransparencyLM" is present in the material and set to a non-null texture
    * Its red channel is used instead of main texture's alpha
    Everything else (cutoff value, RenderType check) works the same.

    Do you want to exclude interiors from being lit by a mixed light? You can
    - Use the culling mask on the light
    - Put some "shadow only" blocker objects inside windows

    You are not using the latest patched version, it's different now (even at the time of your post).

    Lightmap groups don't have runtime logic on their own - they are only used to instruct the lightmapper to bake them in a certain way. Baked lightmap data is stored identically for grouped and non-grouped objects, inside an invisible "!ftraceLightmaps" object. If you have a Lightmapped Prefab, the same data will be stored on a visible BakeryPrefabLightmapData object.
    Maybe it's something about nested prefabs? They weren't thoroughly tested and they make everything complicated.

    Yes, 180 degrees flip is a bug from older times, "correct rotation" checkbox should do the trick.

    This noise looks too annoying to be simply a lack of GI samples. Check if:
    - Interior wall normals are adequate (not smoothed out). You can check if enabling "calculate normals" on the asset makes any difference.
    - Wall UVs are also adequate. Are you using "generate lightmap UVs"?
    - Any small, bright, emissive object? Does this lamp emit light itself (why do you use a spotlight then?). Check if using non-emissive material solves the problem. Unity also supports separating baked/realtime emission, at least in the standard shader.

    No :D

    Sounds like broken normals?

    I use 3dsmax normals all the time, but I recommend Reset XForming any geometry before exporting.
    In fact I have my own dumb "reset xform 2.0" script I run on everything (it doesn't flip faces unlike the built-in):

    for obj in selection do
    (
    s = obj.name
    b = box()
    b.pos = obj.pos
    b = convertToPoly b
    b.attach obj b
    b.name = s
    polyOp.deleteFaces b #(1,2,3,4,5,6)
    )


    AFAIK, subtractive only works with one "main directional light".

    Can you show me your lightmapped prefab component in the original baking scene? Are there any warnings written on it?

    No UVs? (see bold): https://geom.io/bakery/wiki/index.php?title=Manual#Quickstart
    No Bakery light components?

    There is, but it's complicated. I'll patch it eventually if more people start using it. Also I'm still on Win7... ouch :D

    Bakery uses DX11 API to exchange texture data during the scene export, so currently editor must be in DX11 mode.

    Hmmm, quite surprising, I'd expect it to work. Are you sure these were the latest drivers? Good to know legacy one is still working.

    Currently tested on 2020.1.2, but not 1.3 yet. I doubt there is any serious problem and I'll have to fix it ASAP if there's any.
     
  46. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Oh, so that's why...
     
  47. RegdayNull

    RegdayNull

    Joined:
    Sep 28, 2015
    Posts:
    68
    Many thanks! Will check it a bit later.
     
    guycalledfrank likes this.
  48. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    upload_2020-9-29_14-27-50.png

    The column of the table gets illuminated by the sun and the lamp above, but how can this shadow be?
     
  49. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    How do you expect it to look? How does it look with realtime lights? You have lamp lighting being shadowed by the table, but sun lighting still visible at the spot, thus illuminating the area. Probably something like this:

    upload_2020-9-29_17-9-50.png

    Shadow penumbra (shadow spread) is also playing a role here, as shadows become blurrier with distance.
     
  50. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    You´re right, it´s just looking unreal here - sorry!