Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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,677
    So I should probably expose the parameters... in Bakery.cginc, you'll see

    #define BAKERY_LMSPECOCCLUSION_MUL 10
    #define BAKERY_LMSPECOCCLUSION_ADD -0.5


    (i.e. the result is saturate(shSpec * mul + add) * reflection)

    Does it look good if you tweak them to something different? I'll add that to the UI later then.
     
  2. rtx89

    rtx89

    Joined:
    Jul 12, 2020
    Posts:
    14
    Hi Frank,

    Thanks for all your continued work and support to Bakery. It's awesome. The Bakery sectors light probe baking you added last year has saved me tens of hours so far.

    I've had an issue for a long time now where randomly light probes will bake incredibly dark, even though they're in well lit areas and next to other probes that have no issues. It's worth noting that if I rebake, they stay dark in the same place. Moving them around a bit fixes it, but is really time consuming having to keep editing probes and rebaking and hoping it's better.

    I'm using HDRP in 2019.3.15, baking with L1.

    In the past I have partly fixed issues like this by manually editing ftAdditionalConfig.cs and changing public const float convL1 from 0.9f to 0.7f. That helps with reducing blue, dark ringing on some light probes that randomly get messed up. Most recently though I've been getting these almost pure black probes like in the attached image, where the convL1 change does nothing.



    The above screenshot is without my convL1 hack. The probes circled in red get fixed by my hack, but there's no saving the ones circled in green.

    Any ideas? Do you know what could be causing this to happen? Any suggested workarounds? Is it something even fixable at your end?

    On a sidenote, it'd be great if you know why my convL1 hack is needed, and would it perhaps be possible to expose this value in bakery preferences so I don't need to hack it back in with every update?

    An example below of what default Bakery causes all the time, and the convL1 hack fixes:


    There's a floor underneath these probes so I couldn't quite work out why these dark spots would happen. The light probe ringing option in bakery preferences doesn't seem to help with this issue either.

    Cheers!
     
    Last edited: Mar 5, 2024
    guycalledfrank likes this.
  3. Thomaster208

    Thomaster208

    Joined:
    Jun 6, 2020
    Posts:
    1
    @guycalledfrank Hello, Mr F!

    As I'm going through the forum I haven't found a solution to my problem yet - it's basically the (beveled) edges of certain surfaces that give off a shadow.

    BakingArtifact_01.png

    As for my info:

    1) We're using Unity URP - 2022.3.16f
    2) The material on the chair is a Lit material

    BakingArtifact_02.png

    3) There is one light in the room with a broad angle, covering the entire room
    4) These are the editor settings:

    BakingArtifact_03.png

    BakingArtifact_04.png

    5) Project Settings are set to default, except the "Delete lightmaps before baking", which we turn on.

    If this isn't enough info, I'm willing to give more and thank you for taking the time to address our problem.
     
  4. rtx89

    rtx89

    Joined:
    Jul 12, 2020
    Posts:
    14
    I'd recommend looking at the lightmap inspector on your game object to try to troubleshoot what the issue is.

    To me it looks like the objects aren't getting enough space in the lightmap and/or the UVs aren't perfect.

    I can see the jagged edge of an antialised lightmap on the table edge, here:



    I've had issues like this in the past and it can be fixed by making sure the edges of the UV island are perfectly horizontal or vertical. The image below might help to illustrate what I'm getting at here:



    Ideally bakery would bleed out a bit further than the UV islands to stop this from happening, which it kind of does but it doesn't always work very well, so just straightening your edges can be an easy fix sometimes.

    You could also take a look at this youtube video I posted a while back which goes into troubleshooting lightmap issues like this.
     
    Last edited: Mar 5, 2024
    guycalledfrank likes this.
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,493
    today started having this baking issue, baking hangs on this one (image below)
    still checking if removing some new models or scenes might have caused it.. but interested for any tips.

    upload_2024-3-5_15-12-50.png
    frenderlightmap.renderlightmapupdate
    waiting for user code in bakeryeditorassembly.dll to finish executing
     
  6. hadynlander

    hadynlander

    Joined:
    Jan 24, 2014
    Posts:
    41
    Awesome - that's a huge improvement! Thanks for getting on this :D
     
    guycalledfrank likes this.
  7. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,092
    Hey Frank! I'm making extensive use of bakery lightmapped prefabs, and I'm having an issue where they kind of overwrite each other?

    I keep each room prefab in its own scene, save the lightmaps to their own subdirectories based on scene name as per the checkbox, and have the atlas packer set to separate by scene.

    Still, there are some objects, seemingly random, like, a filing cabinet model, that might appear in two rooms... and when i bake one room prefab, it mottles/makes weird the lightmap on that same model in the other prefab. I'm pullin my hair out trying to figure out why, I tried lightmap groups, every different atlas packer setting, to no avail.

    Any idea why this might happen?

    EDIT: nevermind, it was adjust uv padding... which, in hindsight, makes sense :)
     
    Last edited: Mar 6, 2024
    guycalledfrank likes this.
  8. Linhmanh

    Linhmanh

    Joined:
    Mar 6, 2024
    Posts:
    1
    Hi Frank, lightmap specular can enable in bakery standard shader. How can i do that with my custom shader?
     
  9. selektah1995

    selektah1995

    Joined:
    Aug 5, 2018
    Posts:
    1
    Hey Frank & all :)
    Having super weird issues on build with bakery lightmaps, in editor everything looks wonderful but on build all the secondary UVs ( I think) sets seem to shift and move with the camera.
    Optimize mesh data is off , all asset have lightmap UVs and so on , cleared the cash and Re-baked , Reimported the bakery asset and nothing seems to help

    The weirdest thing is I found out this only happens with materials that are standard URP lit , custom Shaders work just fine (like the white building)

    Anybody has any idea what could this be??
    Thanks in advance!

    upload_2024-3-12_16-41-7.png upload_2024-3-12_16-43-33.png upload_2024-3-12_16-43-14.png
     
  10. QQZZ2023

    QQZZ2023

    Joined:
    Feb 28, 2024
    Posts:
    3
    What is the file for you and what is your email address
     
  11. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    85
    Hi, i don't know if this is normal but i was trying to bake a terrain 1050 resolution, and is taking a lot of time to bake, i was checking my gpu use while the lightmaps where baking and it looks like this, is that normal? ftraceRTX is also aways under 25% of cpu, and 0% gpu.

    Unity 2022.3.5f1
    Bakery last update
    Gpu Nvidia 2070RTX
    Nvidia Drivers : 551.76
     

    Attached Files:

  12. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Hi @guycalledfrank

    I think I found another bug, this time it's regarding cookies. Whenever I press Match real-time to lightmapped, Bakery Point Light(script) replaces it with a Cone projection instead of the Cookie texture.

    Can you please confirm if its reproducible on your end?
    Thanks again for your help!:)
    upload_2024-3-13_19-41-13.png
     
  13. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,677
    Added a little, but useful option today, which, instead of just thresholding alpha maps like cutouts, converts them to blue noise of varying density; after the denoising is applied, it basically looks like correct partial transparency, while not costing much :)





    You can try it in the latest patch.

    Nice, thanks! :)

    L1 (not even just my implementation, but in general) has nasty problems with "ringing", which are especially apparent in very high contrast areas, and HDRP typical physical light values can exaggerate that.
    They're really nicely fixed by a slight tweak in the shader. Did you try BakeryNonLinearLightProbeGraph? It's in the package, and it works way better than messing with convolution constants (the technique)
    Changing conv. constants will reduce it too, but it will also reduice the overall contrast of the probes.
    Alternatively, don't use probes (they're not a very "HD" approach anyway) and try volumes, volume-related graphs also have this trick included. You can also try using the Legacy light probe mode, it has more coefficients and is less probe to ringing, but as it uses engine rendering instead of ray-tracing, it is specifically slow on HDRP (as HDRP doesn't seem (?) to have an optimized non-main-camera rendering path; using HDRP is generally only useful if you're looking for ways to lower your performance).

    Ouch... can you send me a little test project/package? Just having one prop showcasing the problem with lighting would be enough. I'll check what's causing it and how to fix it.

    I suspect xatlas is trying to pack something for too long... does any of these tips help?
    https://geom.io/bakery/wiki/index.p...rting_scene_-_preparing.22_is_taking_too_long

    Depends on what lightmap mode you are using. If it's just from regular directional lightmaps, you can check BakeryDirectionalLightmapSpecular() function in Bakery.cginc; or unpack URP/HDRP packages and look for DirectionalSpecular_float() in BakeryDecodeLightmap.hlsl.
    You can just use these functions in your code, given you can provide lightmap UV, world normal, world-space view direction and surface smoothness to them.

    That's crazy :D
    Not even sure. Can it be related to SRP batching, or instancing? Something else that's compatible with Lit but might not be with a custom shader?... these shouldn't be a problem though. Really confusing. Can you try it in an isolated project, with like one simple model? If you can reproduce it there, send it to me and I'll test.

    It's there: https://assetstore.unity.com/publishers/37453

    Using RTX mode on 1050 won't give you much; driver can emulate it, but there's no real RT hardware.
    I don't know how it can be at 0% GPU though :D Perhaps the measuring method is wrong.
    Can you try increasing Tile Size and check if it makes a difference?

    Hmmm it is not. It will set it to Cone when setting "Match lightmapped to real-time" though, the other way around.
    The reason for that is that Bakery's "Cookie" mode can reproduce the built-in spotlight (unattenuated texture projection), and "Cone" reproduces the original URP spotlight (inner/outer angle). HOWEVER, I might be wrong, but URP didn't (?) even have its own cookie texture for some time? And so there's no fully compatible mode in Bakery which has BOTH the cookie and inner/outer angles. It matches to one of these. I should actually implement a combined mode.
     
    Last edited: Mar 14, 2024
    rtx89 likes this.
  14. rtx89

    rtx89

    Joined:
    Jul 12, 2020
    Posts:
    14
    Hey Frank, thanks for the reply.

    I'm unable to use bakery shader or bakery volumes, as I build mod maps for an existing game and neither work when I build the scene and open it in the game.

    I have tried legacy, but it takes an absolute eternity to do anything for a single small sector, and the probes it bakes are all nuclear white and unusable anyway. L1 for the most part does what I need though, except for when they bake black.

    I will look into non-linear light probe graphs (but cannot find any mention of them in the HDRP shader graphs?), which could fix the ringing on the probe-lit objects in my level if I implement it into my shaders. I don't have the ability to alter the materials or shader used by the characters in the game though, so the ringing would still be visible on them without the convolution hack.

    I have noticed the patterns with the black probes and it's usually when they are placed near corners of cubic geometry, and they seem to line up on the Z-axis but not the X-axis. I'll drop a streamable video below to better show what I mean.



    Ideally I'd love a way to be able to edit and delete problematic baked light probes. Could I possibly write a script that updates the light probe data array?

    Do you have any idea exactly why some probes bake extra dark in spots where they shouldn't? The lightmaps themselves are fine and don't give any hints about what could be causing them.



    cheers :)
     
    Last edited: Mar 14, 2024
    guycalledfrank likes this.
  15. rtx89

    rtx89

    Joined:
    Jul 12, 2020
    Posts:
    14
    I decided to look into this further since your last reply Mr F, and it's actually nothing to do with geometry.

    Check out these probes in an open area, with only a tiny cube being baked off in the distance:



    Weird how they all line up right? Their X-axis positions were: 116.5976, 97.39352, 23.19919

    Could this be related to the "Skip unused light probes when rendering sectors" commit and the SnapProbePos function?
     
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,677
    If your have an older version (and unpacked Bakery_ShaderGraphHDRP.unitypackage) and can't find them, the new graphs can also be downloaded from the main page here: https://geom.io/bakery/wiki/index.php?title=Bakery_-_GPU_Lightmapper

    Weird! Does it happen if you replace buildings with e.g. cubes? I'd really like to test this or a similar scene myself. Feels like I should do a big rehaul for the probe system (even though I don't like using it myself), and it would be a nice stress test for it.

    You can! The values are stored here: https://docs.unity3d.com/ScriptReference/LightProbes-bakedProbes.html

    Oh, wow. Very possible actually. How many sectors are there? Can you send me that empty HDRP scene? :D

    I tried with the coordinates you mentioned, and it worked OK... so something is more complex going on there

    upload_2024-3-14_12-35-58.png
     
  17. erfanshshsh

    erfanshshsh

    Joined:
    Nov 13, 2022
    Posts:
    2
    Hello frank.
    I am trying to use bakery volume inside a prefab.
    but when i instantiate the prefab the object with compatible volume shader can not pickup volume data.
    is this a possibility?

    on the other hand it can be outside of the prefab but i need to somehow update the volume data transformation.

    my game is an endless runner type of game and same prefab is just duplicating as the player moves forward, so do you see this as a possibility?
     
  18. jack_bird

    jack_bird

    Joined:
    Feb 1, 2024
    Posts:
    1
    Hi there,

    Our project uses a custom renderer that requires an export/preprocessing step that repackages the geo and textures into a custom format. In cases where all of the following are true:
    • The GLB asset does not have any lightmap UVs
    • "Generate Lightmap UVs" is turned off
    • Bakery is set to unwrap/adjust UVs using XAtlas
    The resulting lightmaps look good in the Unity Editor and the UV sheets are much more efficient than what "generate lightmaps" produces, but our exporter can't find the UV data and thinks the second UV channel is empty.

    How can we access the UV data generated by Bakery in order to pass it along to our exporter?
     
  19. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,677
    Do you use some kind of trigger or other code that applies non-global volumes to objects? Check the scripts in my example_volumes_advanced scene.

    When "Generate Lightmap UVs" is off, Bakery will not attempt to re-unwrap the UVs. If the original model doesn't have UV2, it will just use UV1 instead, so try that.
     
  20. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    *update*
    hi @guycalledfrank

    I updated via Github and got a new bug. The lightmaps disappear during play. :oops:
    ezgif-1-abe9814828.gif

    I DM'ed the project to you.

    Thanks for the help! :)

    Hmm maybe Unity added the URP cookie after you finished the bakery light tools.

    Whenever you have time , it'd be appreciated if the cookie could be auto applied when we "Match lightmapped to real-time" for a URP light. :rolleyes:

    For your reference, here's what's happening on my end when I "Match lightmapped to real-time" for both built-in and URP bakery lights.


    Built In
    Built_In.gif

    URP
    URP.gif

    Thanks again for your support!:D
     
    Last edited: Mar 20, 2024
  21. rtx89

    rtx89

    Joined:
    Jul 12, 2020
    Posts:
    14
    Hey Mr F,

    Thanks for trying that out for me. It's a bit of a tricky one to recreate, I have DM'd you here on the forums and on discord a link to an exported package you'll need to recreate the issue.

    Steps to recreate:
    1) Create new HDRP project on 2019.3.15
    2) Import Bakery from asset store
    3) Assets > Import Package > Custom Package...
    4) Open scenes/Big Apple 27 - probe test.scene
    5) Bake the sector "BLOCK 1 (1)" - my settings are RTX on, monosh, shadowmask, OID2, L1 light probe mode, distance shadowmask on.

    Something weird is definitely going on here. If I bake a sector, the issue appears. If I do a full bake, the issue disappears. If I bake the sector again, the issue remains gone. The only way to recreate it again, is to duplicate the sector/block, move it, then bake it as sector.

    So doing a full bake fixes it, but that doesn't really help me as the city I'm building is huge (1.5km x 1km roughly
    - 25 of these blocks). Completely impossible without bakery sectors and baking probes in sectors by the way, so a huge thanks for these features. Also OID2 is awesome, saves so much time compared to OID1.
     
  22. miinoy

    miinoy

    Joined:
    May 27, 2019
    Posts:
    21
    How can i use the new reflection occlusion in HDRP? It doesnt seem to work on BetterLitShaders (no option for it which isnt your responsibility of course) but with the ShaderGraph/SH it doesnt seem to be working either?
     
  23. Silentdesu

    Silentdesu

    Joined:
    Feb 20, 2020
    Posts:
    6
    Hi,

    I've clicked clear all references in Bakery infinite amount of times, cleared caches, removed bakery from a project and imported again etc. And it didn't help to resolve this problem.

    UPD:

    This popup disappears when I will use a different scene with the same setup

    upload_2024-3-18_14-8-32.png
     
    Last edited: Mar 18, 2024
  24. suzuki-tai

    suzuki-tai

    Joined:
    Nov 8, 2021
    Posts:
    7
    Hi, I have been very helped by Bakery's bake speeds.

    I am using 2022.3.21f1, URP14 and Bakery 1.96.
    There is no LightProbe in the scene, everything is sampled by Lightmap.
    This is a simple scene with just Mixed's DirectionalLight (Bakery Direct Light) and SkyLight.

    When DistanceShadowMask Mode is turned on, Bakery is observing a bug that is not working properly.
    Specifically, when out of the ShadowDistance range, it results in a LightmapSampling that covers everything in shadow.

    When the exact same lighting is used with Unity's built-in GPU LightMapper, the problem does not occur and is as intended (out of URP's ShadowDistance range is represented by a LightMap).

    Is this a known bug?
    Or is there some setting that is missing...?

    [GPULightmapper in Unity (intended behavior)]
    https://media.giphy.com/media/v1.Y2...ZfYnlfaWQmY3Q9Zw/86n5E7xdJZYxUeqN7c/giphy.gif

    [Bakery baked]
    https://media.giphy.com/media/v1.Y2...ZfYnlfaWQmY3Q9Zw/DPqqfFmHPRIZhkehm7/giphy.gif

    Thanks!
     
    guycalledfrank likes this.
  25. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,825
    Hi,

    I've tried lots of settings, and looked at the manual and troubleshooting guide, but cannot figure out how to fix this issue.

    I'm using URP, and have one directional light in my scene. The objects facing the light bake fine (I have them marked as static and the meshes have generat lightmap UV's checked), but surfaces not facing the light are dark.

    Objects facing light, look correct.

    upload_2024-3-21_21-55-1.png

    Objects on opposite side of light are very dark

    upload_2024-3-21_21-56-13.png


    Bakery Settings

    upload_2024-3-21_21-57-14.png

    Directional Light Settings

    upload_2024-3-21_21-57-59.png

    I've tried changing indirect intensity to even 100, but no difference.

    Any ideas?
    Thanks
     

    Attached Files:

  26. YigitCetinkaya

    YigitCetinkaya

    Joined:
    Jan 4, 2021
    Posts:
    9
    Hi Frank
    I have 2 problems in the URP project, I hope we can find a solution.
    When I switch between 2 scenes, the lightmap is moved to the new scene. I tried the new scene in bake and realtime, the 0th index of the previous scene appears in the new scene, what could be the reason? We load scenes with additives using the addressable system. There are 2 new scenes and there is light in only one of them. The baking process was done with a split scene. GarageLightMaps.png
    I want to use Bakery Volume. Everything works normally in your sample scene in the build-in project. When I open the same scene in the urp project, the volume does not work. BuildinScene.png
    At last , I'm asking to find out. When there is no light probe in the scene, no light data asset is created in the urp project. What is the main reason for this?
     
  27. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,677
    OK, both of these issues were fixed today and hopefully won't ever return :)

    Not there yet...

    Ouch. I wonder what actually causes it to happen in the first place? But what should help against it is:
    - Close Bakery window
    - Bakery -> Utilities -> Clear baked data -> Set dropdown to "All" -> Clear
    - Open Bakery window again

    Likely. Can you screenshot your settings (main Bakery window + light components, both real-time and baked)?

    First, don't forget to add a Skylight: https://geom.io/bakery/wiki/index.php?title=Manual#Bakery_Sky_Light
    Second, it does look like there is no GI indeed. This can be caused by shaders not implementing the Meta Pass and not using compatible texture names either. What shaders are used here? If you have RTPreview, how does it look there? If you drop any of your meshes (e.g. the billboard) into one of my example scenes (e.g. example_lights), does it bake/look fine there?

    Can you check if setting removeDuplicateLightmaps to true (instead of false) in ftRenderLightmap.cs and rebaking both scenes will resolve this?

    You need to use a specific URP graph (e.g. BakeryURPVolumeGraph): https://geom.io/bakery/wiki/index.php?title=Manual#Viewing_example_scenes_on_URP

    It is not needed for lightmaps :) Bakery stores them elsewhere (inside the scene).
     
    rtx89 and Meltdown like this.
  28. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    :rolleyes:
     
  29. RicardCG

    RicardCG

    Joined:
    Dec 12, 2017
    Posts:
    10
    I seem to be having an issue with baking. I'm running into a situation where it's preparing to export the scene indefinitely. I was able to get it working once today but afterward all it does from then on is cycle.

    Is there something in particular that can cause this to happen?

    Edit: Turns out there was some missing lightmaps from a couple static objects. Easy fix. Would it be possible to have a hard crash/fail loudly if and when this happens?
     

    Attached Files:

    Last edited: Mar 24, 2024
  30. NoxityGames

    NoxityGames

    Joined:
    Jul 1, 2018
    Posts:
    41
    Is there a Linux version of the Bakery server?
     
  31. YigitCetinkaya

    YigitCetinkaya

    Joined:
    Jan 4, 2021
    Posts:
    9
    Ekran görüntüsü 2024-03-25 122428.png

    I did what you said but there was no change. I'm not sure if this has a negative effect or not.


    TreeBakeModes.png

    In my city scene, I bake in sh mode to get specular highlights on the windows of the buildings. I got pretty good results for the buildings, but I'm having problems with some props. The props look much darker with the sh shader. We processed the MetalicSmootness maps to get reflections only on the windows of the buildings (Metallic and glossiness maps were combined, the reflections come from the map in alpha channel). This process was not performed on the props. What is the texture effect in the sh bake process?
    This can be observed more clearly in textures that require alpha clip. The alpha clip option was not available in Bakery Sh. I edited and added the BakeryUrpShGraph (I connected the basemap alpha value to fragment alpha and gave the alpha cliptreshhold a float value) but it did not affect bake. The shadows of the objects appear without clip. Should I make changes in LitBase or somewhere else?

    Bakery Volume worked as you said, but I have to combine it with the shader I use on the vehicle. How can I give volume support to the shader I made with the amplify shader editor (I tried but failed) What is the critical point that gives the effect here?
    Do you have a chance to make a video series for beginners? The package is really high-end, but it is really difficult to find and understand what you are looking for. I know you are developing your own game, you probably don't have time :)
     
  32. suzuki-tai

    suzuki-tai

    Joined:
    Nov 8, 2021
    Posts:
    7
    >Likely. Can you screenshot your settings (main Bakery window + light components, both real-time and baked)?

    Here.
    (The Directional-Light values are different, but this is because the aforementioned problem occurred after baking at Bakery, so it was fine-tuned when baked at Light-mapper in Unity.)

    On a different note, I have occasionally encountered a problem where after baking in Bakery, the Lightmap information is removed from the scene the moment it is put into playback mode, although it is not a problem in non-playback mode in Editor.

    It is not a definite problem that occurs after baking at the Bakery, but rather a feeling, but it occurs about 50% of the time.
    (Currently, there are 7 background scenes, and we have confirmed the occurrence in 4 of them.)

    However, in the scene where it occurs, unless the scene is re-baked with Unity's Lightmapper, it will occur forever...
    The same symptom occurs even after erasing and re-baking with Bakery -> Utilities -> Clear baked data, etc.

    The baking speed and results were good, but together with the aforementioned problems, it is currently rated as unworkable for production... :(
     

    Attached Files:

    Last edited: Mar 26, 2024
  33. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    I had the same problem as you.

    https://forum.unity.com/threads/bak...preview-released.536008/page-139#post-9701600

    Did you try updating your Bakery with Github?
     
    guycalledfrank likes this.
  34. Zoidberg656

    Zoidberg656

    Joined:
    Sep 26, 2018
    Posts:
    17
    So I have my entire environment in a seperate gameobject, and ALL the furniture in it's own gameobject.

    I tried using a Group component to bake all the furniture seperately to the environment to minimize light bleed from brightly lit corridors, but it only pumps out a single lightmap for all the furniture.

    Is it possible to create lightmap atlases with a Group component? Or is it in some way possible?



    These images are just showing the map. Nothing is visibly wrong in them.
     
  35. tolosaoldfan

    tolosaoldfan

    Joined:
    Sep 14, 2012
    Posts:
    100
    You saved me ton of hours of research! Thanks!!
     
    guycalledfrank likes this.
  36. tokyopop65

    tokyopop65

    Joined:
    Jan 3, 2019
    Posts:
    1
    Im sorry to ask such a silly question, but im kind of going crazy as I cant find any direct place this has been asked. What does this error mean?
    Is it referancing two objects using the same material name but in diffrent locations?

    I am having issues with high bounces (over 2) or textel (over 40) producing full black/dark bakes. but before I bother you with that(because it might be my own non bakery issue);
    I want to fix these errors. cuz theres alot of them.


    upload_2024-3-28_5-10-27.png


    ===
    heres also a referance to the "black" i was meaning
    upload_2024-3-28_5-10-45.png
    (after bake on default+suggested settings for 4080)


    upload_2024-3-28_5-11-31.png
    (via RT bakery preview on default+suggested settings for 4080)



    (after bake with only 2 bounces at 20 textels)
     
    Last edited: Mar 28, 2024
  37. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,677
    Hmmm weird. Not sure what else to suggest, that should've done the trick. Maybe it works a bit differently with addressables. If you're well within memory limits, it's not a problem, but I'd really like to take a look at this. Is it possible for you to DM me a minimal example project where the issue is reproducible?

    Possibly due to reflection probes lacking? Not sure if they're used there, but it might be the culprit. In the latest package I also have "BakeryURPSHSpecWithReflectionGraph" graph, can you check if it works similarly to URP Lit? If not, it would be great if you can send me this model in some basic lit scene for testing.

    Jeez, I should really just make one uber-graph with all possible features. It wasn't possible on early URP versions, it should be possible now.

    Metallic/roughness shouldn't affect the bake. Although due to the way Unity implements Meta Pass, highly metallic surfaces actually make the "albedo" brighter (this is from UnityStandardMeta.cginc):

    upload_2024-3-28_21-56-45.png

    If you have RTPreview, you can check how the lightmapper "sees" your objects' albedos.

    Ah yes, you just need to follow these requirements for alpha detection: https://geom.io/bakery/wiki/index.php?title=Manual#Opacity
    Namely:
    - Make sure your opacity map is either in _MainTex.a or _BaseMap.a or _BaseColorMap.a
    - Set graph to Transparent mode:

    upload_2024-3-28_22-27-51.png

    - If you use a cutoff/threshold float property, name it "_Cutoff"

    The important bit comes from BakeryDecodeLightmap.hlsl file, there is a function called "BakeryVolume_float". If you can use a custom function from a file in Amplify, just feed it the right parameters (world position and normal). There is also a more complex "BakeryVolumeSpec_float" function that computes specular from the volume as well (but needs many more parameters).

    Not at the moment :(

    I think in your case it would be really beneficial if there would be an all-in-one URP shader, so there is no need to ask how to modify it :)
    This is something I'll have to do for sure. In fact, perhaps, this/next week. Reply to this with something if you need it :D

    The Direct Light screenshot is cropped :(

    Can you try the latest patch? (as KarlKarl2000 suggested)

    Yeah, this is exactly what groups are for! 1 Group = 1 atlas. Did you actually stick a group asset into the group selector component? Can you screenshot the component?

    OK, that should be added to the docs now: https://geom.io/bakery/wiki/index.php?title=Troubleshooting#Lightmaps_disappear_on_play

    Thanks, HenryTownshend!

    It refers to the material name, saying it doesn't have the Meta Pass: https://docs.unity3d.com/Manual/MetaPass.html

    Unity and Bakery both use that special pass to get albedo/emission from the shader. If there is no Meta Pass, Bakery will attempt using standard texture names, such as _MainTex, _BaseMap, _BaseColorMap, etc:

    upload_2024-3-28_22-58-31.png

    If it can't find them by name either, then... it won't see any albedo/emission, hence nothing to bounce lighting from.

    If RTPreview sees the textures, then it's fine, and there is no problem with albedo/emission extraction.
    Then the problem is either:
    a) There is no UV2 on the scene (no "Generate lightmapping UVs" set on models?)
    b) The walls/floors are 100% metallic (no diffuse lighting visible, only specular/reflection probes).
    c) The shader is non-standard and doesn't actually have code for lightmap sampling
     
  38. ESBOWMAN

    ESBOWMAN

    Joined:
    Sep 3, 2021
    Posts:
    1
    Hey Frank,

    We have a strange issue that seems to affect only one of our machines. Three of us typically bake our game scenes. For some odd reason my PC with a 3080 GPU is resulting in a lot of fireflies on the final render. My other two coworkers however can render the same scene with identical Bakery settings and see no fireflies. This is an example of what I'm seeing after a bake. All of those spots on the stairs and random places in the scene result in fireflies.

    Have you come across this issue before? One of my coworkers has a 3070, and the other has a 2080. They both see decent results. I've also tried to update my GPU drivers to the latest studio version and still see the fireflies. At this point I'm wondering if another piece of software is causing issues with Bakery and Unity, or if there's a way for myself to clear caches and reset the plugin. I've set it back to default settings but it doesn't seem to help.

    Any advice?

    upload_2024-3-28_17-31-5.png
     
  39. miinoy

    miinoy

    Joined:
    May 27, 2019
    Posts:
    21
    Is it possible to switch out lightmaps for a light switch mechanic using the lightmapped prefabs?

    My levels are procedurally generated using prefabs for hallways and rooms and i'd like to be able to have different states for the lights (room would be entirely dark or entirely lit).

    Also i noticed the BakeryPrefabLiugthmapData doesnt exist but it mentions in the Docs that it will add it do the root.

    What is the best way to go about this using Bakery?
     
  40. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,892
    Hi! When opening a scene baked with Bakery, we're receiving "Lighting data asset is incompatible with the current Unity version because the scene it was baked for was not serialized" warning in the console. It's harmless but annoying. Do you know if it's related to Bakery and if so, how it can be resolved?
     
  41. suzuki-tai

    suzuki-tai

    Joined:
    Nov 8, 2021
    Posts:
    7
    The Direct Light screenshot is cropped :(


    Is there a lack of direct light content, or is it not enough in this scrub?
    (I think I have pasted a full screenshot of the Direct Light component at the bottom...)
    https://forum.unity.com/attachments/upload_2024-3-21_21-57-59-png.1388356/

    Can you try the latest [URL='https://geom.io/bakery/wiki/index.php?title=Github_access']patch? [/URL](as [URL='https://forum.unity.com/members/karlkarl2000.1040824/']KarlKarl2000[/URL] suggested)

    Also, @KarlKarl2000 thank you for your suggestion.
    Unfortunately, even the patch I got from the invoice number, which is on Github, does not work...
    (To begin with, checking @KarlKarl2000's comment here, it appears that the patch I applied on Github corrupted it.
    In my environment, the problem occurs in both cases.
     
  42. r8zbeh

    r8zbeh

    Joined:
    Dec 4, 2018
    Posts:
    40
    @guycalledfrank do bakery have any standalone version that can be used for non unity engine ?!
    or do you guys know any app similar to Bakery which is not dedicated to unity ?
     
  43. Minos321

    Minos321

    Joined:
    Jul 7, 2018
    Posts:
    44
    Hello! I'm running into a weird problem with emissive surfaces and I already wasted too much time trying different settings so time to ask for help :D

    So what's happening is, each time I bake, the emissive lights are very inconsistency. Sometimes some emissive surfaces don't get baked at all... For example, here's a bake with this settings:
    upload_2024-4-2_11-15-10.png

    And the same bake with much lower samples. notice how the green windows now create emissive properly:
    upload_2024-4-2_11-20-48.png

    Another bake, now the window emissive doesn't work anymore:
    upload_2024-4-2_13-13-18.png

    Same with other emissives, sometimes they work, sometimes they don't depending on the bake. Any ideas of what could be causing this?
     
    Last edited: Apr 2, 2024
  44. Minos321

    Minos321

    Joined:
    Jul 7, 2018
    Posts:
    44
    Another problem, seems related.

    One bake the skylight is not being computed at all:
    upload_2024-4-3_16-16-55.png

    Another bake where I change the "Texels Per Unit" to 2, and the sky is baked:
    upload_2024-4-3_16-18-27.png

    Then a third bake with "Texels per Unit" at 4, and the sky is gone again:
    upload_2024-4-3_16-22-17.png
     
  45. miinoy

    miinoy

    Joined:
    May 27, 2019
    Posts:
    21
    what is a good way to handle swapping out lightmaps and handling their offsets on lightmapped prefabs? Using the resources on the wiki as well as looking at some other github repos i was able to figure it out and it was working great...until i had to actually SPAWN the prefab or move it at all. Its almost like the entire lightmap in the room becomes offset by a few meters. I also noticed that since bakery uses different maps (LMA1, LMO, groups (if used) as well as maps for Spherical Harmonics) that i basically cant use bakery volumes on rooms where the lights must turn off or at the very least the materials must not have Bakery Volumes enabled. For the first I am thinking the issue has to do with the scale and offset of the lightmapped renderers. Curious if anyone has encountered this before. Lightmapped prefabs are great so far but am i just out of luck on getting the lightmaps switched out at runtime?
     
  46. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,677
    I've updated the URP shader graph package today (worked on 16.0.4) - see attached (also called rev 3.0 on the main page).
    Finally there is an all-in-one graph called BakeryURPLit.
    It supports all Bakery special modes and it's more similar to the Lit shader (having previously unexposed tiling/offset, normal map/occlusion intensity and ability to choose 3 different sources of smoothness). Lightmapped specular, reflections and subtractive shadows work in all modes now. Volume mode + "Volume shadowmask" checkbox will give you properly masked diffuse/specular from all light sources, basically dynamic object lighting via Volumes now works as well as it was in my Bakery Standard shader in BiRP. In the future I'll be maintaining this graph instead of the 17 separate ones :D
    Originally I couldn't do it because keywords didn't work properly in Graphs, then there was a very low limit for these keywords, and finally... after waiting for the N-th update of the Shader Graphs and much cursing, I managed to make it. I'm not sure how to add any more toggleable features though, since even the base empty URP shader already uses a very high amount of keywords, and it will go beyond the default global keyword limit if I add another one. Because of this reason I didn't add Lit-like detail map options yet, since computing the detail map for all materials is wasteful and adding a compile-time toggle is not possible...

    The UI is a bit rough currently, since it's a default custom shader graph UI. I'll add a nicer scripted inspector later. Especially sad is the fact that Enum mode for float/int properties is still not working in shader graphs... so smoothness mode is chosen via a simple int for now.

    upload_2024-4-6_20-51-57.png

    upload_2024-4-6_20-53-17.png

    If you used my previous graphs, migration is simple:

    BakeryURPDirSpec -> set mode to None, enable lightmapped specular.
    BakeryURPMonoSHGraph -> set mode to MonoSH.
    BakeryURPMonoSHSpecGraph -> set mode to MonoSH, enable lightmapped specular.
    BakeryURPNonLinearLightProbe -> set mode to NonLinearLightProbe.
    BakeryURPRNMGraph -> set mode to RNM.
    BakeryURPSHGraph -> set mode to SH.
    BakeryURPSHGraph_Subtractive -> set mode to SH (same).
    BakeryURPSHSpecGraph -> set mode to SH, enable lightmapped specular.
    BakeryURPSHSpecGraph_Subtractive -> set mode to SH, enable lightmapped specular (same).
    BakeryURPSHSpecWithReflectionGraph -> set mode to SH, enable lightmapped specular and reflections.
    BakeryURPVertexColorGraph -> set mode to VertexBaked.
    BakeryURPVolumeGraph -> set mode to Volume.
    BakeryURPVolumeShadowmaskMultiLightGraph -> set mode to Volume, enable Volume shadowmask.
    BakeryURPVolumeSpecGraph -> set mode to Volume, enable lightmapped specular.

    Phew, feels good moving to a single shader instead of this mess! Will do the same thing with HDRP soon.

    Oh, also, you can make this graph transparent, alpha clipped or double-sided with just the built-in parameters (they were not exposed in previous graphs):

    upload_2024-4-6_21-25-36.png

    Note that Workflow mode is currently always metallic, there is no separate specular map yet.

    Unlike the BiRP shader it still doesn't support per-vertex baked directions/SH, but it'll be added.

    This is really weird! What are the driver versions on your (where it breaks) vs their (where it works) machines? Is it possible that they're actually using some older version? Can you try the same?
    Also can you isolate this problem to a smaller scene to see what's causing the fireflies? Is it a HDRI? Or some emissive mesh? Also, can it be related to the denoiser? Is the lightmap similar across all machines when Denoise is disabled?

    Another wild guess: do you have something (like anisotropy) forced on (instead of "Application-controlled") in your Nvidia control panel?

    It is, with some simple scripting: https://geom.io/bakery/wiki/index.php?title=How_do_I...#How_do_I_switch_lightmaps_at_runtime.3F

    Hmm how comes it doesn't exist? Baked prefabs (if Bakery Lightmapped Prefab was used) should contain a "BakeryPrefabLightmapData" object which holds the lightmaps. If they don't exist, they're not baked as prefabs, but as regular scene objects. Make sure "enable baking" checkbox is set on the prefab in the scene you use for their baking and there is no error written in the component UI.

    It is related to Bakery, but as you said, it's harmless. Thing is, Bakery only uses Lighting Data Assets for light/reflection probe storage. Other stuff (like Enlighten data) is not used, but Unity will complain anyway. Bakery has a file named "emptyLightingData.asset" which is used as a base template before calling Unity to insert probes into it. You can create any empty scene, bake it to produce an empty lighting data asset and then replace my emptyLightingData with it. Functionally it shouldn't change anything, but you won't get these warnings next time you rebake the affected scenes :) Maybe I should automate it.

    Very puzzling :( Not sure what else could cause it. If you can supply any more details so I can reproduce it, I'll take a look. I tried baking a scene with Unity 2022 (.3.16 in my case, but should be compatible) + URP 14 with distance shadowmask, and it worked fine, no matter how I tweak the shadow distance. Perhaps you missed some setting?
    (got your email, continuing there)

    Yes, I helped a few devs integrate it into their custom engines. Core part is engine-agnostic. Please DM/email me about your case :)

    I think your emissives are very tiny, so they're randomly missed by rays. I recommend using Light Meshes instead, as they're optimized for noise-free area lights of any size, even at large distances; alternatively you can increase GI sample count. If you have a monster GPU, you can even type in sample values higher than what the slider allows you (I would only recommend it as a last resort though, but I know some people with 4070+ GPUs use some crazy values and get away with it :D)
    Just added this to the docs yesterday: https://geom.io/bakery/wiki/index.p..._.28or_brightly_lit.29_surfaces_produce_noise

    Woah, I don't think it's related. Seems like a bug. Can you check if Skylight is visible if you disable all point/area/emissive lights? I wonder if some light is just super bright and NaNs the sky out.
    As usual, if you can isolate the issue into some smaller package/project, I'll happily debug!

    Hmm that should work fine. Unless you baked different lightmap versions with different Texels Per Unit or other atlas-affecting changes. Do different swappable lightmaps actually look like their UVs are identical?
    You should probably set Asset UV Processing = Don't Change after the first time you bake the prefab, to further ensure that there will be no UV changes.
    Offsets/Scales must not be different between different LM versions, if there are no changes to geometry/atlasing. If it's a light switch, only the maps should change.
    If the offset happens just the first time you spawn the prefab... check my previous response and make sure you actually baked it properly (BakeryPrefabLightmapData present in the prefab, component says "Prefab connection: OK").

    There shouldn't be any problem with that - you can just swap volume textures exactly the same way you can swap lightmap textures in the global array. Just take a BakeryVolume object and put different volumes into bakedTexture0/1/2/3, bakedMask. If the volume is global, call SetGlobalParams() after that; if it's not, call the method you use to update MaterialPropertyBlocks/Materials on affected objects.
     

    Attached Files:

    Last edited: Apr 6, 2024
    yasirkula likes this.
  47. Game-Dragon

    Game-Dragon

    Joined:
    Nov 16, 2012
    Posts:
    36
    Oh wow, a single uber Bakery shader for URP is incredible. This is exactly what I wanted.
     
    guycalledfrank likes this.
  48. wechat_os_Qy0zCwlL0ep61-snSqTDPylHU

    wechat_os_Qy0zCwlL0ep61-snSqTDPylHU

    Joined:
    Feb 16, 2020
    Posts:
    2
    Hello, sorry to bother, want to know if there is a plan to provide similar plugin for unreal engine
     
  49. Enverex

    Enverex

    Joined:
    Jul 6, 2019
    Posts:
    76
    I was going through rebaking all the sectors in my scene today when suddenly I hit one that refused to bake and instead threw these errors:

    upload_2024-4-14_2-11-10.png

    The log doesn't seem to go into any more detail than those errors from the console.

    Other sectors still bake fine and I've not added anything to this sector since it last baked successfully. What may be causing this?
     
    guycalledfrank likes this.
  50. Enverex

    Enverex

    Joined:
    Jul 6, 2019
    Posts:
    76
    Those of us building for VRChat are also stuck with basic probes too unfortunately.
     
    guycalledfrank and rtx89 like this.