Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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

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

  1. Monterroso141290UNIS

    Monterroso141290UNIS

    Joined:
    Aug 10, 2013
    Posts:
    3
    Hello there! So, Im trying to bake a point light in my scene using the shadowmask settings described in the wiki. However, most of the times it just gives me black shadowmaps and even when I get accurate shadowmaps and turn off the lights on my scene, the shadows and lights are not there. Any suggestions?



     
  2. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    80
    Hello!, any update about the Mono SH ShaderGraph support?
     
    Gooren likes this.
  3. skyfam2

    skyfam2

    Joined:
    Apr 15, 2021
    Posts:
    14
    hello just say your comment,same issue for me too.
    how to solve:upgrade your specs with gpu that surpporting CUDA.
    only nividia
     
  4. Dogebrand

    Dogebrand

    Joined:
    Jul 13, 2018
    Posts:
    4
  5. RedHeart95

    RedHeart95

    Joined:
    Jun 25, 2016
    Posts:
    6
    Hello, I found a bug in the latest version as was told to post it here from the discord.

    The light map at index 0 is not unloading; This behaviour is present no matter which lightmap is loaded first, and is present across all scenes.

    Something to note, going back to the scene that loaded the lightmap does not load a second copy of that light map.Hope a solution can be found soon.

    - R

    Edit:

    I found a workaround (It might not even be a bakery problem) This tracked issue might be causing you problems:

    https://issuetracker.unity3d.com/is...-loadsceneasync-slash-unloadsceneasync-method

    The workaround was to call both of these when the Async loading AND unloading is finished:

    ftLightmaps.RefreshFull();
    LightProbes.TetrahedralizeAsync();

    It can be quite expensive tho, recommend placing them in an Enumerator and adding a bit of a delay between the two. If you want more information on my fix, DM me.

    - R.
     
    Last edited: Sep 6, 2022
    guycalledfrank and atomicjoe like this.
  6. acallerame93

    acallerame93

    Joined:
    Mar 18, 2022
    Posts:
    1
    First time using Bakery. I set up my lights, had RTX mode enabled (I have a RTX 2080 Super with the latest drivers) along with some recommended settings, and I got this error. Turned RTX mode off, and it still throws errors about RTX functions failing to launch. So then I used the detected optimal settings, which reports both RTX and non-RTX lightmappers are not launching. I then tried reimporting, no dice. Then tried deleting bakery and reimporting it, still doesn't work.
    Unity_2022-09-04_13-42-00.png Unity_2022-09-05_09-54-17.png
     
  7. wechat_os_Qy08YoCHSv2veaCnLZAm0J-Og

    wechat_os_Qy08YoCHSv2veaCnLZAm0J-Og

    Joined:
    Apr 13, 2021
    Posts:
    1
    upload_2022-9-7_22-45-51.png
    My rendering process stopped here!!!

    The GPU of this computer is rtx2070

    On another computer, the GPU is 1650, but there is no such problem

    I'm not sure if it's because of the problem with Gpu



    The plug-ins used by the two computers are exactly the same, and the resources are the same and re imported separately




    Details:

    1. The baking progress bar is stuck at 0%, as shown in the figure

    2. Even if you click Cancel baking, ftrace.exe still occupies the graphics card, and it is 100%. End the process in the task manager
    upload_2022-9-7_22-49-18.png
     

    Attached Files:

  8. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Hi, can I bake prefabs separately even if they are placed in same spot? Like, I have a garage and in there I have multiple cars, I want them all to be baked but in same spot and will switch them on and off during runtime. The platform the cars are setup on is separate for each car but want to bake them all separately.
     
  9. Falondrian

    Falondrian

    Joined:
    Nov 1, 2017
    Posts:
    72
    Hi @guycalledfrank, I would be super grateful if you could improve the prefab lightmapping to support multiple different bakes! I think this could be a viable solution:
    - Allow the BakeryPrefabLightmapData to have slots for multiple lightmaps. Slot 0 is applied by default.
    - In the Bakery window add a setting to specify which slot to bake into

    This would be SUPER helpful! And probably rather easy to implement? We could then easily switch lights on/off and so on. I'm sure this would also immensely help Eugene B to support bakery prefabs in his magic lightmap switcher.

    Right now I have to do a messy workaround where I have a base prefab, create two variants of it with the different lights on/off. Then create another prefab where I add the variants and set them active depending on what I want. Its annoying footwork, gives maintenance overhead and has twice the instantiation overhead.
     
  10. Donion

    Donion

    Joined:
    Jun 7, 2017
    Posts:
    35
    Hey @guycalledfrank, I have been using bakery for a while now and recently the light probes haven't been baking properly. I have a scene with proper lighting. If I copy the scene and try to the baking process on the new copied scene dynamic objects are pitch black do you have any insights on this? Also a discord server would be a really great edition for help!
     
  11. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    Are you using the Legacy Light Probes generation or the L1 Light Probes generation?
     
  12. vchedeville

    vchedeville

    Joined:
    Jun 1, 2022
    Posts:
    5
    Hey,
    I have an issue with SH Spec bake, the spec does some weird things when a surface is lit by multiple lights. I don't know if it's just a limitation or a bug/mistake I made with the spec.

    Thanks for your help InkedScreenshot 2022-08-18 165231.jpg Screenshot 2022-08-18 165231.png
     
  13. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    It's a limitation of the technique: for each texel in the directional lightmap you record the direction of the brightest light, so if multiple bright lights overlap, it does some averaging and gives weird results. It works very well for soft lighting but has problems with hard lights like in your case.
    Blurring the directional lightmap on an external app may help, but it will never completely fix the problem.
     
    guycalledfrank and vchedeville like this.
  14. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    80
    Lightmaps are just global textures maps, just bake 2 different versions change the name of each lightmap to don't overwrite it and then just make a custom shader to switch between both textures maps, of course you need to adjust the uv, if you are using shadergraph, bakery already have a custom node to do that.
     
    guycalledfrank likes this.
  15. vchedeville

    vchedeville

    Joined:
    Jun 1, 2022
    Posts:
    5
    There is a way to exclude the baking of specular on certain lights?
     
  16. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    Not that I know of.
     
    Last edited: Sep 9, 2022
    vchedeville likes this.
  17. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Any idea what's happening?

    I've been struggling with this for 4 hours until i bought bakery preview and i saw this upload_2022-9-9_23-47-55.png
     
  18. Donion

    Donion

    Joined:
    Jun 7, 2017
    Posts:
    35
    Im not sure, how would I check? Im using Magic Light Probes to generate the light probes and simply pressing the "Render Light Probes" button under the bakery tab.
     
  19. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    It's in the advanced settings. I guess you're just using the regular L1 mode, but check anyway:
    https://geom.io/bakery/wiki/index.php?title=Manual#Light_probe_mode
     
  20. Donion

    Donion

    Joined:
    Jun 7, 2017
    Posts:
    35
  21. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    It looks like the meta pass is wrong for that material. Is the black zone a different material than the rest of the wall? Are they using the same shader both?
    It's either that or the Lightmap UVs are not being correctly generated for this zone. Try regenerating them in the modelling solution you're using.
     
  22. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    They are sharing the same material and model and settings
    Also i don't know what's going on here too

    upload_2022-9-10_1-59-26.png
     
  23. Donion

    Donion

    Joined:
    Jun 7, 2017
    Posts:
    35
    So I did some more testing and the ambient lighting seems to be kind of working. Im using 6 directional lights with no shadows, on indirect mode as described in the manual to create ambient light. But for some reason the dynamic objects are very dark compared to the scene. They are getting some of the global illumination from the container in this example but none from the wall. unknown.png
     
  24. Donion

    Donion

    Joined:
    Jun 7, 2017
    Posts:
    35
    here is another example of the light probes not rendering with enough brightness to match the scene. Any insight would be greatly appreciated. unknown.png
     
  25. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    My guess is the Lightmap UVs are wrong or are overlapping. If you are importing the model from a file, be sure to check "generate lightmap uvs" in its import settings.
    If you are using a Unity level modeller, you will have to check the lightmap uv generation settings.
     
  26. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    I tried but it looks the same
    upload_2022-9-10_12-22-11.png
     
  27. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    i also tried on another scene and it has the same bug

    And i created a new fresh project and scene and it looks the same
     
  28. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    You will have to be more specific than that.
    Is the model imported from an external modeler or is it done inside Unity with a level design modeler?
    Are you generating the Lightmap UVs in the import settings or are the UVs already made by the modeler?

    The devil is in the details.
     
  29. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Hello, the model is imported from external modeler, the scene itself is made by unity demo team
    both scenes doesn't have uvs and i checked the generate lightmap uvs on both and it looks really weird
     
  30. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    The "generate lightmap UVs" is done on the model import settings, at the very bottom, not the scene:

    Check the bottom of this page for more info on that:
    https://docs.unity3d.com/Manual/FBXImporter-Model.html
     
  31. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Hi, i already know that and i did that.
     
  32. jmgek

    jmgek

    Joined:
    Dec 9, 2012
    Posts:
    76
    Code (CSharp):
    1. remote: error: File Assets/Editor/x64/Bakery/cudnn64_7.dll is 322.53 MB; this exceeds GitHub's file size limit of 100.00 MB
    Do I need the cuda package?
     
  33. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    So no one is going to provide me support?
     
  34. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,627
    Yeah, feels like you should make sure that the scene is fully loaded. I tried adding some sectored scenes in a batch, and it worked OK, so I'm not sure.

    Make sure that the object is not null and call LoadRenderSettings().

    Are these specifically updated for MonoSH? MonoSH may appear working with shaders interpreting it as regular directional maps, but it will result in a kinda broken look.

    Bakery shader for standard pipeline fully supports it, but I didn't add URP/HDRP graphs yet.
     
  35. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,627
    Falondrian and atomicjoe like this.
  36. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,627
    You light intensity is literally 26228920000000000 if I'm reading that right.
    That's a bit too much :D It's likely hitting some precision limits.

    Yes.

    That would be nice for sure :)
    But I don't mind if you don't do it.

    Hmm, interesting... so do you use async loading yourself? Does it happen with non-async loading?

    If it can't be fixed without using TetrahedralizeAsync(), then it sounds like a Unity bug :confused:

    In case you did import the package correctly and both ftrace.exe and ftraceRTX.exe are present, it sounds like some random pseudo-AV software issue: https://geom.io/bakery/wiki/index.p...g#Baking_any_scene_crashes_with_unknown_error
    Some AV (Avast especially?) seem to be sometimes configured to just completely block any new unknown exes (even if they pass virustotal with all green).

    Weird, but can you check if it performs better with RTX mode enabled on your 2070?
    Maybe new drivers for RTX cards don't like the non-RTX OptiX version much, I'm not sure.

    Not really, they will cast shadows on each other, if enabled at the same time, so they're either should be baked one by one (disabling one, enabling another), or just far enough from each other. Platform copies can be set to not get lightmaps on their own (scale in lightmap = 0).

    I'm not sure if putting a large part of your scene into a prefab is the single best option for having switchable lights. I'd rather prefer the switching system to work with unprefab'd scene parts. Maybe using sectors for this is a better idea than prefabs? Or even both.
    It sounds easy to implement on the surface, but I have a gut feeling of catching bugs and inconsistencies for another 2 years after it :D
    Actually it could be implemented as a script on top of Bakery (like the batch baker), which would call the bake method multiple times and store the lightmap list in its own array.

    Not sure what's going on here... can you try making a little test package/project? E.g. just a few boxes and the lights/settings you use? I'll test it.

    Yeah, as Joe said, it's a limitation, as we can only recover single average light direction, so when 2 lights start to "compete" with each other, it gets weird. It's less noticeable if the surface has more roughness.

    Not really, as it's not "baking specular", it just splits all lighting into different directional components (basically average + X + Y + Z). I feel it can be possible to only write some lights to the "average" component, but it will disable any diffuse bump mapping from them as well. Not sure if it's useful. Possibly you can mark some lights shadowmasked, so their specular is real-time.
    You can also tweak it a little bit in the shader... there is already a variable tracking the directionality of specular. It can be used to make it less visible in such areas.
    You can find a function called:
    a) BakerySH in Bakery.cginc (standard render pipeline)
    b) BakerySpecSH_float in BakeryDecodeLightmap.hlsl (HDRP)
    c) BakerySpecSHFull_float in BakeryDecodeLightmap.hlsl (URP)
    ...and see this line:

    spec = GGXTerm(nh, roughness)


    And change it to e.g.

    spec = GGXTerm(nh, roughness) * pow(focus,16);


    16 is just the value I tried, the higher it is, the more you will remove specular from intersecting areas.
    Maybe I should expose this value in the UI?

    upload_2022-9-12_1-7-35.png
     
    Falondrian likes this.
  37. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,627
    OK, this actually looks like a broken meta pass. Please check if my "isHDRP" fix from this post here can help: https://forum.unity.com/threads/bak...preview-released.536008/page-125#post-8384298
    Apparently some recent HDRP version changed the meta pass flipping again.

    Only for OptiX 5 denoiser.
     
  38. Falondrian

    Falondrian

    Joined:
    Nov 1, 2017
    Posts:
    72
    Not sure if I understand the "large part of the scene" part :) I'll explain my use case for clarity:
    - Multiple modular rooms in baked prefabs
    - Scene A: place all room prefabs with lights on in scene and bake to BakeryPrefabLightmapData slot 0
    - Scene B: place all room prefabs with lights changed (some off, some dimmed) in scene and bake to BakeryPrefabLightmapData slot 1
    - My code: Enable lightmap slot 0 or 1 depending on what I need

    I just realized though that this wouldn't work with bakerys mandatory "apply overrides" before bake :(

    BTW: thanks for the SH Mono graphs, been looking forward to these!
     
    guycalledfrank likes this.
  39. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    OMG .. Finally it worked when i set it to false
    but I'm already using HDRP then what's the point settings ishdrp to false?
    also there is another problem is that im not getting correct result at baking, but at preview it looks really good upload_2022-9-12_20-45-13.png
     
    Last edited: Sep 12, 2022
  40. Donion

    Donion

    Joined:
    Jun 7, 2017
    Posts:
    35
    Hello @guycalledfrank I'm having an issue with light probes being baked. They don't seem to be as bright as the ambient light. The skid on the left isn't being effected by light probes and the right is. I have upgraded to the latest patches found on GitHub and I'm using the unity simple lit material with Magic Light probes for placement. 1.png

    These are my bake settings
    2.png

    And my spot light settings
    3.png

    I have also tried directional lights with similar results. Any insights?
     
    Last edited: Sep 13, 2022
  41. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    I think you should use bakery volume, its a lot better than light probes
     
  42. Donion

    Donion

    Joined:
    Jun 7, 2017
    Posts:
    35
    I tried using volumes and had the same results as light probes
     
  43. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    114
    Everytime I try to bake the scene with Light prop or Bakery volume, I get this error

    Card, RTX 380Ti with 16G Memory
    upload_2022-9-13_15-13-23.png
     
  44. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    did u chose the rtx mode when baking?
     
  45. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,657
    In case you missed it: He wrote this in his post, asking if you could make a little test package/project and send it to him:
     
    Last edited: Sep 13, 2022
    atomicjoe likes this.
  46. TheDavid8

    TheDavid8

    Joined:
    Nov 19, 2013
    Posts:
    52
    I have a bizarre question. Is there any way to use this asset with a cloud based gpu solution? Thanks!
     
  47. SGJbrown

    SGJbrown

    Joined:
    Jul 9, 2021
    Posts:
    4
    Hi Frank,
    We're having an issue on our project for Quest 2. I bake lighting with two scenes loaded. I've got it working where it bakes one lightmap for each scene by using "Split by Scene" and lightmap groups. But if I unload one of the scenes, both of the lightmaps are still showing up in the "Baked Lightmaps" window. This is not what happens with a standard unity light bake. When I bake with the Unity progressive lightmapper, and I unload one of the two scenes, the lightmap for that scene will disappear from the lightmaps window.
    Our programmers are concerned that by using Bakery and having these two lightmaps loaded may be unnecessarily eating up memory on the Quest 2. Since both lightmaps load when I open just one of the scenes, does that mean that both lightmaps might be getting loaded twice in the Quest build when both scenes are loaded? And if so is there a way separate them for each scene so that only one lightmap gets loaded when one scene is loaded?(like how the standard unity lightmaps work).
    Also is there a way to control lightmaps order so that the active scene is always Index 0? We're using a mesh combine tool for the active scene and it needs the lightmap for the active scene to be the first lightmap.

    Thanks
     
  48. HunterAhlquist

    HunterAhlquist

    Joined:
    Oct 6, 2013
    Posts:
    127
    I'm having trouble with terrain trees, I've tried with export terrain trees and disabling terrain optimization. When I go into show checker mode the tree looks like this (but only when the tree is managed by a terrain:
    upload_2022-9-14_11-33-10.png

    Trees look how they should when they're just a game object:
    upload_2022-9-14_11-34-19.png

    Baking via Unity's lightmapper produces desired results. I should add that I'm using amplify imposters, but I have tried with a different prefab that's just the tree mesh with an LOD manager on it and it produces the same results.
     
    Last edited: Sep 14, 2022
  49. HunterAhlquist

    HunterAhlquist

    Joined:
    Oct 6, 2013
    Posts:
    127
    I think I know what's happening. I made the tree in blender, and blender has a different coordinate system Z is Y and Y is Z. Unity detects this and automatically applies a -90 degree transform when the model is placed, it appears Bakery takes this in account for game objects, but NOT for objects instanced by a Terrain.
    I applied the -90 degree rotation on the X axis in blender (also the scale,) and set the rotations of the objects to 0 in Unity, and now it's showing right-side up in show checker mode.
     
    Last edited: Sep 14, 2022
  50. yackson-cc

    yackson-cc

    Joined:
    May 14, 2016
    Posts:
    46
    Hi Frank , please, i'm trying to bake a scene, but the baked light is inversed:

    setup bakery:

    upload_2022-9-15_16-37-38.png

    upload_2022-9-15_16-39-13.png

    upload_2022-9-15_16-39-59.png

    upload_2022-9-15_16-40-22.png
     

    Attached Files: