Search Unity

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

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

  1. NoxityGames

    NoxityGames

    Joined:
    Jul 1, 2018
    Posts:
    36
    This would be an issue when one relies on baked lighting for direct and indirect lighting where resolution matters considerably. However, in my use case (and I know MANY other people on mid to higher end platforms do it this way too) baked lighting is merely used for indirect lighting, often layered with additional lighting information (either from direct lighting or screen-space effects or other lighting methods) - therefore resolution is not as much of a concern. The volumes here in essence server more like irradiance probes than a full lighting capture.
     
    guycalledfrank likes this.
  2. Enigma229

    Enigma229

    Joined:
    Aug 6, 2019
    Posts:
    135
    Thanks for the heads up with the URP shaders. :)

    Where would I put this shadergraph into in the folders?
    upload_2023-4-19_8-41-5.png

    Also, I'm playing around with the example_volumes_simple scene. What shader would I assign the terrain and lights to?

    I guessed and assigned them the URPDirSpec and did a bake and this is how the scene looks:

    upload_2023-4-19_8-42-32.png

    Is this correct?
     
  3. Enigma229

    Enigma229

    Joined:
    Aug 6, 2019
    Posts:
    135
    I changed the color of the terrain and did a bake and this is what I now get. Is this correct? upload_2023-4-19_8-47-37.png
     
    guycalledfrank likes this.
  4. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    142
    Hello,
    I have some issues where
    There is light filtering in at the edges:
    (Edit: after raising the texels from 10 to 20 this issue went away, but the others remained)

    In some interiors the walls are lit even though I have placed light probes, however in the same building the others walls are shadowed:

    Opposite thing happens on the exterior where the wall is completely black (using the same prefab, the result looks good for some areas of the building (like in the left corner):

    This are my settings:

    I have been trying with multiple settings but no success :(
    I'm using Unity 2021.3.21 built-in and the last patch of bakery from the github. I'm using a Skylight.

    Edit: after checking generate lightmaps UV on the models it's been fixed :)
     
    Last edited: Apr 20, 2023
    guycalledfrank likes this.
  5. forestrf

    forestrf

    Joined:
    Aug 28, 2010
    Posts:
    230
    This is very old and may already be resolved (I don't use the asset) but I found out that using #pragma target 4.5 makes GetDimensions work on OpenGL. It's still sad as apparently GetDimensions isn't free and requires increasing the pragma. If only Unity exposed unity_Lightmap_TexelSize...
     
    guycalledfrank likes this.
  6. levi9000

    levi9000

    Joined:
    Jan 25, 2014
    Posts:
    11
    I posted this in discord, but someone suggested I put it here as well:

    First off, Bakery is great, please keep up the great work Mr. F!
    Secondly, a feature request: Parallelized processing and Multi-GPU support.

    I assume I'm not the only one that sees a fairly underutilized GPU and CPU when baking due to the serial nature of the process. I have a beast of a PC, but when I render using bakery there are a lot of time gaps and overhead from running ftrace/etc.

    I hacked in support to run most commands in parallel (mostly ftrace), and i'm not positive all the commands i am allowing should run in parallel, but as far as I can tell I'm getting visually identical results and I'm seeing speed improvements of 2 - 5x for scenes with several to many light sources, especially when they aren't already batching. I think there are more gains to be had (especially when working with scenes with many lightmap outputs), but that would require your expert knowledge to set up the commands in a more parallelizable way while still working within the GPU mem limits.

    I also have a second GPU sitting idle--would be nice to make use of it, but I understand i am in a minority there.

    BakeryMulti-processOptimization.png
     
    guycalledfrank likes this.
  7. Enigma229

    Enigma229

    Joined:
    Aug 6, 2019
    Posts:
    135
    guycalledfrank likes this.
  8. MiragentStudios

    MiragentStudios

    Joined:
    Jun 14, 2022
    Posts:
    2
    Hello All,

    I've been struggling with this for ages now. I've purchased bakery and my baked shadowmaps look like boiled dog water. Shadow and light falloff is HORRIBLY pixelated, and awful banding. I'm really not sure what I'm doing wrong. but here are some screenshots, including my light/bakery settings.

    I'm sure the resolution is contributing to my EXTREMELY long bake times. I think at this point the built in Unity lightmapper looks better and does it faster for me :(. What can I do to fix this?

    [pixelated with bad banding]



    [SETTINGS]
    upload_2023-4-25_0-7-12.png
    upload_2023-4-25_0-8-44.png
     

    Attached Files:

  9. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    I think it should work if you just put it to the folder where other shader graphs are (I hooope it will resolve GUIDs for subgraphs and code includes... if not, I can send the whole unitypackage).

    Looks correct.

    :)

    Nice one, thanks! Still there are probably some platforms that don't support > 3.0? Like some ancient mobiles? Or basically WebGL 1.0? (Apple added (?) support for 2.0 fairly recently; I didn't update my iOS for like a year, and it doesn't run 2.0 at all).

    Thanks!
    That's pretty interesting. On a single GPU of course running multiple instances of ftrace would just cause cross-slowdowns and bad memory usage, but in your case maybe it's worth it.
    All light sources can be safely computed in parallel, but you can't do it for GI. At best you can parallelize different lightmaps for every bounce, but wait for them before going for the next bounce (but that's still something).
    Area lights/Light meshes (if you have a lot of them) are the first long-hanging fruit. Bakery should be able to run many of them in one go (like it already does with points/spots), not even requiring running a ftrace job for each, so that's something I should do first. Do you have many light meshes in your scene?

    It's weird the 2nd GPU is not doing anything at all though... OptiX could previously parallelize processing across multiple GPUs, but possibly it's not as trivial for RTX-style tracing.
    However, it is possible to force a particular GPU for every ftrace launch. If you can indeed handle multiple instances running, it is possible to spread them across GPUs (you can try changing the deviceMask property in ftRenderLightmap.cs to see if it works as it should: 1 is your first GPU, 2 is your second, 0xFFFFFFFF is "use everything available"; currently the property is global and is written to the shared settings file),.
    You can reply me in DMs or via email - it's easier to keep track of the issue this way, and maybe you could run some performance tests if I add any related changes :)

    Yes, the door needs some volume-supporting shader. It also should not cast its own baked shadows (cast shadows = off). Volume can be placed anywhere, but cover the area around the door with good enough voxel density.
    That should be enough :)

    That's just mobile texture compression, see this, there are some hints: https://geom.io/bakery/wiki/index.p...id_project.2C_and_lightmaps_don.27t_look_good
     
  10. forestrf

    forestrf

    Joined:
    Aug 28, 2010
    Posts:
    230
    Yes, I myself own a laptop which supports GetDimensions with DirectX but not with OpenGL as it doesn't support
    #pragma target 4.5
    . I had to move the contents of the pass to a separate hlsl file, replace it with 2 passes instead of one, and had the first pass contain
    #pragma target 4.5
    while the second one had no pragma target.
    Now my laptop ignores the first pass (Inside that hlsl code I use
    #if SHADER_TARGET < 40
    , I tested 35, 40 and 45 and the minimum target that generated the correct opengl code for GetDimensions was 40) while my main computer and even my phone (a recent good Android one) running WebGL 2 use the first pass.

    May not be practical, at the very least it's annoying, but I still wanted to report it.
     
    guycalledfrank likes this.
  11. Enigma229

    Enigma229

    Joined:
    Aug 6, 2019
    Posts:
    135
    How can I get the URP shader(s) to not look so bright compared to URP Lit version?

    URP Lit shader with PBR textures applied: upload_2023-4-28_14-51-5.png

    BakeryURPSHSpecGraph with same PBR textures applied:
    upload_2023-4-28_14-52-6.png
     
  12. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    Unity_ZKpSBHiNDb.png

    I keep on getting weird colour smears around the seams. How can I avoid this?
     
  13. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    @dock Could be compression artifacts. What if you...
    • set
      Lightmap Encoding
      to
      High Quality
      in the
      Player Settings
      ?
    • select your lightmap assets and set the texture compression to
      High Quality
      or
      None
      ?
    Do these color spots go away then?
    -
     
    guycalledfrank likes this.
  14. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    The 2nd one looks like it's not using Metalness. Make sure that your metalness value is > 0 and your metalness map is not black.

    Exactly. Plus:

    - if you're on Mobile, make sure you're using high quality compression like ASTC: https://geom.io/bakery/wiki/index.p...id_project.2C_and_lightmaps_don.27t_look_good

    - As a side effect, Backface GI = 1 and "Denoise: fix bright edges" can help with lightmaps being more compression-friendly: https://geom.io/bakery/wiki/index.p...oduces_bright_edges_around_geometry.2Fshadows
     
    Mauri likes this.
  15. Soul_Animation

    Soul_Animation

    Joined:
    Jan 26, 2021
    Posts:
    6
    Hey guys,
    I seem to be having an issue that I was hoping to get some help with.
    I've been trying to work this out on the discord but haven't managed to get a reply unfortunately.
    Basically, our project spawns in entire chunks of a level as prefabs these prefabs are using the lightmapped prefab script and they are working great, the baked lighting looks fantastic. However, since large portions of these prefabs are procedural I also need to work out dynamic lighting within the prefabs. I have been using light probes and they bake perfectly within the scene that I am baking the lighting in, but when I instantiate the object at runtime the light probes aren't working. I did try to wrap my head around bakery volumes, but even after reading the documentation, I don't really understand how they work.
    Any ideas as to how to light the non-static objects would be greatly appreciated!

    Including some picture examples

    This is the prefab in the scene it is baked in.
    in baking scene.png

    And this is the prefab when it is Instantiated
    Prefab.png
     

    Attached Files:

  16. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Hi Frank

    I have bad news.. the bug came back again. :(:(

    I just opened the editor and discovered all the lightmaps have blasted out to white. It was fine last night before I went to bed. :oops:
    upload_2023-5-7_14-16-5.png

    Is there some .log I can send you for you to check out?

    One thing that may or may not contribute to this:
    • I back up my project to a .zip every night.
    • To reduce the .zip file size I move the LIBRARY folder to another directory, outside the Unity project folder.
    • Would this be causing some decoupling of bakery file connections?
    I upgraded from 2021.3.15 to 2021.3.24 -- both versions of the editor ran into this lighting bug.

    This is the version I have of Bakery. And also there is the Github update. (Where the lightmaps would disappear upon PLAY mode)



    I also sent you a DM regarding this.

    Thanks for your help. :rolleyes:
     
  17. kevingaleano

    kevingaleano

    Joined:
    Apr 11, 2022
    Posts:
    4
    Hello!
    We are using unity 2022.2.16f1 and URP, and it looks like Unity renamed sampler_MainLightShadowmapTexture to sampler_MainLightShadowmapTexture, which broke some graphs.
    I fixed that by renaming the parameter, and have SH working, but I try to use MonoSH, and I get this error:
    upload_2023-5-10_15-57-50.png
    Same error, but this time its a Bakery parameter issue, and I don't know how to resolve that.
     
    Last edited: May 10, 2023
    guycalledfrank likes this.
  18. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    So yes, unfortunately Unity's light probes cannot be moved after they're baked, the probe positions are always static.
    Volumes don't have this limitation. I highly recommend taking a look at my example_volumes_advanced scene as an example of using multiple volumes (it has even movable and switchable ones). The only problem is the actual process of applying volumes to object shaders. It can be done in many different ways; in the example scene I use PhysX triggers to trigger volume change on the object; however, if you have many non-moving probe-lit objects, you can just loop over them in a script and apply the volume directly. Basically all you need to do for every object inside a volume is:


    // vol is the BakeryVolume object
    // mr is the MeshRenderer object

    var mb = new MaterialPropertyBlock();

    // Mandatory volume parameters
    mb.SetTexture("_Volume0", vol.bakedTexture0);
    mb.SetTexture("_Volume1", vol.bakedTexture1);
    mb.SetTexture("_Volume2", vol.bakedTexture2);
    mb.SetVector("_VolumeMin", vol.GetMin());
    mb.SetVector("_VolumeInvSize", vol.GetInvSize());

    // Optional 4th texture (only used if "Compress volumes" is on)
    if (vol.bakedTexture3 != null) mb.SetTexture("_Volume3", vol.bakedTexture3);

    // Optional volumetric shadowmask
    if (vol.bakedMask != null) mb.SetTexture("_VolumeMask", vol.bakedMask);

    mr.SetPropertyBlock(mb);


    There is no universally good way to apply volumes to different objects, since I can't make it a direct part of the engine. You can just set them directly or use box-triggers or just any other shapes, etc... but in the end a volume is just a bunch of textures and vectors that you can set to a Material/MaterialPropertyBlock/globally.
    Hopefully this helps; if it doesn't DM or email me directly, and I can help you with a tailored script for your project :)

    I saw your DM and answered there :oops: Seems like you have some weird LightingDataAsset used in the scene...

    upload_2023-5-11_19-57-2.png

    ... but seriously indeed, it broke on the newest URP :(

    It seems they got rid of the sampler_MainLightShadowmapTexture and use sampler_LinearClampCompare now. Makes sense if they're moving from specific texture-bound samplers to a fixed set of general-purpose ones.

    I've updated the URP graphs with the fix: https://drive.google.com/file/d/1kutq2zwyOGhSw79_rtZNeW5cFOLWzuVr/view?usp=share_link

    (Updated the main wiki page as well)
     
  19. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    133
    • Baking gets stuck in the final step when I set Color file format to Asset.
    Project Settings.png Bakery Settings 01.png Bakery Settings 02.png.png Bakery Settings 03.png

    • Also, is Mono SH supposed to be this "grainy"?
    Unity_il4KlhcQOS.png
    Edit: (Worked around it by overriding all L1 maps import settings. It would be nice to be able to set these settings by default from Bakery though.)​

    • Also, how come baking using Mono SH results in 10MB of lightmaps and SH results in 6.7MB in my test scene (according to Unity's lighting tab). I thought Mono SH was supposed to generate less data?
    (Checking the actual size of the files in windows shows that SH indeed generates more data than Mono SH, so I am not sure what is going on here. I guess Unity's lighting tab doesn't know how to interpret what Bakery is doing and is reporting wrong numbers?)
    Unity: 2021.3.25f1
    URP: 12.1.11
    Bakery: 1.9501
     
    Last edited: May 14, 2023
    guycalledfrank likes this.
  20. unity_48146ADA5C9FA33F0A59

    unity_48146ADA5C9FA33F0A59

    Joined:
    Aug 24, 2022
    Posts:
    4
    Hi . can this plug in support mesh baker plug in? Thank you for response
     

    Attached Files:

  21. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Ouch... thanks for reporting! Fixed it, can you update via the patcher and try it now?

    Hmm... I think that's what "High quality directions" should do. But also set "Compress Lightmaps" to "Force compress" in case you already have lightmaps from previous bakes. By default, Bakery will not change compression settings on existing files (that's what "Compress but allow overriding asset" for), but "Force compress" will.

    Yes, exactly. Full SH maps are not tracked, Unity doesn't really recognize them as "lighting". It's better to measure it with the memory profiler :)
     
    Bezoro likes this.
  22. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Hi! It should work, I'm pretty sure. Just make sure you force it to generate new lightmapping UVs (I'm not sure what to look for on the screenshot - is UI supposed to be like that?...)
     
  23. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Hi Frank

    Unity 2021.3.24

    My brain is a bit foggy from working all day.. but please find a recap of the bugs. I also sent you a ZIP with a couple of movies showing what I pressed. :)
    • The lighting data asset is not linked to the "real" lightingdata file, which is called (World1Level0_A_371857150_probes)
    • Lightmaps and lightingdata seem to lose connection with the scene. I have to rebake the whole scene again from scratch. None of the lightmaps remain baked with the mesh.
    • Can't clear the bakery files. I sent you a movie.
    upload_2023-5-22_22-13-56.png

    upload_2023-5-22_22-14-9.png

    These 2 red errors popped up one time. I haven't seen it since a week ago. Not sure what it is about. Maybe it can help? :oops:

    upload_2023-5-22_22-16-5.png

    upload_2023-5-22_22-15-54.png

    Thanks again for your help
     
    Last edited: May 23, 2023
  24. ToastyJ

    ToastyJ

    Joined:
    Oct 8, 2020
    Posts:
    11
    Hi, we are using a custom shader on the Standard / built-in pipeline, RT Preview is not picking up the textures so everything is white.

    How do we tell The Bakery RTPreview to see/ hook into our shader?

    Additionally to use gradients instead of skybox with the Skylight, I'm assuming the only way is to use a custom gradient texture?

    Thanks!
     
  25. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Hello, is it possible to make Surface Shaders that are compatible with Bakery Volumes? All I saw was a modified Standard Shader, but my game relies heavily on custom Surface Shaders
     
  26. ToastyJ

    ToastyJ

    Joined:
    Oct 8, 2020
    Posts:
    11
    I've set the lightmaps to generate 4k maximum and minimum but its still creating loads of 1k maps?
    Is this something that happens due to a setting somewhere or possibly a bug?
    upload_2023-5-29_16-28-49.png


    upload_2023-5-29_16-27-28.png
     

    Attached Files:

  27. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Answered your DM...
    (post-2021 Unity does something weird with LightingData - some test project/package would help a lot).

    Answered your (probably) e-mail...
    Copying, just in case:


    RTPreview "sees" everything exactly as the lightmapper, meaning that even in lightmaps the object will be bouncing white lighting (in this sense it's pretty useful for material debugging).
    Bakery uses the Meta Pass of the material, if present; if it doesn't have it (e.g. an Unlit shader without the Meta Pass explicitly defined), it'll try to use standard texture names, e.g. _MainTex, _BaseMap, etc: https://geom.io/bakery/wiki/index.php?title=Manual#Albedo_and_emission
    Amplify (especially if it's generating surface shaders) should automatically provide you with a correct Meta Pass, so I'm not sure why it doesn't work exactly. Note that if your object has "scale in lightmap = 0" or "receive GI = light probes" or is baked per-vertex, the albedo/emission will have only one unique color per vertex (might be related if the object is just a big cube with white color at corners).
    I don't know the complexity of your shader, but it also might be possible that it's using e.g. some screen-space textures (screen color, screen depth), that are not mapped correctly in the Meta Pass?
    You can send me the shader for testing (note that I don't have Amplify, but I can take a look at the final/resulting shader file).


    Yes, but it's easy to auto-generate, if you can make a gradient skybox in Unity with any existing skybox shader: https://geom.io/bakery/wiki/index.p..._use_Skylight_with_a_procedural_sky_shader.3F

    It's tricky, because AFAIK Surface shaders don't (?) allow overriding GI.
    But you can set 0 to Occlusion to get rid of existing GI and output volumeGI * albedo to Emission instead.

    To compute this volumeGI, you can take a look at Bakery.cginc, anything that's under "BAKERY_VOLUME".

    I've attached an example surface shader for you :)

    Hmmm that shouldn't happen :eek:... asked you for a little test project via email to debug.
     

    Attached Files:

    hungrybelome likes this.
  28. rtx89

    rtx89

    Joined:
    Jul 12, 2020
    Posts:
    13
    Hey Mr. F!

    I just wondered if you ever investigated this? Being able to bake light probes with sector bakes would be such a huge gain for Bakery.

    My scene has grown to a size where attempting a full bake just for light probes becomes a really huge task. I go through and strip out lightmap groups from game objects, and add higher-level lower-res groups to squish lots into one low-res lightmap. Then I go through and disable lots of objects that aren't very important for probes. Once I finally get my scene to a state where "Exporting scene - preparing..." doesn't hang forever, it bakes and I then have to go through and add all of my original high-res lightmap groups again, and bake each sector one by one again.

    And then I spot an issue with one of the probes and need to do the whole process over again. It's really painful and time-consuming.

    It would be so awesome if one of the following were possible:

    1) The most ideal option. Have Sector bakes optionally bake light probes. This would be amazing and a game-changer for the workflow.

    2) Let Render Light Probes work with L1 light probes - ideally I would press this button and the full scene would render, but only light probes would be updated, no lightmaps would bake. In reality if I press this, I get the message "Scene has updated since last full bake, please full bake".

    Something like this would help me and @Enverex along with so many other users so much.

    Cheers!
     
    Enverex likes this.
  29. egutentag

    egutentag

    Joined:
    Nov 27, 2020
    Posts:
    14
    When clearing out the cache some levels where added black artifact and need to re bake.
     
  30. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    133
    How do the lightmaps generated by Bakery get stored and loaded? Does it just let Unity handle that part as it normally would, so they are tied to the scene they were baked from and are always in memory as long as the scene is loaded?

    I would like to create a streaming system where you wouldn't need many additive scenes. Instead you would only need one and Addressables async loading would load everything as prefabs and they would get instantiated in a timesliced way to ensure there are no performance spikes.

    I am hoping that i could stream the lightmaps as needed with the same system, rather than having them all loaded all the time. I hope that makes sense.
    Is there some API I could use or am I out of luck?
     
  31. roundyyy

    roundyyy

    Joined:
    Dec 23, 2019
    Posts:
    112
    Hello. Is there any reason why Terrain holes causes these artefacts? Terrain optimization is off, newest patch is applied
    Also when I check "Hole filing" it fails to create atlases.
    Thank you

     

    Attached Files:

  32. EdEddnEddy

    EdEddnEddy

    Joined:
    Sep 15, 2015
    Posts:
    16
    Hello,

    I'm trying to lightmap a large scene for an Oculus Quest game (standalone) and need some help/tips. To reduce the resulting texture size and lightmapping duration I've chosen low quality settings for baking:

    - Render mode: Full Lighting
    - Texels per unit: 6
    - Max resolution: 2048
    - Bounces: 5
    - Samples: 20
    - AO: off
    - Fix UV seams: on
    - ...the rest use default values

    Using this configuration I get results with quite a few artifacts. The issue is that they're really rough/jagged. Worst-case, I want these artifacts to be blurry as in some cases they work with the style I'm going for. What settings could I play around with to reduce the jaggedness of such artifacts or to completely eliminate them?



    Additionally, I'm currently not sure how to handle water in my scene. I want to cast static shadows on the water, however since the scene is large, I only included the playable area in GI. By doing so however, the water that is baked is really noticeable. What can I do the make the seam invisible (in this image I'm using Simple Lit Shader from URP)?


    Update
    Adjusting the Shadow Spread on Bakery Direct Light worked for me. 0.08 Shadow Spread with, 12 Texels Per Unit.

    The seam Issue was amended by placing multiple lightmapped (lower res) water planes around the main plane in the play area.
     
    Last edited: Jun 4, 2023
    guycalledfrank likes this.
  33. Sisay

    Sisay

    Joined:
    Dec 6, 2012
    Posts:
    57
    dont work in unity 2023(latest patch)
     
  34. P3ndragonLLC

    P3ndragonLLC

    Joined:
    Sep 19, 2019
    Posts:
    99
    Hello, I'm having a problem with opening BakeryPreview. I click open preview (render in Scene View is unchecked) and it runs a few processes, but then instead of being a window I can see, it's just a blank page that can't be scene, it just sits in the background and doesn't respond. I can use the Close Preview button, it works, but the same thing happens.

    upload_2023-6-3_17-6-19.png

    and then

    upload_2023-6-3_17-6-40.png

    This is the settings I'm trying to use:
    upload_2023-6-3_17-7-6.png

    Thanks,
    Scott
     
  35. P3ndragonLLC

    P3ndragonLLC

    Joined:
    Sep 19, 2019
    Posts:
    99
    Hello again :)

    I'm also having an issue getting Bakery to light up the same static objects as the built-in light mapper. Bakery looks like:
    upload_2023-6-4_0-50-41.png
    vs built in:
    upload_2023-6-4_0-51-4.png



    Any ideas what I could look into?
     

    Attached Files:

  36. syros

    syros

    Joined:
    Oct 16, 2012
    Posts:
    3
    Hi, is there any guide on how to use compressed volumes? what I need to do to make the compressed volumes work? I have costume shaders so I am tweaking my shaders like attached image.
    Its ok with uncompressed but when I tick the compress volumes in the bakery , nothing looks good according to volumes, any hint will be super appreciated, cheers \m/
     

    Attached Files:

  37. egutentag

    egutentag

    Joined:
    Nov 27, 2020
    Posts:
    14
    I not sure why this happens, i baked the scene, all good, didn't worked on other scenes, bake, clear cache a few times, then after a few days i see this black artifacts that wasn't there.

    upload_2023-6-5_14-53-19.png

    I think that baking with object from other scenes ruin the bake, this is a very big bug.
    Please help.
     
  38. HunterAhlquist

    HunterAhlquist

    Joined:
    Oct 6, 2013
    Posts:
    132
    are eGPUs supported? I have a 3070 in a Razer Core X Chroma and the bake progress just sits at 0%. Seems like the process isn't even starting...

    Never mind, turns out I had terrain optimization enabled which is not supported, the message saying that was behind all windows for some reason.

    But now my issue is that my 3070 eGPU is like 3 times slower than my Laptops 3050 Ti.
    Is this due to limitations of Thunderbolt and eGPUs in general, or is it a problem with Bakery?
    The same scene, same settings, RTX mapping on:
    eGPU: ~30 seconds
    dGPU: ~10 seconds
    Does this sound right? I figured that an eGPU would be fast because it's not real-time anyway, but I guess it is shuffling textures back and forth? idk, I'm about to return my eGPU setup lol
     
    Last edited: Jun 13, 2023
    guycalledfrank likes this.
  39. HunterAhlquist

    HunterAhlquist

    Joined:
    Oct 6, 2013
    Posts:
    132
    Last edited: Jun 13, 2023
    guycalledfrank likes this.
  40. AndrewCzarnietzki

    AndrewCzarnietzki

    Joined:
    Jul 23, 2013
    Posts:
    189
    We love Bakery, generates great lighting fast!

    Does anyone know if BakeryVolumes work with WebGL currently? We have a WebGL2.0 project, which should support 3d textures, but it doesn't appear to be getting correct results (one asset is just lit from environment, the other some weird bights and darks depending on angle). If it is supported, is there anything we have to do to enable it / get it working? This is on Unity 2022.1.4f1 / URP 13.1.8
     
  41. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    OK, I've just added it!
    The workflow is following:
    - Put LightProbeGroups as children to BakerySector objects.
    - Enable this checkbox:

    upload_2023-6-15_0-16-42.png

    - Use L1 light probe mode
    - Render the sector

    It will initialize all light probes in the scene, but only update those in the sector hierarchy. Other probes will remain unchanged, so rendering each sector will eventually update all probes in the scene.

    Can you update via the patcher and try it?

    (To be continued tomorrow - I'm falling asleep)
     
    rtx89 likes this.
  42. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Can you elaborate?

    Bakery creates an invisible scene object called !ftraceLightmaps, in which the renderer/lightmap references are stored on a script (as well as current render settings). It works similar to this: https://support.unity.com/hc/en-us/articles/206869046-Using-external-lightmaps-in-Unity-5-0
    As it's a normal Unity script referencing normal Unity assets, they will be in memory when the scene is loaded.

    Hmm... well you can of course process my object and convert it to any data that you can use for streaming.
    Also if you decide to use my Lightmapped Prefabs, then each prefab stores its lightmap data on an object inside itself, not bound to any scene. Maybe you can bake everything as such prefabs and then just put them to Addressables.

    Hmm feels like the terrain is clipping through the tunnel?
    I'm assuming you're using painted terrain holes? These should work... unless it's HDRP and something broke there again. What is your render pipeline?
    Hole filling is unrelated, but how does it look when it "fails to create atlases"? Is there any error message?

    The skewed texels are not great, but should work... does the rock have double-sided faces by any chance? This would prevent the leak fixing algorithm from knowing where is the front/back face. If you can send me a little test scene for debugging, I can check why it happens and how to fix it.

    Oh, you solved it :)
    Great idea with multiple water planes!

    Is it already out?... (in a non-beta state?)
    Unity's "latest release" points to 2022.3.1 for now...

    Weird. Does it happen with my example scenes too? Is there anything specific about your scene that causes it?
    Also can you check .ftracelog.txt after an unsuccessful preview run? (last ~50 lines at the bottom should be relevant).

    I suspect the black objects were actually probe-lit and/or don't have lightmapping UVs? Did you render probes too?
    You can also try clicking "Update skybox probe" in case those objects were lit by the main global probe.
    As always, you can send me any unitypackages/small test projects for debugging and I can check/fix the cause (but above are my primary suspicions).

    From the screenshot it's not clear what render pipeline you're using.
    For URP, I added the compressed volume support recently, the latest patched shader graphs can be always found here on the main page: https://geom.io/bakery/wiki/index.php?title=Bakery_-_GPU_Lightmapper
    For HDRP... for the time being and for reasons unknown I'm unable to make it work (and HDRP doesn't seem to be aimed at performance anyway).

    Can you explain the issue step by step please?
    In case it's related to baking the same object in multiple scenes with UV adjustment enabled: https://geom.io/bakery/wiki/index.p..._in_one_scene_breaks_its_UVs_in_another_scene

    That's quite interesting. My only vague experience with eGPUs is testing my friend's laptop once, and I remember his 1080Ti was somehow comparable to a normal PCI-e desktop 1060... so it might be possible (although that's quite a difference!)
    Perhaps the RAM-VRAM bottleneck gets worse? You can try increasing Tile Size to the max, as it will reduce RAM-VRAM communication and will do more GPU work in one go. I wonder if it'll make any noticeable difference.

    Ah, interesting. I don't have this exact version, but 2021.3.6 seems to work with Subtractive on DX11. Judging by the thread looks like some internal Unity bug indeed :eek:
    Does it happen for you on my example_subtractive too?

    Thanks! :) WebGL 2 itself supports the formats used for volumes, but I didn't test Unity WebGL builds. Does it look broken right in the editor or only in a build? Do you use Compressed Volumes? (probably should try without first)
     
    syros likes this.
  43. Sisay

    Sisay

    Joined:
    Dec 6, 2012
    Posts:
    57
    well, today it came out :D
     
    guycalledfrank likes this.
  44. HunterAhlquist

    HunterAhlquist

    Joined:
    Oct 6, 2013
    Posts:
    132
    Unfortunately Tile Size didn't make much of a difference, however I did discover that Windows randomly picked between my dGPU and eGPU between each batch which slowed it down a lot. Disabled my dGPU so it's forced to used the eGPU and that seemed to reduce the bake time by about an hour on my most busy scene.

    dGPU: 11270.167 seconds, 3 hrs 7 min 50 sec
    eGPU: 7863.14 seconds, 2 hrs 11 min 3 sec

    It's for sure faster now, but I wonder how fast it would be if I just made a barebones rig with the card and used Bakery server.

    It doesn't, but maybe it's related to scene complexity, or how my scenes are set up. But on Vulkan, and DX11, I always crash. DX12 has no problem, so I can just use that for editor purposes until unity fixes whatever is going on.
     
    guycalledfrank likes this.
  45. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,671
    Woah. Does it mean it tried to use the dGPU for baking, not just other apps?
    You can try forcing your eGPU and prevent dGPU from being used. Check .ftracelog.txt, on each run it logs the GPUs it can use, e.g. "Device 0: NVIDIA GeForce RTX 3070", "Device 1: ..."... then in ftRenderLightmap.cs there is this line:

    const uint deviceMask = 0xFFFFFFFF;


    It's technically a bitmask. But you can just force it to e.g. deviceMask = 1 to use Device 0 or deviceMask = 2 to use Device 1.
     
    HunterAhlquist likes this.
  46. Enverex

    Enverex

    Joined:
    Jul 6, 2019
    Posts:
    76
    Amazing, thanks. This makes my life infinitely easier. It breaks compatibility with Magic Light Probes but I can live with making probes manually in future if I can do this instead.

    Seems to work for me so far with my testing.
     
    guycalledfrank likes this.
  47. AndrewCzarnietzki

    AndrewCzarnietzki

    Joined:
    Jul 23, 2013
    Posts:
    189
    Thank you for the reply!

    This is the volume setting:

    upload_2023-6-16_15-43-7.png upload_2023-6-16_15-43-44.png

    So looks like yes, compressed volumes are on. Would it make sense to try without that?

    In the editor (shader set to only display the output of the volume lighting), this is what it looks like: upload_2023-6-16_15-44-41.png

    Where in a build, this is what we see instead:

    upload_2023-6-16_15-45-3.png

    The volume is still applying _some_ light, but it gets weird. For example, this controller is lit with the volume and it looks normal in the editor, but in WebGL it looks like this:

    upload_2023-6-16_15-45-56.png
     
  48. Enverex

    Enverex

    Joined:
    Jul 6, 2019
    Posts:
    76
    I've been having an issue since the update where bakes will just hang indefinitely. Checking the log shows these errors just going on seemingly forever:

    Code (CSharp):
    1. Resource ID out of range in GetResource: 1050533 (max is 1048575)
    2. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    3.  
    4. Resource ID out of range in GetResource: 1048585 (max is 1048575)
    5. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    6.  
    7. Resource ID out of range in GetResource: 1051749 (max is 1048575)
    8. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    9.  
    10. Resource ID out of range in GetResource: 1050321 (max is 1048575)
    11. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    12.  
    13. Resource ID out of range in GetResource: 1049249 (max is 1048575)
    14. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    15.  
    16. Resource ID out of range in GetResource: 1050429 (max is 1048575)
    17. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    18.  
    19. Resource ID out of range in GetResource: 1050289 (max is 1048575)
    20. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    21.  
    22. Resource ID out of range in GetResource: 1049399 (max is 1048575)
    23. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    24.  
    25. Resource ID out of range in GetResource: 1049503 (max is 1048575)
    26. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    27.  
    28. Resource ID out of range in GetResource: 1051119 (max is 1048575)
    29. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    30.  
    31. Resource ID out of range in GetResource: 1049037 (max is 1048575)
    32. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    33.  
    34. Resource ID out of range in GetResource: 1050847 (max is 1048575)
    35. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    36.  
    37. Resource ID out of range in GetResource: 1051165 (max is 1048575)
    38. (Filename: c:\buildslave\unity\build\runtime\gfxdevice\GfxResourceIDMap.h Line: 109)
    39.  
    ... and I have to kill Unity, which is obviously bad.
     
  49. EdEddnEddy

    EdEddnEddy

    Joined:
    Sep 15, 2015
    Posts:
    16
    Hello,

    Currently I'm rendering lighting for quite large-ish scenes along side with light-probe rendering. When rendering light probes I'm often presented with the following error:

    Scene geometry/layout changed since last full bake. Use Render button instead.


    This is then followed by a random (I seem to get a new mesh each time) mesh with "changed" scale information. I render light probes right after rendering lights without changing anything. The error seems to appear randomly and quite often forces me to re-render the scene.

    I'm confused on what could be causing this as I'm sure that the objects don't change since I have all of them in prefabs and under Git :/
     
  50. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    77
    Hi, I'm trying to use Batch bake since we need to bake many scenes.
    I need to bake lights and light probes for ~50 scenes (and it's not the last time).

    For some reason on some scenes, the error
    Code (CSharp):
    1. ValidateScaleOffsetImmutability: scale/offset does not match on
    2.  
    gets thrown when building light probes through the batch window.

    If I do it through the editorwindow, and press Render first, and then press Render Light Probes, it asks me to save the scene, and if I click save it does not throw the error.
    Is it possible that the batch window is missing a save scene step between baking lights and light probes?

    Or is there anything else I can do to resolve this?

    edit: using Unity 2021.3.22f LTS
    edit: I think I'm experiencing the same issue as the person above, that error shows up as well, after the Validate error.
     
    Last edited: Jun 20, 2023
    EdEddnEddy likes this.