Search Unity

  1. 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,658
    Looks like you have more vertices than the maximum integer value, which is currently a problem in many parts of the pipeline. How many vertices are in the scene?
    You can try using Sectors, perhaps? https://geom.io/bakery/wiki/index.php?title=Partial_scene_baking

    Thanks, tested. Looks like it's caused by instancing. The breads are automatically instanced by the engine, and the probe data is therefore passed differently. Found that I didn't update my shader to some newer changes in instancing macros... fixed it! Please try updating. I'm also attaching the corrected cginc to the post.

    Hmmm... are these skinned meshes by any chance? Unity skips their unwrapping silently. If not, weird, never encountered that (I'm developing my game in 2019.3, so I use it a lot). Can you send me some models like that for testing?
     

    Attached Files:

  2. cfantauzzo

    cfantauzzo

    Joined:
    Apr 8, 2012
    Posts:
    75
    Hi! Bakery's awesome and I love the directional lightmap options. However, in URP, I can't get reflection probes/reflections in general working with any of the provided shader graph directional shaders (trying to use BakeryURPMonoSHSpecGraph specifically). Reflection probes just don't show up on my objects using the shader. Any solutions?

    Thanks
     
    guycalledfrank likes this.
  3. cfantauzzo

    cfantauzzo

    Joined:
    Apr 8, 2012
    Posts:
    75
    Huh, so instead of using the example shaders, I made a new shader in shader graph and ported over some of the nodes from the example shaders, and now I'm getting reflections + all the monoSH goodness. I guess that problem is solved, though I don't know why this is the case. Are reflection probes disabled in the example shaders? Shrug.
     
    guycalledfrank likes this.
  4. Glenarvan

    Glenarvan

    Joined:
    Sep 24, 2021
    Posts:
    1
    Set Ambient Occlusion to 1
     
  5. MiragentStudios

    MiragentStudios

    Joined:
    Jun 14, 2022
    Posts:
    2
    I'm hoping someone here can help me. I've got an irritating problem with Bakery. I'd say about 60-70% of my baking attempts turn out to be total duds. When I bake my lighting it all either turns out black, blue, or green. About 30% of the time it might actually bake my lighting. When I bake lighting I will usually have to re-bake it 3-5 times before I get a proper bake. I've tried deleting the bakery lightmaps and clearing baked data in the bakery utilities. That basically does nothing to fix the problem.

    Here are my Bakery settings. Any help would be appreciated:
    upload_2023-9-29_10-56-4.png
     
  6. riznof

    riznof

    Joined:
    Feb 25, 2013
    Posts:
    2
    Hi! My team has been using Bakery, with URP and the shadergraphs you've released. But we do have an existing game that's on the builtin pipeline and would like to start using MonoSH with that game. However, we don't have tech artists to help us out with shader modifications and were hoping to use Shadergraph with MonoSH on builtin.

    Is there any way we could get this to work?
     
  7. riznof

    riznof

    Joined:
    Feb 25, 2013
    Posts:
    2
    We also have amplify shader if anyone has a solution for that.
     
  8. NoxityGames

    NoxityGames

    Joined:
    Jul 1, 2018
    Posts:
    33
    1. Thank you very much for the instructions!
    2. Regarding ShaderGraph in built-in - yes there is! Mainly for non-technical people or TAs to create shaders, or just simply for faster development. It's genuinely quite awesome, only downside is build times.
     
    guycalledfrank and riznof like this.
  9. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    73
    @guycalledfrank Hi, I have some weird behavior when using baked prefabs in combination with scenes loaded from assetbundles.

    If I bake the prefab with baked normals settings, the included storage looks like this.

    prefab-broken.png


    If i load this prefab into the scene, the scene becomes black like it lost all lightmaps.

    But after searching for a working prefab in our repo I found the solution by changing the dir maps array to a length of 1. Then when loading the prefab, the scene keeps its lightmaps.

    prefab-working.png


    One other issue when loading a lightmapped scene from a bundle, if the scene is not active while it gets loaded, the lightmaps appear twice in the lighting dialog. Don't know if this is an issue.

    lightmaps-twice.png

    UPDATE:
    Looks like I have to put the "emptyDirection" texture into that slot to make it work properly
     
    Last edited: Oct 2, 2023
    guycalledfrank likes this.
  10. ChrisBudden

    ChrisBudden

    Joined:
    Jan 20, 2014
    Posts:
    5
    Unfortunately it's not any specific mesh and it's not reproducible. On one dev's machine nearly an entire scene's worth of meshes will fail to unwrap lightmaps, and on another it's 100% fine. If we take a bunch of meshes that were having issues into a new scene, they sometimes work just perfectly

    I'm definitely thinking this is some horrible Unity issue not a bakery one, but I appreciate the help. Might be our project or scenes are set up weird (They've been around for years and through many versions of Unity at this point)
     
    guycalledfrank likes this.
  11. WhiteAnvilStudio

    WhiteAnvilStudio

    Joined:
    Jan 31, 2019
    Posts:
    2
    @guycalledfrank Hello, maybe you can help me with my problem. I baking lights with SH option. And only in android build (APK), when you switching to another scene by scene load - I get corrupted SH info in materials. Looks like loaded SH info from previous scene. In Editor or if dont load other scene - everything looks good.
    Unity 2022.3.5f1 Android
    Two seperate scenes with different models and other data.
    Every settings looks ok.
    upload_2023-10-2_20-26-56.png
    upload_2023-10-2_20-26-43.png
     
  12. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    83
    hi!, Does bakery has something like unity Lightmapping.BakeMultipleScenes function? https://docs.unity3d.com/ScriptReference/Lightmapping.BakeMultipleScenes.html , supposedly unity split the data per scenes after load all scenes, this way they are able to bake lighting and casting shadows on adjacent scenes.

    I was trying to bake lighting with bakery and when two scenes are on editor they bake the lighting correctly but scenes has duplicated data from each scene.
     
    Last edited: Oct 3, 2023
  13. ChrisBudden

    ChrisBudden

    Joined:
    Jan 20, 2014
    Posts:
    5
    Ok @guycalledfrank some info for you after some more digging on my end!

    Under ftModelPostProcessor.cs, OnPostprocessModel(), Unwrap() you call unity's Unwrapper here:
    Code (CSharp):
    1. var tt = GetTime();
    2.             Unwrapping.GenerateSecondaryUVSet(m, uparams);
    3.             if (m.uv2 == null || m.uv2.Length == 0)
    4.             {
    5.                 Debug.LogError("Unity failed to unwrap mesh. Options: a) Use 32-bit indices and Unity >= 2018.4. b) Split it into multiple chunks. c) Disable 'Adjust UV Padding'.");
    6.                 unwrapError = true;
    7.                 lastUnwrapErrorAsset = assetPath;
    8.             }
    9.             Debug.Log("Unity unwrap time: " + (GetTime() - tt));
    However, I'm definitely seeing meshes that have no UV2's, and no error message comes up, which is an issue in itself. For example, this is one mesh in an FBX model:

    upload_2023-10-4_13-57-55.png

    However this doesn't answer the question of why this is happening. What I didn't realize is that through Bakery, all the unwrap params are set to some incredibly small values in the code here for every mesh with an auto-generated lightmap

    Code (CSharp):
    1. uparams = new UnwrapParam();
    2.             UnwrapParam.SetDefaults(out uparams);
    3.             uparams.angleError = importer.secondaryUVAngleDistortion * 0.01f;
    4.             uparams.areaError = importer.secondaryUVAreaDistortion * 0.01f;
    5.             uparams.hardAngle = importer.secondaryUVHardAngle;
    Many of our models simply fail to unwrap with these parameters, and I'll be honest I don't know enough about atlasing to know why they are so small. I imagine simply changing those values is going to cause The Problems... any pointers on where to go from here?

    (I'll add that we have a disturbing number of meshes packed into a single FBX all over this project. Not my choice)

    UPDATE: Actually it may not be the parameters at all. After un-commenting this log, it turns out the meshes I'm looking at are simply not having an unwrap attempted on them! Turns out this code here may in fact not be fine!

    Code (CSharp):
    1. // Get padding from asset
    2. int mindex = saved.data.meshName.IndexOf(nm);
    3. if (mindex < 0)
    4. {
    5.     Debug.LogError("Unable to find padding value for mesh " + nm);
    6.     // This is fine. Apparently caused by parts of models being lightmapped,
    7.     // while other parts are not baked, yet still a part of the model.
    8. }
    Perhaps defining a hard-coded fallback padding value will solve our issues? It seems to be identical for all our meshes in this FBX. Or would that potentially break some kind of atlas packing calculation down the road?

    Also, any meshes with 0 verts in will break the unwrapping post-process for the entire FBX as Unwrapping.GenerateSecondaryUVSet throws an exception. Why would there be an empty mesh in such a collection? Not a question for me to answer =3

    UPDATE #2:
    Unfortunately I have to report that it seems that our lightmap UVs issue has been most easily fixed by simply commenting out OnPreprocessModel() and OnPostprocessModel() entirely, and re-importing our models! I know this means that Atlas padding won't function correctly, but we weren't using that anyway
     
    Last edited: Oct 6, 2023
    guycalledfrank likes this.
  14. egutentag

    egutentag

    Joined:
    Nov 27, 2020
    Posts:
    14
    When setting lightmap scale to 0.1 or less every mesh render in scene is set to zero.
     
  15. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    610
    I have encountered a problem: every time I finish baking (no matter how small the scene is), Unity occupies almost all of my computer's memory (about 90%), and I have 64GB of RAM. Do I need to adjust any settings?
     
  16. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    610
    Report on Unity 2022.3.8f1
     
  17. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,658
    So yes, AO being 0 kills original reflections and Unity's own ambient lighting. This is a workaround because unlike HDRP/builtin, URP doesn't have a way to override GI specifically in its shader graphs.
    Also unoccluded reflection probes often look pretty bad, shining from every corner (it's one of these annoying artifacts that immediately give away Unity on screenshots...). Usually I keep SH objects with SH specular only and shiny/metallic objects using a different shader with reflections and no SH lightmaps.
    If you still want to have reflection probes in these graphs and avoid double GI brightness, they can be added relatively easily in the graphs. Attached is the SHSpec subgraph used by BakeryURPSHSpecGraph, which I modified to have reflection probes (using URP 14.0.8 here).

    Here is what I added:

    upload_2023-10-10_18-54-10.png

    OK this is weird. Can you please:
    - Try updating your drivers (https://www.nvidia.com/download/index.aspx)
    - Try not using OptiX denoisers (OpenImageDenoise or off)
    - If that doesn't work, DM or email me your GPU name + any error messages present in console + lightmap count (printed to console if you enable Checker Preview). Also does it only happen with one particular scene?

    You can use Bakery Standard shader on built-in, no need for porting the graph (!)
    Or do you have customized shader graphs that go beyond just MonoSH support? Also did you try the existing URP shader graph in built-in? Most of the stuff there is not URP-specific.

    Hmm... perhaps your root scene uses directional lightmaps, but prefabs don't?

    Shouldn't be an issue, unless they are not unloaded when you want to fully unload the bundle.

    Very odd. I don't know if it can help, but just in case, try baking with Asset UV Processing = Remove Adjustments, just to see if the most vanilla unwrap version will look reasonable.

    OK, weird, do you load the scenes asynchronously at runtime? Can you try calling ftLightmaps.RefreshFull() after the scene is fully loaded? Also, does it happen to any scene that is open at the time of building?

    Yeah, it works the same, except the lightmap list is shared across all scenes. I forgot why I disabled the deduplication code, but you can try it and see if it helps. In ftRenderLigthmap.cs there is

    public static bool removeDuplicateLightmaps = false;


    try setting it to true instead of false.

    Hmm, that's a good catch. But how did you import a mesh with 0 vertices? Unity FBX importer completely removes mesh renderer/filter for these (at least for me).

    Interesting, interesting. So if you enable the adjustment, will it fail the same way again with these models? Maybe you can send these magical problematic FBXs to me to test?
    Also the branch you quoted is only called if you used "Save padding to asset":

    upload_2023-10-10_20-53-16.png

    In any other cases, different branches are taken.

    Baking with Asset UV Processing = Remove UV Adjustments would do the same, no need to change scripts. But I wonder if after removing and then adjusting again it will end up in the same weird state?

    ?? I can't reproduce this. Do you mean the values are set to 0 on mesh renderers after the bake?

    After baking Unity usually starts encoding/compressing textures. I didn't check how much memory it takes, but it can easily take a lot of CPU time. Maybe memory as well if you're using "parallel import". You can verify it by selecting all your lightmap texture assets -> right click -> reimport. If it takes the same amount of memory, then it's the reason.
    Although 64 GB sounds like a lot. And does it free this memory later or does it always stay at 90%?
    After some quick tests I can't reproduce it. Does it happen with my examples scenes too? It would be helpful if you could record and DM me a video with the task manager / performance open and the baking progress bar visible, so it can be tracked at which point memory allocations start to grow... if you can also send me a little test project, that would help even more.
     

    Attached Files:

    Last edited: Oct 10, 2023
  18. Object-Null

    Object-Null

    Joined:
    Feb 13, 2014
    Posts:
    70
    hello there,

    how do i avoid this, low quality render on some of the objects?
    for this cabinet/counter i use 2 UV Channels.
    those uvw's are the same in size for the second UV channel


    upload_2023-10-13_11-54-5.png

    this is with shadow checker enabled
    upload_2023-10-13_11-54-21.png

    and this is the default baked lightmap view.
    upload_2023-10-13_11-55-14.png

    i have no idea what i'm doing wrong here.

    hope somebody has a answer for me. thank you in advance
     
  19. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    602
    If you make your own engine, and it happens to be FOSS. You have my support, I'll do what I can to help out.

    Btw your game is looking amazing. Love the brick throwing\breaking windows tweet. :cool:

    Godot support would be awesome. I think most serious indies will be leaving Unity once their current game is done. The only ones left will be the F2P games that are monetizing successfully and probably hobbyists or random students. Which is most likely Unity's target consumer anyways. .. . but don't stretch yourself too thin. You have enough on your plate I think..

    Unreal is just as bad as Unity (esp with the latest round of layoffs by Tim) .. Before Unity came, Unreal had some very predatory business practices.. young devs nowadays won't know this cuz they weren't born yet.

    Ok I'll have to package a light weight version later on. I moved onto non-lighting based tasks again. I have no idea why I'm the cursed one, what did I do in a past life?:D

    This seems to have done the trick. Thanks! :)
     
    Last edited: Oct 18, 2023
    guycalledfrank likes this.
  20. mehrankan

    mehrankan

    Joined:
    Apr 12, 2015
    Posts:
    61
    Hi,
    I am using bakery with prefabs(not bakery prefabs but just ordinary prefabs set to static), the problem I am running into is that if I use the same prefab across multiple scenes, the last scene that gets baked gets the right light-mapping whereas every scene before that starts showing bugged out lightmaps the prefabs. I believe this bug goes away if I disable the "fix uv" option in the bakery settings, my theory is that this setting is alters the uvs based on the scene data and other objects in the scene, so bakery ends up re-adjusting the uv padding(of the fbx) every time that prefab goes through bakery during a bake, and since no 2 scenes are the same the last-baked scene is the only one that looks correct.
    -we are using auto generated lightmap uvs.
    -we are also using prefab variants.
    View attachment 1318076
    upload_2023-10-16_14-11-23.png
     
    Last edited: Oct 16, 2023
  21. jg3d

    jg3d

    Joined:
    Jan 13, 2014
    Posts:
    17
    Hi, all-

    I'm having difficulty additively loading light mapped scenes without messing up the lightmaps of the added scenes. Everything looks great when loaded independently (see image #1), but is completely unaligned when additively loaded (see image #2). The manual says independent baking and additive loading is possible. Am I missing something?

    Thanks in advance!

    Unity: 2022.3.10 LTS
    Pipeline: URP
    CleanShot_2023-10-11_at_10.09.342x.png CleanShot_2023-10-11_at_10.10.492x.png

    [EDIT]: I think I fixed this by dumping out all the lighting / bakery data/cache for the scene and starting from scratch. There seemed to be something weird in the way it was referencing the lightmaps
     

    Attached Files:

    Last edited: Oct 18, 2023
    guycalledfrank likes this.
  22. zenbin3d

    zenbin3d

    Joined:
    Jul 7, 2023
    Posts:
    14
    Hey @guycalledfrank,

    I'm using an Intel i9-13900KF CPU with and RTX 3070 Ti card I can't seem to configure Bakery to push the system to its maximum potential to bake a small sandbox scene of 600m x 600m faster. I also tried setting the tile size to 2048 and I'm using RTX mode.
    The baking process doesn't seem to parallelize the work enough to use all the GPU and/or CPU resources.
    I noticed that Bakery generates multiple temporary LM files one by one. Maybe a stupid question here but is there a way to maybe set it to generate multiple LM at the same time? Or something to allow it to squeeze more of the CPU and GPU resources?
    The overall system is barely getting a pushed during the baking process.
    And for a scene of 600m x 600m with a lot of foliage objects I'm getting something like 30 minutes bake time.
     
  23. nekroraptor

    nekroraptor

    Joined:
    Sep 9, 2018
    Posts:
    6
    Hey @guycalledfrank,
    I have been working with your asset for 1 year in Unity 2020 with success.

    But I had to update the project to 2021 and then it stopped working (I dont know if it´s directly related or maybe another change is affecting).

    With the new version in the same project, if I try to start the preview Unity stucks with this (see attached image).

    I have reinstalled the asset, updated... but still not working... There is something I can do??
     

    Attached Files:

    guycalledfrank likes this.
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,658
    Seems like occlusion, but very low-res. Try increasing scale in lightmap for this object? Also check if disabling "Fix Seams" changes anything? You can also send this scene/model/package to me, and I'll test it and see if there is a better solution.

    Hi! Did you try any of these solutions? https://geom.io/bakery/wiki/index.p..._in_one_scene_breaks_its_UVs_in_another_scene

    Hmm do you have any performance graphs?
    - If you have lots of area lights (Light Meshes), try applying the latest github patch, as I fixed the associated CPU overhead: https://geom.io/bakery/wiki/index.php?title=Github_access
    - If you have a lot of small lightmaps, try this: https://geom.io/bakery/wiki/index.php?title=Troubleshooting#I_get_too_many_lightmaps

    I tested it on 2021, so it should be the problem. Seems stuck on scene export. Possibly atlas packing/unwrapping? https://geom.io/bakery/wiki/index.p...rting_scene_-_preparing.22_is_taking_too_long

    Does it work on smaller scenes or my example scenes?
     
  25. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    78
    FIXED
    Hello, i have an issue with an URP alpha cutout custom shader, when the _BaseMap texture has an alpha channel.
    It looks like there's no GI bounce ? I'm able to get that same "wrong" result with a Unity SimpleLit if the object is fully clipped.
    So it's like Bakery is considering the mesh to be fully clipped, eventhough it is fully displayed.

    It's fine if i remove the alpha from the texture or if i set the RenderType tag as opaque.
    I'm not sure what to set.

    Edit : my clipping variable wasn't named _Cutoff
     
    Last edited: Oct 25, 2023
  26. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    73
    Exactly. We do this so we can later rotate our prefabs which would not work when the prefabs use a directional mode I think.

    Should we bake them differently? Now I set those values via script right before they get initialized, but was hoping for a better solution wich already works during baking.
     
  27. DonCornholio

    DonCornholio

    Joined:
    Feb 27, 2017
    Posts:
    91
    Hi @guycalledfrank ! I was checking out the new MonoSH directional map type and after a few tests, I was immediately wondering: Why isn't there an option to save the directional map as 16bit per channel .PNG ? Especially on flat surfaces I had nasty blocks everywhere no matter the compression. So I threw the texture into substance designer and did some dithering, down sampling and blurring and exported with 16 bits and was able to get rid of a lot of the issues. But obviously that technique is pretty limited and cumbersome. Any chance you could give us the option to select bit depth for directionality? (Maybe also a viewport denoiser for rtpreview if you find the time?)
    Keep up the great work :) I love your products. Thank you so much for making them
     
    guycalledfrank likes this.
  28. TheOnlyBete

    TheOnlyBete

    Joined:
    Jul 7, 2015
    Posts:
    2
    Hey @guycalledfrank,

    I'm having an issue with Bakery and Unity 2022. As soon as I import Bakery, the scene view breaks. The textures in the scene view don't display, it looks like instead it is showing the lightmap. The skybox also disappears.

    When I close and reopen a scene, I do get some errors - I have screenshots if needed.

    I've tried creating a new project and only importing Bakery but get the same result.

    If I downgrade my current project to 2021.3.31f1 everything works as intended.

    The game view looks fine, this seems to only affect the scene view.

    Is this something you're aware of? If so is there a fix? I've tried getting the latest patch from github and that did nothing for my issue unfortuantely.
     
  29. Imperatoss

    Imperatoss

    Joined:
    Mar 24, 2018
    Posts:
    51
    Hi,
    when baking Shadowmask i get some wrong black lines on my Terrain. Does anyone have a solution for that?
    Bakery1.JPG
    bakery2.JPG
     
  30. smakis

    smakis

    Joined:
    Jan 18, 2023
    Posts:
    18
    Hello! I'm having some issues with baked lights both turning out incorrectly but also not applying like they should.

    It looks fine in the preview, very similar to what's in the scene view.

    upload_2023-11-5_22-57-24.png

    Once baked however there is no lighting data applied in the baked lightmaps tab of the lighting window, though it's still applying some form of light maps. It looks mostly like the preview, except for the cannons having some very dark areas.
    upload_2023-11-5_22-57-33.png

    I can select the empty lighting data asset field and hit delete, which will remove the lightmaps until the next time I leave play mode or reload the scene. If I do press play the light maps on the well is not applied, only on the cannons/their platforms.

    upload_2023-11-5_22-59-7.png

    There is a lighting asset generated, but if I drag and drop it into the lighting data asset field everything becomes super exposed instead, and as soon as I reload the scene or leave play mode it once again is removed. upload_2023-11-5_22-59-37.png

    The well consists of a lot of individual blocks that I mark as static when I bake the light maps, then for runtime they are marked as non static and combined into a single mesh, not sure if this could have something to with it, but the cannons and their platforms are always marked as static and aren't getting the light maps correctly applied either.

    This is the desired end result, the cloud and water shader are dynamic planes that are generated in runtime and shouldn't receive any baked lighting.
    upload_2023-11-5_23-8-25.png
    The scene consists of one strong point light in the middle of the well (intensity of 3700, which the manual says is too high, but seems to bake correctly and looks correct in the preview?), the fake ambient lighting trick, a baked directional light at an intensity of 1.19 and a baked spot light behind the upper left cannon. The other lights are real time.

    Unity version 2022.2.13, urp 14.

    I'm at a bit of a loss here, is there anything obvious I'm doing wrong?
     
    guycalledfrank likes this.
  31. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,658
    Hmmm so indeed Unity doesn't support having directional and non-directional lightmaps in one scene; if the scene mode is directional, it expects a directional lightmap everywhere; if it doesn't find it, it looks "black and white". Using "emptyDirection" helps, as you noticed.
    Bakery actually fills these emptyDirections automatically when loading multiple scenes/prefabs additively (just did some tests to ensure it didn't break). I'm not sure about bundles, but if you load anything asynchronously, try calling
    ftLightmaps.RefreshFull()
    after the data is fully loaded - it should do the trick.

    You can make it save to PNG... but, 8-bit:

    upload_2023-11-6_9-1-27.png

    16-bit PNG won't be too useful, as Unity will have to convert it to some GPU-ready format anyway, and the options, at least on PC, are:
    - DXT1: 5:6:5 RGB
    - BC7: 8-bit (docs say "the format is capable of encoding source data with higher bits", but Unity seems to be using the most common 8-bit version anyway?). 2x memory.
    - BC6H: non-linear HDR, could work, but Unity won't really import a PNG as BC6H, it treats PNGs as non-HDR images. 2x memory also.
    - Uncompressed RGBA 8-bit. 4x memory.
    - Uncompressed RGBA 16-bit (half-float): you can choose it manually as Format in texture importer, but I'm unsure if it doesn't still clamp it to 8-bit. Also that's 8x memory

    What GPU format was it using in the end? Maybe it's not because of the PNG, but because of that dithering/blurring?

    I tried OptiX/OIDN, but they were too slow for RTPreview. It obviously needs a more real-time denoiser, like DLSS. Maybe I'll try adding something like this, but I'm unsure if it'll be very useful, as we'll be just looking at a "mushy" picture instead of noisy until it's stabilized.

    Thanks! <3

    I assume you wrote me an email about this recently? Where it was fixed by turning Checker Preview on and off? (hopefully this response will help anyone else encountering it).
    Maybe you had Bakery previously installed in this project, enabled checker preview, then deleted Bakery, then installed it again? Not sure what else could provoke this behaviour. Does it happen on a fresh project?
    (will continue in email)

    Weird! Is it with Terrain Optimization on or off (and does it change if you toggle it)?

    It can be an issue with the baked maps tab - sometimes it doesn't recognize external lightmaps; also Bakery doesn't really generate/use the standard lighting data asset, unless you have any probes baked.

    Lightmaps seem to be baked, but I suspect the resolution is just very low on parts of cannons or they have some UV overlaps. It seems the one distant cannon is brighter than others... can it be that your cannon models all overlap on each other? Did you use any Lightmap Groups on them?

    Lighting data asset should not affect Bakery lightmaps in any way. The lightmaps will be reloaded from Bakery's own data (which is stored inside the scene).

    Are you using some custom script for this? (standard batching should be ok)

    If you can DM me any small test project with minimal data, I can debug it.
     
  32. smakis

    smakis

    Joined:
    Jan 18, 2023
    Posts:
    18
    The distant cannon is lit by an extra baked spotlight, most likely why it appears brighter, I'm not using any lightmap groups. I am indeed using a custom script to combine them which might be causing issues (though it's mostly calling unitys combine mesh).

    I'll try to swing a project together and send it to you asap, thanks for helping!
     
    guycalledfrank likes this.
  33. Imperatoss

    Imperatoss

    Joined:
    Mar 24, 2018
    Posts:
    51
    Hi,

    yes it changes, if i disable Terrain Optimazition it works, but i have a lot of trees and large terrains so it takes a very long time to build
     
  34. DonCornholio

    DonCornholio

    Joined:
    Feb 27, 2017
    Posts:
    91
    @guycalledfrank I was trying Android Textureformats so ASTC, ASTC HDR and RGBA Half. And i made a little overview of my findings in the form of a refboard. Please have a look, i imagine having the source output in 16 bit per channel would help, since with my processing it makes a noticeable difference wether i am doing that in 8 or 16 bit per channel (also outputting in the respective bit depth). Have you ever tried to see if that impacts quality?
    I mean i can't be sure if the improved results are just from the smoothing and blurring, it could be just that. But I mean even converting to normal ASTC from 16bit seems to fare a bit better than from 8bit.
    I wished there was a simple way to use SubstanceDesigner graphs as texture postprocesing filters in Unity. Is there an easy way to hook into the lightmap creation process and do post processing with bakery? There were a few times where i thought it would be cool to do different lightbakes and combine the results with channel packing to realize a new kind of lightmapping mode (like channelpacking indirect + merged shadowmasks and ao for example).
     

    Attached Files:

  35. DonCornholio

    DonCornholio

    Joined:
    Feb 27, 2017
    Posts:
    91
    @guycalledfrank Also i had a weird bug lately, where one of my lightmap groups lightmaps comes out weirdly stretched and distorted, like the unwrapper (xatlas) is just screwing up something. And it's not consistent, sometimes it just fixes itself or affects a different lightmap group. I don't know if this is a problem but i use the same lightmap group preset in two lightmap group components on two root objects, and it works that way for most but not one. Any idea what is wrong here ? I wanted to switch to the default Unwrapper but i got an error message BUT it references part of a lightmap group that doesn't have these problems:
    upload_2023-11-8_1-44-16.png
    this is what the problem area looks like :(
    upload_2023-11-8_1-43-56.png
     
    Last edited: Nov 8, 2023
  36. DonCornholio

    DonCornholio

    Joined:
    Feb 27, 2017
    Posts:
    91
    Here a comparison of one of the affected objects and its actual lightmap uvs
    upload_2023-11-8_1-50-37.png
    I used Xatlas for Atlassing and set UVs to Don't change
     
  37. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    78
    Are we stuck with SH light probes tech for lighting dynamic objects ?
    On mobile, i'd like to have my characters only lit by lightprobes and zero real time light but i have the ugly contrasted lightprobes issue (which is inherent to SH precision if i understand correctly).
     
  38. unity_CO8l5OIlSRaJZA

    unity_CO8l5OIlSRaJZA

    Joined:
    Feb 27, 2023
    Posts:
    1
  39. murat303

    murat303

    Joined:
    May 22, 2014
    Posts:
    37
    Is there a way to turn off Light Mesh (Area Light) shadow casting?
     
  40. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,662
    guycalledfrank likes this.
  41. murat303

    murat303

    Joined:
    May 22, 2014
    Posts:
    37
    Self Shadow: determines if light mesh itself casts shadows. What I want is to turn off the light casting shadows like in Unity (Shadow Type -> None)
     
  42. DonCornholio

    DonCornholio

    Joined:
    Feb 27, 2017
    Posts:
    91
  43. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    602
    hi @guycalledfrank

    I updated to the latest version of Bakery and am now getting this error when I try to bake lightmaps. I've reinstalled bakery twice (and updated to the github latest version)

    Any ideas why there's this read issue? :oops:

    I suspect it has something to do with the backslash after "_bakery"? .. i think it needs to be a forward slash?

    Thanks for the help!
    upload_2023-11-18_18-55-4.png
    Code (CSharp):
    1.  
    2. Launched
    3. Launched
    4. Loading shader dilateHalf.ptx::oxMain...
    5. Done
    6. Init...
    7. add
    8. Tile size: 512
    9. Device 0: NVIDIA GeForce RTX 2060 with Max-Q Design (ON)
    10. Used host memory: 0mb, available GPU memory: 5120mb
    11. MODE: add
    12. USING FLOAT
    13. Loading shader addHalf.ptx::oxMain...
    14. Can't read texture D:/TEMP/_bakery\light_1_4_HDR.lz4
    15.  
    I think I'm going blind ? I can't find that file.:eek:

    upload_2023-11-19_0-41-49.png
     
    Last edited: Nov 19, 2023
  44. sipon

    sipon

    Joined:
    Feb 8, 2009
    Posts:
    143
    Hi, how does MonoSH work with Better Lit Shaders? I can only see "SH" in the BetterLit lightmaps mode options.
    Sorry to ask you about another asset but Jason told me he didn't write the integration and I should ask you instead. Hope you can help.
     
  45. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,658
    Trees are not affected by Terrain Optimization. Unity's built-in lightmappers ignore these terrain trees completely (you can do that too by disabling "Export terrain trees).
    Bakery also uses the highest-detail LOD for them, which might be not optimal.
    I've just added a little patch, allowing you to change their LOD level. Can you try it? https://geom.io/bakery/wiki/index.php?title=Github_access

    I didn't add any UI for it for now, but if you open ftBuildGraphics.cs, you will find this line:

    public static int terrainTreeLODLevel = 0;


    If your trees have LODs, try increasing it (e.g. 2) and baking again - it should take less time.

    Hmmm I don't see that much of a difference between 16-bit and 8-bit processed on your pic:

    upload_2023-11-22_15-9-12.png

    Both have similar artifacts. So I think blurring is the key difference here.

    Technically you can subscribe to OnFinishedFullRender event, get the list of lightmaps and do any processing on them.
    I thought of adding some GPU pixel processing callback also, but it's very tricky to do without needless RAM<->VRAM data copying, as both the lightmapper, the texture converter and Unity are in different processes...

    Weird! It looks as if there was some very long narrow object assigned to the group, and all other objects became tiny in comparison...
    Unfortunately I don't have much control over xatlas' behaviour. Maybe you can separate these objects into 2 different groups if they can't pack well together? Or use different groups for different LOD levels?
    As usual, if you can send me any test package/project, I'll debug it.

    "Don't change" keeps the latest used UVs. Maybe you wanted "Remove UV adjustments"?

    Try:
    a) Using Volumes (if the platform allows)
    b) Enabling "Remove ringing in Legacy light probes" in Project Settings -> Bakery, then baking light probes in Legacy mode.
    c) Using my non-linear SH shaders to fix all issues with all types of light probes (On Standard pipepine: Bakery Shader with "Non-linear Light Probe SH" option. On URP: BakeryURPNonLinearLightProbe.shadergraph. On HDRP: BakeryNonLinearLightProbe.shadergraph). These shaders don't have a significant impact on performance.

    Most likely you're using different incompatible versions of the Lightmapper and RTPreview. Could happen if you e.g. imported the latest RTPreview into an old project with an outdated version of Bakery. Please try getting the latest patch for both packages.

    Yeah, so:
    - Indeed, disabling "Self-shadow" on the Light Mesh will prevent it from casting any shadows (that's what you want).
    - However, it also just makes the mesh completely transparent to all rays, meaning the accurate close-range lighting technique also stops working; Light Mesh then only uses the distant technique where it is approximated by a cloud of virtual point lights (some visual explanation: https://twitter.com/guycalledfrank/status/999658120292065280)
    - ... meaning you need to increase Samples Far significantly. Depending on the physical size of the Light Mesh, it can be totally viable (e.g. 8192 samples for a medium window) or... not really (e.g. huge lava lake - can't have enough samples).
    Usually shadowless area lights are used as hacks for window lighting, in which case I recommend just having one normal Skylight with the increased sample count.

    Hmmm... so I can see it's trying to read "light_1_4_HDR.lz4", but you only have "light_1_4_RNM*.lz4" in the folder... I wonder how that happened.
    - What render mode and directional mode are you using?
    - Do you have any lightmap groups in the scene? What render/directional modes are THEY using?

    No, MonoSH was introduced after Better Lit Shaders were released.
     
    DonCornholio and Noors84 like this.
  46. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    602
    Hi @guycalledfrank
    I made a movie showing the steps to reproduce this issue. I dm'ed you. :)

    Thanks!
     
    Last edited: Nov 23, 2023
    guycalledfrank likes this.
  47. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,658
    Hi Karl, thanks for the clear steps, found the bug!

    So it happened with:
    - Bounces = 0
    - Shadowmask
    - Directional mode = SH/RNM/MonoSH

    So I've just fixed it. Please try downloading the latest patch (via patcher/github)!
     
  48. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    602
    It's fixed! Thanks Frank!
     
    guycalledfrank likes this.
  49. rastleks

    rastleks

    Joined:
    Jul 17, 2014
    Posts:
    46
    I see this error when I trying to bake lightmaps. Any idea where to find reason for this?
    .ftracelog.txt doesn't have any additional messages, just the same as in this window.
    upload_2023-11-24_12-17-10.png
     
  50. HarleyInfinity

    HarleyInfinity

    Joined:
    Nov 29, 2021
    Posts:
    2
    Hiya, my team recently picked up Bakery and so far it has been pretty awesome. I do have a fairly large problem though. None of my point lights show up anymore, even when using the bakery point lights. When I try to bake in a new scene they bake just fine, but in my currrent scene they don't ever show up. Maybe I'm missing something? Does lacking a metapass have anything to do with this perhaps?

    Any help is much appreciated.

    upload_2023-11-24_17-6-42.png
     
    guycalledfrank likes this.