Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

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

  1. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    28
    hi @guycalledfrank
    I love the new feature "Volume", so I can use it as an alternative to light probe and put it into a prefab.
    however, I have a lot of customized shaders for moving objects. how to convert my customized shader to use "Volume"?
    thanks.
     
  2. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    276
    I am using Bakery to bake a scene. I then load another scene additively, disable the first scene, and found that the scene I loaded has baked artifacts.
     

    Attached Files:

  3. Groggsy

    Groggsy

    Joined:
    Mar 6, 2013
    Posts:
    7
    Hi,
    I just bought and installed Bakery (after hearing great things about it) but I've fallen at the first hurdle.

    So after installing, I tried to do a test bake using a basic scene i made i got this warning;
    upload_2021-4-16_18-31-55.png

    I did the 'detect optimal settings' test and it came back with the following;
    upload_2021-4-16_18-25-58.png
    I looked at the lightmapping - direct and indirect denoise settings and both have Optix greyed out.
    The only options were OpenImageDenoise or None. I tried both but each time I tried to run the detect settings test it would come up with the same results as above.
    I have a GTX1060 with 8GBram and drivers are up to date.
    Any help appreciated.
    thanks.
     
  4. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    59

    Well I did a ton of things but I think it was simply that I was using a straight blender file. I used an FBX and made a ton of other changes so that might not be it but maybe it helps someone.

    I know to use FBX... but thought it would not hurt this time to use .Blend...... but who knows.

    Have a great day!
     
  5. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    59
    Well its back... it was not FBX. I was confused and actually was using unity default renderer when it worked.

    No idea what bakery is doing.
    S1.jpg bakery S2.jpg Unity.

    No warnings on rendering.

    I included the model. All looks normal.

    So I sadly cannot use bakery on this project. I love the network renderer to save time. Hopefully this will be fixed.

    Thanks! s1.jpg s2.jpg
     

    Attached Files:

    • ex2.zip
      File size:
      1.6 MB
      Views:
      4
  6. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,076
    Is there an example of a simple unlit diffuse shader that works with volumes?
     
  7. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,412
    You mean this one?

    upload_2021-4-19_22-51-30.png

    I'm not sure there is any public API to get it. The whole thing is declared inside the HDAdditionalSceneViewSettings class, but

    'HDAdditionalSceneViewSettings' is inaccessible due to its protection level


    ... HDRP authors don't really want us to mess with it apparently.
    I can probably hack it via reflection, but chances are, it'll break in a month after another HDRP update.

    Bakery's exposure is just a linear multiplier. 2 is literally 2x brigher than 1. HDRP's scale is something much more complex and (IMHO) less intuitive.

    Why does HDRP scene exposure even make the scene brighter when it's negative? Digital cameras usually do it other way around.

    Another problem is the tonemapper. RTPreview doesn't have one, it simply multiplies the exposure. It was the safest bet because I can't guess which tonemapper is used (it can even be a custom one), and some tonemappers (hi ACES) tend to alter the image drastically.

    I tried to copy HDRP's EV100 logic to make RTPreview exposure work similarly, but because of the tonemapper, the result is pretty different anyway, so not sure syncing exposure alone would be useful:

    upload_2021-4-20_0-13-49.png

    The easiest way would be to make "render in scene view" just use built-in HDRP postprocessing, but apparently SceneView.SetSceneViewShaderReplace doesn't really play well with it and I don't know any other way to force scene view shader override.

    Totally. Take a look at URP shader graphs, because they show a way how it can be integrated. You can find the core functions in BakeryDecodeLightmap.hlsl:


    Texture3D _Volume0, _Volume1, _Volume2;
    SamplerState sampler_Volume0;
    float3 _VolumeMin, _VolumeInvSize;
    float3 _GlobalVolumeMin, _GlobalVolumeInvSize;

    void BakeryVolume(float3 lpUV, float3 normalWorld, out float3 sh)
    {
    float4 tex0, tex1, tex2;
    float3 L0, L1x, L1y, L1z;
    tex0 = _Volume0.Sample(sampler_Volume0, lpUV);
    tex1 = _Volume1.Sample(sampler_Volume0, lpUV);
    tex2 = _Volume2.Sample(sampler_Volume0, lpUV);
    L0 = tex0.xyz;
    L1x = tex1.xyz;
    L1y = tex2.xyz;
    L1z = float3(tex0.w, tex1.w, tex2.w);
    sh.r = shEvaluateDiffuseL1Geomerics(L0.r, float3(L1x.r, L1y.r, L1z.r), normalWorld);
    sh.g = shEvaluateDiffuseL1Geomerics(L0.g, float3(L1x.g, L1y.g, L1z.g), normalWorld);
    sh.b = shEvaluateDiffuseL1Geomerics(L0.b, float3(L1x.b, L1y.b, L1z.b), normalWorld);
    sh = max(sh, 0);
    }

    void BakeryVolume_float(float3 posWorld, float3 normalWorld, out float3 sh)
    {
    bool isGlobal = dot(abs(_VolumeInvSize),1) == 0;
    float3 lpUV = (posWorld - (isGlobal ? _GlobalVolumeMin : _VolumeMin)) * (isGlobal ? _GlobalVolumeInvSize : _VolumeInvSize);
    BakeryVolume(lpUV, normalWorld, sh);
    }
     
    Last edited: Apr 19, 2021
    SammmZ likes this.
  8. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,412
    Please take a look at the answer above.

    Async load? Try calling ftLightmaps.RefreshFull() after the scene is fully loaded.

    Benchmark problems are related to either Avast or another problem with certain version control systems that locked Bakery's own files from writing (in which case try getting the patched version from github, I added a workaround): https://geom.io/bakery/wiki/index.php?title=Github_access
    If you don't want to patch, you can just select ftGlobalStorage.asset and set these checkboxes to anything:

    upload_2021-4-20_0-34-30.png

    Sorry, I can't import this file either:

    upload_2021-4-20_0-40-46.png

    Can you actually try posting a FBX version here? I'm not sure how/where you use this OBJ, it seems broken.

    Just wrote one. Attached.
     

    Attached Files:

  9. JakeC

    JakeC

    Joined:
    May 3, 2014
    Posts:
    18
    Hi, just purchased Bakery and so far it is working perfectly. One question: does the Editor/ directory that contains bakery have to be top level (I am guessing it does for compilation order)? I would prefer to move it into another folder.
     
  10. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,412
    You can move, it'll work. Note that it can cause problems when upgrading to a new version though (ending up with 2 different copies imported to the project).
     
    Last edited: Apr 20, 2021
    JakeC likes this.
  11. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    700


    Ok. I see.
    I try to explain my problem step by step.
    Probably when you open the new HDSample scene it s the easiest way to see my problem.

    HDDsampleScene Unity 2020.3.4LTS

    001.JPG




    Directional Sun Intensity is
    10 000
    this high value needed e.g. for shadow intensity and so on


    Question 1:
    Whats the values for the Bakery Direct Light?

    002.JPG



    HDRI Sky intensity is set to exposure 13.5
    Tonemapping ACES

    Question 2:
    What are the values for Bakery Sky Light?

    003.JPG


    After Bake you have to have Post Processing enabled in Scene View to get


    004.JPG

    without you get pure white

    Question 3:
    To have this Post Processing enable/disable in RT View would be perfect.
    But i see the problems.
    But applying the post processing in the same way to the RT View would be the most accurat way to allow real world setups.

    upload_2021-4-20_14-34-41.png
     
  12. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    700
    With 'Post Processing disabled in scene view and enabling
    Overide Exposure and setting scene Exposure to 12 you also can get the preview back

    005.JPG


    Then disable exposure override again and switch to Baked LightMap preview.
    Then you get the LightingExposure Slider.
    With 0 you see this

    006.JPG

    You have to set -12.5 with the Lighting Exposure Slider to get the Lightmap preview



    007.JPG


    I tried to rebake this setup more than 5 times with Bakery and RT preview
    but cannot find the right values for Question 1 and Question 2 for Bakery Direct Light and Skylight.
    To get automatic exposure, correct shadow intensities and physical camera values to work in HDRP these are quite important.


    Why this is so important now in HDRP to match these values i try to explain on a real world Bakery setup to match the lighting from an IBL with correct shadows intensities and automatic exposure.
    I will send it in a few minutes.
     
    Last edited: Apr 20, 2021
  13. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    700
    Let s try some best practice real world example in BuiltIn RP to show off some stuff who drives me crazy because not archivable in HDRP now.

    Post 1/2

    Target:
    Transfer Lighting scenario from IBL to Bakery bake.

    Automatic exposure in post processing should handle everything.

    Mainly:

    - 1) wall material in shadow = 2) wall material in sun
    - floor material in shadow


    palermo.JPG



    So after some time you come up with a bakery setting who matches real world ibl input

    - wall material in sun and shadow matches reference ibl
    - floor material in shadow matches reference
    - additionally you even have correct floor lighting in sun whats not avaiable in ibl because complete floor is in shadow there


    bakery_match.jpg




    Even by running around the automatic exposure brings down exposure by viewing on lit wall.
    Lit 3D wall = Lit IBL wall intensity


    sun.JPG


    or brings up exposure by viewing on shadow wall.
    There is a total match and the ibl lighting sceanrio from HDR which is fully captured to the bakery bake. You can freely run around and you have a total match in sun and shadow areas.

    Now you could integrate real geometrys for arch and nature. It will auto fit to the IBL used.
    Even integrating a car look the same in shadow and lit areas like on the IBL.

    Bakery L1 probes and Shadowmask is needed here.

    Lit 3D wall in shadow = Lit IBL wall in shadow

    shadow.JPG


    To get this i need these values in the bakery directional light and these values in the Bakery Skylight.


    rt preview.JPG

    but the real problem is...

    next post
     
    Last edited: Apr 20, 2021
  14. YoshikazuOota

    YoshikazuOota

    Joined:
    Dec 16, 2020
    Posts:
    1
    Hello everyone!

    Please tell me!

    I need to bundle some sources to distribute a baked world, but I don't know the license.
    I would like to know the license of these sources in the following links.

    > How do I share a scene with someone who doesn’t have Bakery installed?
    > Apart from the scene and its lightmaps you also have to include a few scripts, namely:
    > ftLightmaps.cs
    > ftLightmapsStorage.cs
    > ftLocalStorage.cs
    > ftGlobalStorage.cs
    > ftModelPostProcessor.cs
    > ftSavedPadding2.cs (on v1.7+)

    https://geom.io/bakery/wiki/index.php?title=How_do_I...
     
    Last edited: Apr 21, 2021
  15. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    700
    Post 2/2

    used sky expossure
    1

    sky.JPG

    is transfered to

    4.59 bakery intensity.
    Why is 1 = 4.59? But it works in BuilInRP.
    IBL.JPG

    The sun i have to setup around
    17
    Bakery to 7.81. But it works in BuilInRP.


    sunt.JPG

    1) These values have no connection
    17.1 and 7.81. But it works in BuilInRP.

    But the real problem. Normally i have to use HDRP light intensitys around 80 000.

    HDRP preset gives you
    Sun 100 000 (dark shadow intensity)
    Cloudy 20 000 (normal shadows)
    Low Sun 5000 (light shadows)
    Moon 1.5 (very light shadow intensity)
    which also drives the shadow inensity.


    hdrp light.JPG
    and much higher HDR Sky exposure. (around 12 for sunny ibl instead of 1 in BuiltInRP)

    to match shadow and physical camera parameters and setups from other scenes.
    This high values are not bakeable in Bakery
    So here i used 17.1 and 7.81 (screenshot above) instead of needed 80 000.
    80 000 is not usable in Bakery.
    But needed to get right shadow intensity.


    In general these are the same problems you will face if you try to rebake the
    HDRP Standard scene explained in the post before.
    If there are bakery parameter conversion who can handle higher ibl skylight exposures (around 12) and direct light intensitys (around 80 000) for a sunny day, everything is fine in HDRP.


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

    Only explained in another way.

    In BuiltIn RP it s working for me.
    In HDRP i cannot match these and hold my workflow.
     

    Attached Files:

    Last edited: Apr 20, 2021
  16. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,076
    Thanks so much!

    So my game uses DunGen to procedurally generate levels out of rooms at runtime, so all my rooms are lightmapped prefabs and i'm in the process of re-baking them all with a bakery volume in them; but I ran into an issue:

    DunGen will frequently rotate a room prefab to create the dungeon level, and then this happens to the volume in that room:

    upload_2021-4-20_11-21-26.png

    Is there any way to fix that?
     
  17. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    700
    Did you checked the git updates https://geom.io/bakery/wiki/index.php?title=Github_access

    There were changes for the rotation of volumes.
    But no idea if it works in lightmapped prefabs.
     
    guycalledfrank likes this.
  18. yusufdemir2012

    yusufdemir2012

    Joined:
    Dec 21, 2013
    Posts:
    25
    When I accept the collab update from my friend, unity is stucking in this moment:
    upload_2021-4-21_17-51-18.png
    And when I check the Editor.log file, I see this logs for very times


    Code (CSharp):
    1. xatlas time: 89.681999206543
    2. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    3. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    4. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    5. UnityEngine.Debug:Log (object)
    6. xatlas:Unwrap (UnityEngine.Mesh,UnityEditor.UnwrapParam) (at Assets/Editor/x64/Bakery/scripts/xatlas/xatlas.cs:150)
    7. ftModelPostProcessor:UnwrapXatlas (UnityEngine.Mesh,UnityEditor.UnwrapParam) (at Assets/Editor/x64/Bakery/scripts/xatlas/xatlasEnable.cs:11)
    8. ftModelPostProcessor:Unwrap (UnityEngine.Mesh,UnityEditor.UnwrapParam,ftGlobalStorage/Unwrapper) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:389)
    9. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:315)
    10. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:354)
    11. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:354)
    12. ftModelPostProcessor:OnPostprocessModel (UnityEngine.GameObject) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:123)
    13. System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
    14. System.Reflection.MethodBase:Invoke (object,object[])
    15. UnityEditor.AssetPostprocessingInternal:InvokeMethodIfAvailable (object,string,object[])
    16. UnityEditor.AssetPostprocessingInternal:CallPostProcessMethods (string,object[])
    17. UnityEditor.AssetPostprocessingInternal:PostprocessMesh (UnityEngine.GameObject)
    18.  
    19. (Filename: Assets/Editor/x64/Bakery/scripts/xatlas/xatlas.cs Line: 150)
    20.  
    21. xatlas time: 138.727996826172
    22. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    23. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    24. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    25. UnityEngine.Debug:Log (object)
    26. xatlas:Unwrap (UnityEngine.Mesh,UnityEditor.UnwrapParam) (at Assets/Editor/x64/Bakery/scripts/xatlas/xatlas.cs:150)
    27. ftModelPostProcessor:UnwrapXatlas (UnityEngine.Mesh,UnityEditor.UnwrapParam) (at Assets/Editor/x64/Bakery/scripts/xatlas/xatlasEnable.cs:11)
    28. ftModelPostProcessor:Unwrap (UnityEngine.Mesh,UnityEditor.UnwrapParam,ftGlobalStorage/Unwrapper) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:389)
    29. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:315)
    30. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:354)
    31. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:354)
    32. ftModelPostProcessor:OnPostprocessModel (UnityEngine.GameObject) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:123)
    33. System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
    34. System.Reflection.MethodBase:Invoke (object,object[])
    35. UnityEditor.AssetPostprocessingInternal:InvokeMethodIfAvailable (object,string,object[])
    36. UnityEditor.AssetPostprocessingInternal:CallPostProcessMethods (string,object[])
    37. UnityEditor.AssetPostprocessingInternal:PostprocessMesh (UnityEngine.GameObject)
    38.  
    39. (Filename: Assets/Editor/x64/Bakery/scripts/xatlas/xatlas.cs Line: 150)
    40.  
    41. xatlas time: 71.031005859375
    42. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    43. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    44. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    45. UnityEngine.Debug:Log (object)
    46. xatlas:Unwrap (UnityEngine.Mesh,UnityEditor.UnwrapParam) (at Assets/Editor/x64/Bakery/scripts/xatlas/xatlas.cs:150)
    47. ftModelPostProcessor:UnwrapXatlas (UnityEngine.Mesh,UnityEditor.UnwrapParam) (at Assets/Editor/x64/Bakery/scripts/xatlas/xatlasEnable.cs:11)
    48. ftModelPostProcessor:Unwrap (UnityEngine.Mesh,UnityEditor.UnwrapParam,ftGlobalStorage/Unwrapper) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:389)
    49. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:315)
    50. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:354)
    51. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:354)
    52. ftModelPostProcessor:OnPostprocessModel (UnityEngine.GameObject) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:123)
    53. System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
    54. System.Reflection.MethodBase:Invoke (object,object[])
    55. UnityEditor.AssetPostprocessingInternal:InvokeMethodIfAvailable (object,string,object[])
    56. UnityEditor.AssetPostprocessingInternal:CallPostProcessMethods (string,object[])
    57. UnityEditor.AssetPostprocessingInternal:PostprocessMesh (UnityEngine.GameObject)
    58.  
    59. (Filename: Assets/Editor/x64/Bakery/scripts/xatlas/xatlas.cs Line: 150)
    60.  
    61. xatlas time: 111.44100189209
    62. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    63. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    64. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    65. UnityEngine.Debug:Log (object)
    66. xatlas:Unwrap (UnityEngine.Mesh,UnityEditor.UnwrapParam) (at Assets/Editor/x64/Bakery/scripts/xatlas/xatlas.cs:150)
    67. ftModelPostProcessor:UnwrapXatlas (UnityEngine.Mesh,UnityEditor.UnwrapParam) (at Assets/Editor/x64/Bakery/scripts/xatlas/xatlasEnable.cs:11)
    68. ftModelPostProcessor:Unwrap (UnityEngine.Mesh,UnityEditor.UnwrapParam,ftGlobalStorage/Unwrapper) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:389)
    69. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:315)
    70. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:354)
    71. ftModelPostProcessor:AdjustUV (UnityEngine.Transform,ftSavedPadding2) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:354)
    72. ftModelPostProcessor:OnPostprocessModel (UnityEngine.GameObject) (at Assets/Editor/x64/Bakery/scripts/ftModelPostProcessor.cs:123)
    73. System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
    74. System.Reflection.MethodBase:Invoke (object,object[])
    75. UnityEditor.AssetPostprocessingInternal:InvokeMethodIfAvailable (object,string,object[])
    76. UnityEditor.AssetPostprocessingInternal:CallPostProcessMethods (string,object[])
    77. UnityEditor.AssetPostprocessingInternal:PostprocessMesh (UnityEngine.GameObject)
    78.  
    79. (Filename: Assets/Editor/x64/Bakery/scripts/xatlas/xatlas.cs Line: 150)
    There is a lot of same logs like above in Editor.log file. Same log is adding to Editor.log in every ~100 seconds when editor is stucking
     
  19. cocapasteque

    cocapasteque

    Joined:
    Sep 30, 2016
    Posts:
    19
    Hey @guycalledfrank ,

    I'm using URP and Bakery and would like to try the Shadowmask render mode, if I understand well that means I can have baked lights and realtime shadows provided by the Unity mixed lights.

    Is this feature working on URP? I tried a bunch of thing but I can't seem to get a realtime shadow casted onto baked surfaces.
    Is there any special setup for this?

    Thanks !
     
  20. Luvrael

    Luvrael

    Joined:
    Sep 9, 2017
    Posts:
    18
    I have a problem with spot light. Some lights bake and some don't. The difference between them is only the position. The values are the same in the script.
    upload_2021-4-23_14-22-13.png

    Sometimes it is possible to bake it if it duplicates the spot light in the same place.
    upload_2021-4-23_14-23-41.png
    Why single spotlights work in one place and not in another?
    Why duplicate help them? (This is less optimal + easier to masked UV overlap)

    Spot light value:
    upload_2021-4-23_14-36-28.png
    Thanks for the advice
     

    Attached Files:

    Last edited: Apr 23, 2021
  21. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,412
    "Match" button should calculate it for you (for directional lights it just divides by Pi, i.e. bakeryDirectionInt = hdrpDirectionalInt / Pi).

    This is where I recommend just baking the skybox into a cubemap: https://geom.io/bakery/wiki/index.p..._use_Skylight_with_a_procedural_sky_shader.3F
    Update skybox probe -> Skybox texture and intensity is now baked into a new exr cubemap -> Plug it into Skylight (leave its own intensity at 1 and color at default white).
    This way you can use skies with any transformation/correction without guessing it.

    I agree, but I don't know how to inject RTPreview rendering into the HD pipeline without rewriting it, it's not very extensible.

    It is fine to distribute these 5-6 listed scripts with your projects. I didn't really choose a license for them, but you can think of it as MIT.

    It was hardcoded in the way builtinRP handled exposure in its sky shaders. If you look at my code comments, you can see my confusion as well :D

    exposure *= PlayerSettings.colorSpace == ColorSpace.Linear ? 4.59f : 2; // weird unity constant


    You can also see it scattered around in UnityCG.cginc, e.g.:

    // Decodes doubleLDR encoded lightmaps.
    inline half3 DecodeLightmapDoubleLDR( fixed4 color, half4 decodeInstructions)
    {
    // decodeInstructions.x contains 2.0 when gamma color space is used or pow(2.0, 2.2) = 4.59 when linear color space is used on mobile platforms
    return decodeInstructions.x * color.rgb;
    }


    Mhhmmm why though? Bakery directional intensity == Unity directional intensity in builtinRP.

    Yes, some people also used the same exact tool for dungeon generation and told me the same thing, so I added a few options (currently available as github patches). Now you can:
    1. Bake your volume unrotated.
    2. Enable "Support rotation after bake"

    upload_2021-4-24_15-34-58.png

    3. Use Bakery shader with "Support volume rotation"

    upload_2021-4-24_15-35-48.png

    If you're on URP, use BakeryURPVolumeGraphRotatable.shadergraph.

    4. Rotate the volume and update it*.

    *Notes:
    - Rotation matrix is only sent to the shader once when the volume is enabled. After rotating a global volume, re-enable the component or just call volume.SetGlobalParams().
    - If you're using my BakeryVolumeTrigger/Receiver scripts, you'll need to re-run these lines after the rotation:

    mb.SetMatrix("_VolumeMatrix", vol.GetMatrix());
    rcv.SetPropertyBlock(mb);


    ...did I already answer you on Discord?... anyway, hopefully it will be googleable on the forum, so let's keep it here too.

    xatlas is indeed known to be quite slow for some models. Usually I recommend only using it as atlas packer, and not the unwrapper. In this case you can:
    - Wait for it until it's done.
    - Ask your friend to bake with Unwrapper set to Default.

    It is supported since URP 10.1 (but not on older versions).

    Weird, that shouldn't happen. Can you send me any test scene where I can reproduce this behaviour? Are you sure the lights are not occluded by e.g. ceilings?
     
    keeponshading likes this.
  22. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,412
    Also some news:

    - RTPreview now supports AO. I don't like AO too much, because it's a non-physical effect, but since many people use it...

    upload_2021-4-24_15-50-15.png

    upload_2021-4-24_15-50-18.png


    - Downloading mid-release patches from github is kinda cumbersome, especially because there are now 3 different repositories (scripts, binaries, preview). I added a little patching utility to automatically download and apply the patches. It works correctly even if you moved Bakery's folders or if the DLL files are locked (it will just ask to restart the editor and update them after it).

    upload_2021-4-24_15-53-43.png

    Updater itself is now pushed to github, but here I'm also attaching it to the post.

    Notes:
    - You still need to register here to get yourself added to Bakery repositories and here for RTPreview repository access (in case you didn't do it before).
    - If you don't have the invoice and was given a free voucher instead, just DM me and I'll make it work.
     

    Attached Files:

    keeponshading likes this.
  23. Lorrak

    Lorrak

    Joined:
    Sep 17, 2019
    Posts:
    13
    any ideas why it looks so bad? increased almost all parameters by a lot, tried multiple times with different parameters, meshes has uv mapping enabled, simple scene, one directional light, tried without denoise, a little bit better but still ugly.. when tried with denoise again, almost like its not working, the green mesh has some yellowish artefacts, and cliffs are completely black.. only cubes isnt static, gi enabled, tried mixed, subtractive modes
    and the other is using unity's generate lighting
    __edit___
    increased bakery direct light intensity, getting better results
    __edit___
    added skylight now it looks good
     

    Attached Files:

    Last edited: Apr 25, 2021
    guycalledfrank likes this.
  24. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    75
    Hi frank, I've been getting these random dark spots in some places and I can't figure out what's causing them. They only appear in specific spots. There's no hidden geometry and I don't know what else could cause it. Do you have any ideas?

    Screenshot 2021-04-25 021217.jpg

    Also another issue I'm having is that it takes 2 hours to bake my scene and most of the time I run out of memory if I set the texels per unit above 10. Its not a very large scene but there are a lot of objects, Are there a ways to reduce the baking time and increase the texels per unit without running out of memory? I've got 16gb at the moment.

    Screenshot 2021-04-25 023414.jpg Screenshot 2021-04-25 023456.jpg

    Thanks!
     
    Last edited: Apr 25, 2021
  25. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    75
    I think you need to add a bakery sky light.
     
    guycalledfrank and Lorrak like this.
  26. marenin

    marenin

    Joined:
    Sep 22, 2019
    Posts:
    8
    Hello there!

    I got some issue with shading and shadows using tangentspace normal map.

    Left — Realtime shader.
    Work like it should.

    Right(selected) — Baked lightmap with Render Mode: Full Lighting and Directional Mode: Baked Normal Maps.
    Have problems on shading and especially shadows.
    upload_2021-4-26_17-40-41.png
    It may be due to lack of normalmap calculations in some passes, like uvsmoothpos(normilized for screenshot):
    upload_2021-4-26_17-46-51.png
     
  27. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,076
    @guycalledfrank Thanks so much! You mentioned on the Discord it would be possible to "patch" volumes at runtime... what are the chances of creating like a BakeryVolume.Bake() helper function that finds bakery lights in the volume bounds and updates the 3d texture, that we can use at runtime?
     
  28. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    700
  29. Luvrael

    Luvrael

    Joined:
    Sep 9, 2017
    Posts:
    18
    Hi, most of my previous problems were a light overlap bug. I tried to reduce the light range in my buildings to avoid overlapping but I can’t do it in every needed place. I found a solution for this problem with Unity built-in lightmapper and I wonder if I can recreate this with your asset as well. My idea is to bake only GI with no shadows for point and spot lights and after bake set some key lights to real-time. All I do is change the shadow type to no shadow after baking but this doesn’t work after baking with Bakery.


    I wanted to ask about the operation of bitmask and Shadowmask Group ID. I found your post.

    "When assigning channels to shadowmasks, bitmasks are now respected, meaning you can have > 4 overlapping shadowmasked lights if they use a different bitmask."

    Could you describe how it works and how to use it? The documentation is not clear enough for me but it looks like can solve my problem
     
    Last edited: Apr 30, 2021 at 2:35 PM
  30. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    46
    Hello, I have some artifacts on some of my baked objects, I don't have any compression on that specific lightmap, anyone knows why this is happening?
     

    Attached Files:

  31. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,412
    Yeah looks like there is either some kind of an overlap or a hidden mesh? Can you try updating to the latest github version? Just to make sure it's not something that was fixed before. E.g. there was indeed some overlap bug with LMGroup+LODGroup+xatlas combo.

    That's quite a long time, but I haven't seen your scene. Here is my general advice for these cases:
    https://geom.io/bakery/wiki/index.php?title=How_do_I...#How_do_I_lightmap_a_large_world.3F

    ---

    Also: I'm currently working on a huge scene baking solution. The idea is:
    - You define "sectors". These are shapes defining some bakeable area.
    - You define "capture points" for each sector. These should be placed around the perimeter (for an exterior) or inside windows (for interiors).

    Only objects inside the sector are "real", they are exported and baked as usual. Outside world is instead approximated with autogenerated geometry based on capture points' visibility. It's kinda similar to photogrammetry; Instead of the complete outside world, we only have this simplified visible part.

    - There are 2 types of workflow from this point:
    - Workflow A: select the sector and bake it. Both inside and outside geometry are present in the scene, but only inside geometry is atlased/exported/baked.
    - Workflow B: outside world is capture into an asset. This asset can be then reused in another scene. For example, you can capture city environment as seen from windows of a building. Then you can bake interior of this building in a separate scene, with exterior approximation loaded from the captured asset.

    I hope this stuff will be useful and not overly complicated.

    ---

    Please try the latest github patch, it was fixed.

    Well, it's not as easy. Launching lightmapper jobs at runtime is very complicated/slow/not cross-platform. You can inject your own data into the volume (e.g. simple unshadowed lighting) or replace their parts with other parts.

    Mentioned via PM, but I'll copy it here for other people, just in case:

    You kinda can bake them (bent normals) already. Just bake in Ambient Occlusion Only mode with directional mode set to Dominant Direction and you'll get dominant AO direction which is basically == bent normal. Note that it's world-space though. But as HDRP can use object-space bent normal, you can bake the object with zero transform and it should work!

    Yeah, you can easily recreate it. If you have a shadowmasked light, just set its Baked Contribution to "indirect only".

    TBH, it turned out to be not very useful in practice, and I'd rather not recommend manually specifying shadowmask group ID. The logic there is complicated and I stopped using it in complex scenes. Instead, bitmasks (for baked lights) and layers (for realtime lights) can be used very well to avoid overlaps. E.g. in a multi-floor building if you have each floor on a different bitmask/layer, you can easily kill vertical overlaps.

    Looks like some kind of a UV overlap... or possibly something with the normal . Are you using proper non-overlapping UVs (or "generate lightmap UV" checkbox)? Can you check if it goes away when disabling "adjust sample positions"? Can you try it with the latest github patch?
     
    marenin likes this.
  32. MorpheusXI

    MorpheusXI

    Joined:
    Jan 18, 2018
    Posts:
    60
    Ref from thread Jan 24

    Not a live project for me now, just for your info. On my end I randomly checked some of your .exe's that Avast flagged and Virus Total was also good with these my end. So it must be some form of Heuristic red herring.
     
    guycalledfrank likes this.
  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,412
    Interested in baking HUGE scenes? Had problems fitting your world in memory?
    I may have a solution for you (or at least it seems to work for me), here's a documentation draft:
    https://geom.io/bakery/wiki/index.php?title=Partial_scene_baking

    This feature is not yet released, but it works as described. Would really love to hear your opinion!
     
    Last edited: May 3, 2021 at 12:15 PM
    keeponshading and newguy123 like this.
  34. apm2

    apm2

    Joined:
    Jan 8, 2018
    Posts:
    2
    Hi, i'm bake in prefab simple object (bake on windows device with 1650Ti). Than i push this prefab to github with all meta and etc files. When i open scene with this prefab on different macOS devices, i saw different results of lightning (normal and with black artefacts).
     

    Attached Files:

    Lorrak likes this.
  35. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    75
    I have updated it to the github version but it's giving me the following error when I bake: "ftrace error: Can't load UVGBuffer normal or position (7500)".

    If I remove the temp folder the error is replaced by another one: "halffloat2hdr error: Unknown error (1)". I don't have any object names with special characters and I have enough storage space.

    And I'm looking forward to the partial scene baker! It looks like it will solve a lot of my problems, especially since I have some parts of my game in another scene and the lighting doesn't carry over. And baking all the scenes together is impossible without setting the texels per unity very low. I hope it's ready before the end of the year when I'm releasing my game. I'll definitely put your name in the credits regardless since you've helped me so much.
     
    guycalledfrank likes this.
  36. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    700
    Your description full matches my use case.

    - 4km long race and drive tracks
    with
    - HQ vista points
    - HQ buildings with HQ interior
    - cars with interior baked and exterior

    everything needs to be baked and is developed and optimized over time in lots of iterations from different devs.

    Your system would finally allow all this .

    Additional it would be nice if you could lock a sector in a scene so that only the constributor who has locked it is allowed to overwrite the bake in this sector.
    Some little helper which would make multi user scene preparation easier.

    It would be also great if the sectors work on multi scene additional asyn loading based on adressables.

    main scene = cam and track
    + async addressable scene building A
    ...
    + aync added addressable car A
    .....

    In current test projects we also test future setups with entitys and lots of subscenes. Sectors for subscenes would be great here. Only loaded/activated subscenes in the scene could be baked. All closed subscenes auto costribute as capture points.
     
    Last edited: May 3, 2021 at 10:30 PM
  37. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,412
    Maybe simply right clicking the asset -> reimport will work?

    Sounds like you only updated from bakery-csharp, not bakery-compiled (or vice versa)?

    Well the system is working. I only need to polish it a little bit and run more tests.

    Indeed, a perfect case!

    You can use "Capture to asset" -> "Load captured" in the same scene. This way you capture it once and lock. Sector will always "see" the same loaded surroundings.
    Or do you mean lock from... other people changing it? I'm not sure how the multi-user workflow works.
     
  38. apm2

    apm2

    Joined:
    Jan 8, 2018
    Posts:
    2
    reimport asset don't work, maybe bake settings can influence?
     
  39. bakelord

    bakelord

    Joined:
    Jan 19, 2014
    Posts:
    5
    Good day!
    We have the same issue as apm2 where we render/bake on PC, check the lightmaps and level file into git, and on macOS the lightmaps appear broken. If we reimport the meshes it then looks like we have no baked data at all with the lightmaps appearing empty in the lightmap view. I suspect we have something setup incorrectly but do you have any thoughts?
    Thanks!
     
  40. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    75
    No I've updated them both.
     
  41. Luvrael

    Luvrael

    Joined:
    Sep 9, 2017
    Posts:
    18
    I want to use Bakery lightmap Group Selector where lightmap group parameters use more than one bitmask.
    I have one directional light on shadowmask mode and a lot of point lights in rooms. In my rooms, I setup a max of 3 lights with one bitmask. When I do that I don't have a satisfying solution.

    When in lightmap group I setup Packing mode on Vertex - my building doesn't have lightmaps.
    Atlas has hard weird shadows. Shadows like on the screen.
    Like you see on the screen shadows look awful. Increasing texel per unity and scale in lightmap doesn't help.
    Point lights value: Spread shadows = 0.1. samples = 256

    upload_2021-5-5_10-32-51.png

    Your examples scenes don't show a more complicated situation. Could you send scenes with a lot of lights by using more than one bitmask? Still, I can't use it with satisfying results.
    I will be grateful for an advanced scene.
     

    Attached Files:

  42. EugenioA

    EugenioA

    Joined:
    Jul 9, 2020
    Posts:
    3
    Hey @guycalledfrank. I've been using bakery in my project for a while now and i love it. But i've been having a problem with starting bakery from one of my scripts.
    If i bake manually one of my scenes with some models in it, bakery creates around 6-9 lightmaps which is ok. But if i start the baking of the same scene with :
    Code (CSharp):
    1. ftLightmapsStorage storage = ftRenderLightmap.FindRenderSettingsStorage();
    2.         ftRenderLightmap bakery = ftRenderLightmap.instance != null ? ftRenderLightmap.instance : ScriptableObject.CreateInstance<ftRenderLightmap>();
    3.  
    4.         bakery.LoadRenderSettings();
    5.         bakery.RenderButton(false);
    sometimes it creates only one map (many artifacts) and sometimes the correct amount of lightmaps. If i notice that it creates only one lighmap and i stop the baking and start it again from the script then it creates the normal amount of lightmaps.
    By investigating a little i think that it doesn't load correctly the render settings or something like that.

    If i add the lines
    Code (CSharp):
    1. ftLightmapsStorage storage = ftRenderLightmap.FindRenderSettingsStorage();
    2.         ftRenderLightmap bakery = ftRenderLightmap.instance != null ? ftRenderLightmap.instance : ScriptableObject.CreateInstance<ftRenderLightmap>();
    3.  
    4.         bakery.LoadRenderSettings();
    5.         bakery.Show();  //Temporary solution for creating the correct number of lightmaps
    6.         await Task.Delay(1000); //Temporary solution for creating the correct number of lightmaps
    7.         bakery.RenderButton(false);
    then it always works correctly. So if show the bakery window and i give it some time to load then it always creates the correct amount of lightmaps... Do you have an idea of what is wrong in how i start bakery from my script? thank you for any help
     
  43. Luvrael

    Luvrael

    Joined:
    Sep 9, 2017
    Posts:
    18
    Sometimes your asset doesn't bake scene. I've got 3 messages after press render button.
    I can't pinpoint when it happens, but I've got these messages even if I only have terrain without other objects in the scene.

    upload_2021-5-5_15-45-3.png
    upload_2021-5-5_15-45-18.png
    upload_2021-5-5_15-45-47.png
     

    Attached Files:

  44. bakelord

    bakelord

    Joined:
    Jan 19, 2014
    Posts:
    5
    We found a fix for the broken UVs - reimporting the UVs needed to be done on the *source* PC rather than on the dest mac - once that was done for the project, the lightmaps are working well everywhere :).
     
unityunity