Search Unity

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

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

  1. louistbmtl

    louistbmtl

    Joined:
    Aug 30, 2021
    Posts:
    6
    Hi, i have been playing around with bakery and loveeeeeee it, im using the remote bake server and its saving me soo much time.

    There is one thing i can seem to setup properly : for the project im working on i need to have multiple baked light situation in one big scene. From my understanding this could been done with the lightmapped prefabs, i tried to setup 2 prefabs in the scene with each their own lightmap prefab component.

    Both of these includes their respective bakery lights needed for baking.

    I was under the impression that i would be able to bake each of them one at a time by disabling the other ones during bake. But if i try to do so every time i bake a new one, it breaks the one that were previously baked. I also tried just checking and unchecking the enable baking on the prefabs and i am getting the same result.

    Then i went and took a better look at the documentation and noticed the mention about multiple prefabs in a same scene, i tried to rename the out path between each bake and or also assign each of the lightmapped prefabs a lightmap group, i tried both of the solutions and i was still getting non sense result.

    I am kind of out of resources at this point, so i wanted to know if i am missing a step or if what im trying to achieve is actually possible.

    Thanks again for the amazing asset
     
    guycalledfrank likes this.
  2. Augis1980

    Augis1980

    Joined:
    Sep 23, 2014
    Posts:
    48
    EDIT:
    I created new empty project, installed Bakery only and everything works. So something is wrong with my project apparently.

    EDIT2: Apparently it has something to do with unit tests and Assembly definitions. (That's current not confirmed theory)

    SOLVED:
    Assets\Settings\BakeryProjectSettings.asset
    "Delete Previous Lightmap" was on :DDDD

    Still the same, baking first sector always deletes the second one and baking second sector
    always messes up all other sectors
    I tried to reinstall Bakery too.

    I also get a warning :
    Code (CSharp):
    1. Cannot delete asset.  is not a valid path.
    2. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    3. ftClearMenu:RemoveFiles (UnityEngine.Texture2D) (at Assets/Editor/x64/Bakery/scripts/ftClearMenu.cs:77)
    4. ftClearMenu:RemoveFiles (System.Collections.Generic.List`1<UnityEngine.Texture2D>) (at Assets/Editor/x64/Bakery/scripts/ftClearMenu.cs:85)
    5. ftClearMenu:ClearBakedData (ftClearMenu/SceneClearingMode,bool) (at Assets/Editor/x64/Bakery/scripts/ftClearMenu.cs:105)
    6. ftRenderLightmap:RenderButton (bool) (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:1181)
    7. ftRenderLightmap:OnGUI () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2201)
    8. UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
     

    Attached Files:

    Last edited: Apr 21, 2022
    guycalledfrank likes this.
  3. Daniel_Dickinson_RCad

    Daniel_Dickinson_RCad

    Joined:
    Apr 3, 2021
    Posts:
    9
    Hey, we do something similar with appliance or furniture variants. Say we need 2 couches in a scene, but want to toggle between them at runtime. It's never 100% perfect (They'll cast different GI & shadows etc.), but if they're similar in shape you can usually get away with it.

    Try setting up a duplicate scene for the second prefab. This doesn't need to be included in the build, think of it like a dummy scene just for the light bake. If you have multiple objects with variants you can have all your second variant options in the same scene. Perform your bake for your second prefab variant in that scene, apply it to the prefab, then place the prefab in your working scene. You can now toggle between each as you like. Repeat for as many variants as needed.
     
    guycalledfrank likes this.
  4. BriBill

    BriBill

    Joined:
    Oct 8, 2019
    Posts:
    10
    Hello, I can't seem to shake this error when I press the Render Light Probes button. I've tried clearing All the data and bake settings, save, reboot, but still get this error every time. I feel like I'm missing something obvious.
    bakeryerror.JPG renderprobes.JPG
     
  5. Augis1980

    Augis1980

    Joined:
    Sep 23, 2014
    Posts:
    48
    Try changing to legacy, also you need to bake GI before rendering probes.
     
    guycalledfrank likes this.
  6. MICKDOii

    MICKDOii

    Joined:
    Jan 12, 2015
    Posts:
    69
    Well this is new to me.
    I've general had good outcomes with bakery but I have no idea why this keep happening?
    Any ideas would be great haha.
     

    Attached Files:

  7. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    That magenta looks very much like Unity's internal error shader reflecting on your surface from somewhere.
    Maybe some material in your scene is using a shader that didn't compile correctly?
     
  8. MICKDOii

    MICKDOii

    Joined:
    Jan 12, 2015
    Posts:
    69
    That was my initial thought but I specifically made a new scene with just a plane and two cubes applying new URP materials.
    That's when i became quite confused haha
    I'm going to try a new project and see if it's occurs again.
     
  9. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    hummm...
    Have you seen my avatar? :D
    Bakery is using the meta pass generated by the shader, not the pass that renders to the scene and game view, so it seems to me the URP shader didn't compile well.
    Have you upgraded form Unity 2020 LTS to Unity 2021 LTS perhaps?
     
    guycalledfrank likes this.
  10. MICKDOii

    MICKDOii

    Joined:
    Jan 12, 2015
    Posts:
    69
    Compiling seems more the likely the issue here as you said.
    I'm using 2021.1.25f1
    Doesn't seem to effect the new project I made.
    Weird.
     
  11. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Unity 2021 seems to have serious issues with shader caching and compilation taking ages.
    Shaders taking ages to compile has been an issue for all shader programmers in Unity for a long time, but it was never taken seriously by the Unity team until URP and HDRP came along with their ten million shader compilation derivatives and literally hours of compile time, so I guess they are trying to speed that up but it broke compilation in the process.
     
  12. SGJbrown

    SGJbrown

    Joined:
    Jul 9, 2021
    Posts:
    4
    Regarding the reflection probes issue in Unity 2021.2.3f1:
    I tried deleting the lighting data assets but it did the same thing. Same errors, and the reflection probe doesn't work when I reload the scene. I'm getting the same errors about the probes file when I bake example_sponza_day. Along with some very broken lightmaps.

    Any other ideas on how we can get it working in 2021.2.3f1 ? Or would we have to upgrade to 2021.2.4 ?
     

    Attached Files:

  13. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    633
    Noob to unity here, so excuse the question. But is it possible to get specular highlights from fully baked lights with this asset? Not indirect specular in shadowed areas but something that would solve this problem.
     
  14. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    blueivy likes this.
  15. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    633
    Thanks for your swift reply @atomicjoe one final question. I plan on using this tool to also bake in AO for my dynamic objects. Think this method but in bakery
    https://forum.unity.com/threads/lig...maps-as-simple-textures-any-drawbacks.207592/

    Does the sound like something that I could do or do you see me running into any pitfalls? Also regarding this topic I saw a twitter post by @guycalledfrank saying this, do you know if that's still possible as that would help a lot

    "Noted :) BTW it's almost undocumented, but you can also bake tangent-space SH (there is an obscure checkbox on the skylight component). I added that to experiment with specular occlusion on dynamic objects. SH gives slightly better precision comparing to BN, albeit at 4x tex cost"

    https://twitter.com/guycalledfrank/status/1163159051527696384?s=20&t=wOAmjltJCrsJYLh6c_BcCw
     
    guycalledfrank likes this.
  16. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    The last time I wanted to do that, Bakery didn't support lightmapping skinned objects, so I ended using per vertex AO on my character, but now it does and I was planning on rebaking my character using Bakery but haven't done it yet, so I can't tell, but there is some details in the manual about it:
    https://geom.io/bakery/wiki/index.php?title=Manual#Skinned_mesh_renderer_support

    Aside from that, you will need to use Bakery's prefab support to avoid issues with conflicting lightmaps when moving your lightmapped objects to another scene:
    https://geom.io/bakery/wiki/index.php?title=Manual#Bakery_Lightmapped_Prefab
     
    guycalledfrank and blueivy like this.
  17. m4robb

    m4robb

    Joined:
    Aug 2, 2017
    Posts:
    38
    upload_2022-4-27_9-31-15.png

    hi peoples, I'm trying to do a prefab bake. I get this error, can't load UVBuffer tangent. I searched for this issue here and in the discord maybe I'm doing something stupid, but does anyone know what would cause this?
     
  18. m4robb

    m4robb

    Joined:
    Aug 2, 2017
    Posts:
    38
    ah ha! figured it out, the fix for anyone else having this problem, make sure Tangent-space SH is disabled in the experimental settings in your skylight object
     
    blueivy likes this.
  19. aler_buffon

    aler_buffon

    Joined:
    Dec 9, 2015
    Posts:
    22
    Hello, I can't bake shadow if vertex is set in Lightmap Group. I have a model with lods, so I use XAtlas, on my models everything is baked correctly, but there is no shadow. Is it possible to fix this in the settings or is there no such possibility yet?
     
  20. JacobDzwinel

    JacobDzwinel

    Joined:
    Dec 19, 2013
    Posts:
    26
    Hey,
    Can you point me where I can find the whole list of modified assets used by UV padding? I have to revert them to the previous state.

    upload_2022-4-28_17-14-45.png

    Thanks
     
  21. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    guycalledfrank likes this.
  22. Daniel_Dickinson_RCad

    Daniel_Dickinson_RCad

    Joined:
    Apr 3, 2021
    Posts:
    9
    Hey, were you able to test & reproduce? We're going to market shortly & still haven't been able to resolve these artefacts. Managed to soften them somewhat by increasing samples on both the lights & the bake, which helps, but it's obvious the root cause is still their & they're giving us grief. Any help is greatly appreciated.
     
  23. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Super noob question but I would like to use RNM, how do I switch out the standard shader for the Bakery Shader? Without spending HOURS across my whole scene?
     
  24. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Well, you go to each material in your scene and change the Standard or SRP shader in them to the Bakery one.
    You can also search your project for all materials, select them all and change the shader for all of them at once, but that will only work if all your materials use the same Standard shader (which is not usually the case).
    Other than that, I'm afraid you will have to find a solution in the asset store. Maybe something like Monkey could help, but I haven't tried.
     
    guycalledfrank likes this.
  25. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Yeah, there weren't as many shaders as I was afraid of. I did it manually. Maybe I'll dive into Monkey a little deeper later on.
     
    guycalledfrank likes this.
  26. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Having some issues. I have many point lights and one directional light. I've added the Bakery Point Light script to each Point Light and Bakery Direct Light to my Directional Light. They have all set their Baked contribution to Indirect Only. The are all also using the Bakery/Standard shader.
    When I try to Bake with
    Render Mode - Indirect
    Directional Mode - RNM
    Texels - 40
    Bounces - 4

    I finally get a result saying 230 Lightmaps will be baked. I hit continue & then BANG! An Error window. The console shows "ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection"

    Looks like an error in the script, are there some settings I'm getting wrong?
    Thanks.
     
  27. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    @guycalledfrank Well it appears I am unable to use Bakery. Even after a complete removal and install. Each time I install I get the following error:

    Import FBX Error.
    Shader Error in Bakery/Example Shader with Normal Meta Pass. 'Couldn't open include file Bakery/BakeryMetaPass.cginc in line 53.

    But this file does exist at that location. Not sure what's up.
     
  28. LoveOSGames

    LoveOSGames

    Joined:
    Mar 18, 2015
    Posts:
    3
    Hi, I installed and uninstalled Bakery, however it leaves me with an error I couldn't remove:

    Code (CSharp):
    1. Script attached to '!ftraceLightmaps' in scene 'Assets/Scenes/Player Room.unity' is missing or no valid script is attached.
    Please help me fix this :) I used the unity's default search bar and I couldn't find any object named '!ftraceLightmaps'
     
  29. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Reinstall Bakery and click on the menu:
    Bakery -> Utilities -> Clear Baked Data -> Clear From Scenes -> ALL (Data and Bake Settings)

    Do this on all affected scenes.
     
    LoveOSGames likes this.
  30. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    OK, done!

    upload_2022-4-30_15-16-10.png

    Look like you just a need a brighter Skylight.

    Interesting. Thanks for the investigation! I didn't even know about parallel asset import before. This seems to be the cause:

    upload_2022-4-30_15-22-28.png

    Although Bakery fills out that static dictionary once and before the importing is started. But it looks like using any static variables is unreliable when parallel import is enabled.

    OK, I've added a fix that detects if the parallel import is enabled and supplies texture importing data via ftGlobalStorage.asset instead of the static dictionary. Seems to work. Please try updating to the latest patch.

    I just... didn't create it yet. Wasn't sure if the rotatable volumes will be widely used.

    Thanks, tested it. But where should I look?

    upload_2022-4-30_16-59-39.png

    upload_2022-4-30_17-0-16.png

    I think it's related to this: https://geom.io/bakery/wiki/index.p..._in_one_scene_breaks_its_UVs_in_another_scene

    ---

    To be continued...
     
    atomicjoe likes this.
  31. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,665
    I have the issue that patches won't download via the Patcher anymore. I always get these errors:
    • Curl error 18: transfer closed with 266067 bytes remaining to read
    • Download error (bakery-csharp)
      UnityEngine.Debug:LogError (object)
      ftUpdater: DebugLogError (string) (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:50)
      ftUpdater/<DownloadItem>d__14:MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:70)
      ftUpdater/<DownloadItemIfNewer>d__16:MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:136)
      ftUpdater/<CheckProc>d__17:MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:165)
      ftUpdater:CheckUpdate () (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:258)
      UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

    Now this one just popped up and "replaced" the other two:
    • Can't insert to database: Array <br>
      UnityEngine.Debug:LogError (object)
      ftUpdater: DebugLogError (string) (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:50)
      ftUpdater/<DownloadItem>d__14:MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:77)
      ftUpdater/<DownloadItemIfNewer>d__16:MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:136)
      ftUpdater/<CheckProc>d__17:MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:165)
      ftUpdater:CheckUpdate () (at Assets/Editor/x64/Bakery/scripts/ftUpdater.cs:258)
      UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

    No idea what's going on :confused: I've completely removed my current installation and re-downloaded Bakery from the Asset Store - no change. Then manually patched via GitHub - no change. Seems like the Patcher itself got broken at some point?!
     
  32. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Alternatively, you can try using some lightmap switching scripts, like this one or Magic Lightmap Switcher.

    It's good that you checked filename conflicts; make sure it's not also related to the UV padding adjustment (maybe set Asset UV processing to Remove Adjustments, just in case).

    So was it solved or not?

    Weird... but seems harmless.

    If your Light Probe mode is L1 (default), then the light probes are actually rendered anyway, when you click Render. And you shouldn't see this message when the Light Probe mode is Legacy.

    If you have a specific use case, please try getting the latest patch. there is possibly some related fix.

    Yeah, looks like what atomicjoe said. Meta pass of the shader is likely broken.

    Are these just regular URP Lit shaders or some special shaders?

    Oh god, what's on the screenshot? It doesn't look reflection-probe-related. Please check if it happens without the denoising or with OpenImageDenoise (driver bug?).
    As for the reflection probes, I still couldn't reproduce it and haven't heard other reports about it :(

    Kinda: https://geom.io/bakery/wiki/index.p..._can.27t_see_specular_lighting_after_the_bake

    Yes, you can use Bakery to bake AO maps, but note:
    - Standard Unity shaders usually take UV0 for AO. Bakery will use UV0 if UV1 is not present in the model.
    - You don't want additional atlas packing in this case, so use a Lightmap Group with the Original UV mode.
    - AO maps need to be 8-bit, not HDR.

    Thus:
    - Make sure your model doesn't have UV1.
    - Put a Lightmap Group Selector on your object, set packing mode to Original UV, choose resolution, create the group.
    - Bake.
    - Convert the resulting .hdr lightmap into some regular 8-bit format (i.e. TGA/BMP/PNG...)
    - Et voila, use it as an AO map in a typical PBR shader.

    Yeah, you can do this too, but it requires a special shader code to use.

    You can also bake AO maps with Dominant Direction mode enabled; resulting directional maps can be used as object-space bent-normal.

    Oh, now it does.

    Interesting. Tangents are used if:
    a) Directional Mode is RNM
    b) Directional Mode is SH and "Tangent-space SH" is enabled on the Skylight (if it is, it probably shouldn't be)

    Is any of this the case?

    ...yes

    So xatlas OR per-vertex? If it's per-vertex, maybe you don't have enough vertices?

    You can rebake with Asset UV Processing set to Remove UV Adjustments. It will do exactly what you said.
    In any case, the list is also in ftGlobalStorage.asset. You can actually select this asset directly in Inspector and check the modifiedAssetPathList property.

    Weird... can you
    1. Check the latest patch?
    2. If the issue persists, tell me the line number at which the error occurs?

    Are these 2 separate errors? Example shader and FBX import are separate issues. Disregard the example shader issue, you can even delete it. It just can't find the include file since some Unity update.

    Yeah, sadly it's invisible. Before removing Bakery, you can
    - Close Bakery window
    - Click Bakery->Utilities->Clear baked data->Clear
    - Remove it

    Then there will be no !ftraceLightmaps.

    Alternatively, you can use this little script to select the object (and delete it):


    using UnityEngine;
    using UnityEditor;

    public class ftDebugSelect2 : ScriptableWizard
    {
    [MenuItem ("Bakery/Debug select storage")]
    public static void DebugSelect() {
    var objs = new Object[1];
    objs[0] = GameObject.Find("!ftraceLightmaps");
    Selection.objects = objs;
    }


    This looks like some network (or firewall?) issue.

    But this looks like some server issue! Can you please DM me your invoice/username? I'll test it here.
     
    blueivy likes this.
  33. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,665
    This is what I initially thought too, but... other than upgrading to 2021.3, there's not much what changed.
    Will do :) Because after testing something, I come to think that it might indeed be a server-side issue.
    .
     
  34. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    So apparently it's not related to the data! The server just went out of disk space due to infinitely growing log files somehow. I deleted those for now, I'll also limit their size in the future. Patcher seems to work for now.
     
    Mauri likes this.
  35. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,665
    Can confirm it's working again - yay :)
    .
     
    guycalledfrank likes this.
  36. Daniel_Dickinson_RCad

    Daniel_Dickinson_RCad

    Joined:
    Apr 3, 2021
    Posts:
    9
    Hey, so the issue only occurs when using smaller lights. We use a drone shot sky-dome & directional lights for the base lighting conditions & they work fine. It's only when smaller lights are introduced for the recessed & feature lighting that we begin to see problems. Right now we are using small area/light-mesh lights, though we did experiment with spotlights & you're new IES lights & both show similar issues. I posted screen-shots detailing the exact lighting & settings we are currently using, though we've experimented with a bunch of different scenarios & couldn't remove the issue entirely.

    Could you try baking with some small spotlights or area lights & see if you can reproduce the issue? Before this job I sold on the asset-store (Dynamic Decals). I know it's insanely time consuming & stressful running tests for every customer who has issues. I would not ask if I was not already 2 weeks in trying to solve this specific issue & at my wits end. I appreciate you spending the time, you have an amazing product.
     
    guycalledfrank likes this.
  37. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    guycalledfrank likes this.
  38. Wawruch2

    Wawruch2

    Joined:
    Oct 6, 2016
    Posts:
    68
    Hi! I'm about to realese environment to Unity Asset Store. Bakery is essential part of the lighting in the environment. I want someone to be able to at laest view the environment without bakery, and then if he wants to rebake or change the environment he will need to buy bakery. Currently I'm unable to do it without these files ->

    Unity is losing the location of lightmaps and the scene is broken after importing package. Am I able to put these files inside the package? Or is there any workaround to make sure that lightmaps are connected with lightmap data?
     
  39. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Read this:
    https://geom.io/bakery/wiki/index.p..._who_doesn.E2.80.99t_have_Bakery_installed.3F
     
    Wawruch2 and guycalledfrank like this.
  40. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    142
    Hi, when rendering it gets stuck at 50%





    I'm using multiple terrains in different scenes.
    Here are my settings:



    I'm using Unity 2020.3 Built-in. I can't also cancel it but I have to end Unity in order to cancel it.
     
  41. SGJbrown

    SGJbrown

    Joined:
    Jul 9, 2021
    Posts:
    4
    Hi Frank,
    Here's a package with a test scene that shows the reflection probe problem that I've been running into with Unity 2021.2.3f1.
    1. I click "Bake Reflection Probes" the reflection probe in my scene seems to bake fine. And the sphere in the scene has a reflection. I save the scene
    2. I open a different scene and then reopen this test scene. Reflection for the reflection probe is gone. It doesn't seem to know what Reflection map to use.
    3. Baking the reflection probe again creates a new reflection map and reflection shows up again.
    4. I save the scene, close the scene and reopen the scene, reflection is gone again
    Note: this also happens when I try to bake a reflection probe in sponza_day
     

    Attached Files:

  42. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    142
    Nevermind, I just updated bakery and I could bake
     
    guycalledfrank likes this.
  43. Woodwright

    Woodwright

    Joined:
    Dec 9, 2012
    Posts:
    1
    Is there a way to output Shadowmask + Direct and Indirect, instead of just Shadowmask + Indirect?
     
  44. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    937
    Hi,

    in Unity 2021.3.1 with HDRP 12.1.6
    i get following error with the Bakery SH und RMN Graphs
    test.JPG
     
  45. mowax74

    mowax74

    Joined:
    Mar 3, 2015
    Posts:
    97
    I have a question related to the _tempScene. It seems like this is used to create the light probes somehow?

    My problem is: I have several independent scenes with location models in it, let's call it levels. Every scene is assigned to their own asset bundle, that is delivered via our server to the client build. When i now create a new scene or rebake the lightmap in one scene, the _tempScene gets updated. But each scene in all the indepentent scene asset bundles link to the same _tempScene. When i now build the asset bundle, every asset bundle is rebuild that links to the _tempScene. But the changes are only relevant for one scene, so a bunch of asset bundles with lightmapped scenes in it are getting rebuilt even when there are no changed related to them.

    When i change the scene attribute in the probes asset to a different scene and i rebake the scene, it get's reset to the _tempScene.

    So the question is: How can i set a separate tempScene for each scene i want to bake so that it not has an impact on the other scenes asset bundles?
     
  46. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Have you tried to manually clear the bakery cache after each bake?
    That may break the link with the probes asset, since it deletes the temp scene. (even if it recreates it, it's technically a new scene, so the link should break)
    Bakery -> Utilities -> Clear Cache
     
    mowax74 likes this.
  47. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    EDIT: more info after this post

    @guycalledfrank I'm having big problems with modified meshes with their lightmap UVs unwrapped using Unity's Unwrapping.GenerateSecondaryUVSet method to generate the lightmap UVs:
    If I set the Pack Margin higher than zero, the meshes get smaller and smaller on the rendered lightmaps.
    I can't set the pack margin to zero because there are then ugly seams in the corners of the mesh, and increasing the object's "Scale in Lightmap" in the properties don't make them any bigger in the render, but increases the lightmaps void space by a lot. (enabling or disabling the "alternative scale in lightmap" option doesn't change this)
    Enabling Bakery's UV adjust doesn't fix any of this and increasing Bakery's texel padding doesn't fix the ugly seams I get when using a pack margin of zero (it only seems to increase the distance between different objects UVs as a whole)
     
    Last edited: May 7, 2022
  48. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Ok that's what I'm doing:
    I use regular primitive gameobjects in my scene like cubes and spheres, and then apply a script that processes them and swaps the original primitive meshes for procedurally modified clones of those meshes.
    In the process, I have to recalculate the lightmap UVs, because I end up with bevels and stuff that wasn't there before.

    So after all that, I'm baking the final 3D scale (lossy scale) of the objects directly into their meshes (since I'm already generating them, I thought it would be a good idea to bake the scales into the mesh itself so that the lightmaps are not stretched afterwards)

    Bizarrely, I only have problems when I do that. If I just modify my meshes and don't re-scale them to world scale, then all is good and the render is good.
    But if I re-scale the meshes to world scale (and thus set the transform scale to 1) then I have plenty of issues with padding and dark seams in the lightmaps.
    This is very confusing...

    Is there something I should know to make this work better?
     
  49. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Bakery's UV adjust seems to only affect imported assets, not procedural meshes in the scene.
    It would be great if we could put a Bakery component on a gameobject to ask Bakery to adjust its specific mesh UVs before rendering as it does with the rest of imported assets.
     
  50. mowax74

    mowax74

    Joined:
    Mar 3, 2015
    Posts:
    97
    Thanks a lot, that pointed me in the right direction. Deleting the cache is not deleting the tempScene, but i deleted it manually. When the next scene is baked, the tempScene is recreated. But like you said there is no link or reference from the other scenes anymore to this tempScene.
     
    atomicjoe likes this.