Search Unity

  1. 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.71) + RTPreview [RELEASED]

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

  1. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    218
    Another sequence of errors, unrelated to the first post

    upload_2019-10-9_10-41-56.png

    upload_2019-10-9_10-42-29.png

    upload_2019-10-9_10-42-47.png

    Press continue, then
    upload_2019-10-9_10-42-58.png
     

    Attached Files:

    • log.txt
      File size:
      12.4 KB
      Views:
      263
  2. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    128
    I'm having a weird problem with baking with SH (spherical harmonics) and somehow world direction aligned brightness inconsistency. I made some screenshots. I've only noticed this on walls / world aligned flat things. And actually it happened in at least one other unrelated project where I just switched to dominant direction. But would like to understand wtf is going on.

    In the screenshots, B means Bright and D means Dark. The correct (dominant direction like) values should look like the B ones. It's not tied to the sun direction and the sun doesn't get in there anyway. It's not the reflection probes either. The walls and unity cubes etc are on a lightmap group set to SH. The walls are actually all one mesh. I baked the whole scene not just certain groups or prefabs.

    SH Directional imprecision.jpg
     
    Last edited: Oct 11, 2019
  3. Abrasive

    Abrasive

    Joined:
    Jul 24, 2019
    Posts:
    11
    Here is a great article about how you can disable obsolete warnings in Unity: Link :)
     
    guycalledfrank and keeponshading like this.
  4. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Lighting data asset is only required for probes. Bakery doesn't need it for lightmaps.

    Ah yes, that's a known one. Get the patch.

    Hmmm. Doesn't look right. Is the ceiling using the same material as walls? It is possible there is SOME inconsistency on the walls, as instead of accurately calculating dot(lightRay, normal) for hundreds of rays per texel, we're actually approximating irradiance with a few SH coefficients at runtime. BUT it definitely shouldn't give such a large difference between walls/ceiling.
    Does it happen with a smaller part of this scene, e.g. a tiny room with just 4 walls, ceiling, floor with no other props? If so, can you send me a unitypackage of this scene to debug?
     
  5. gingernugget

    gingernugget

    Joined:
    Dec 1, 2015
    Posts:
    4
    Is it possible to use Bakery to handle the lighting of an asset pack that will then be published to the asset store or would this require Bakery being included as part of that pack?

    It produces much better, faster results than Unity standard. I'd love to use it to render a sample scene, but not sure what this would mean for me uploading the pack to the store?
     
    guycalledfrank likes this.
  6. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    218
    If it had worked I wouldn't have made the post. In the scene view baked lightmaps was empty. That was my second attempt, with the first attempt also silently aborting.

    Normally in such a long process, at the end of the logs I would expect some message relating to success or completion. As I indicated, there was nothing like that. It was a long list of processing that suddenly stopped.
     
    Last edited: Oct 14, 2019
  7. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    128
    I don't know what's going on. I made a new project, used unity meshes, and it still does this. It is like the +X, +Y, and +Z axes are bright, and -X, -Y, and -Z are dark with SH.
    Here is the project: https://drive.google.com/file/d/1N9SbSwhqxReD8QuAb2pTduB61mE1p34U/view?usp=sharing

    [Edit] If you rotate the house by 45 degrees and bake again, then every wall is a different brightness actually
     
    Last edited: Oct 14, 2019
  8. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    93
    One thing I always miss with baked lighting is specular highlights. I see your custom shader can support it - how would we go about getting that in our own shaders too? Or perhaps more appropriately how can I use RNM and SH modes with a custom shader?

    Bonus points if you can tell me how to do it with Amplify Shader Editor.
     
  9. cbboyer

    cbboyer

    Joined:
    Jun 2, 2014
    Posts:
    15
    Question for Frank, and anyone else here working with Oculus Quest:

    Is there any known way to export textures + lightmaps, flattened into one set of images? I'm trying to optimize for VR performance as much as possible, but the Android lightmaps simply don't look as good - even with lightmap compression turned off completely. The end goal is to use LWRP's Unlit shader, which would solve a huge number of problems in my project.

    So say I run a high-res, full lighting SH bake that looks beautiful. Obviously SH produces multiple images per lightmap, and isn't too viable on mobile. Is there any known exporter, Unity asset etc that would let me simply export my textures, with the SH maps included as they're displayed in the scene, but flattened into Unlit images? Lighting and textures combined into one massive image. I've used MeshBaker extensively but there's no feature to capture the existing lightmap as well and flatten it into a texture.

    Any thoughts?
     
  10. douduck

    douduck

    Joined:
    Jan 15, 2014
    Posts:
    2
    Hello,

    I used Bakery 1.6 with Unity 2018.1.9f2, and I found that some of the models will generate different lightmap UVs on different computers. The mismatch of the UVs will lead to the error lightmap sampling result when open the project to another PC.

    All the computers are Windows 7 or 10, having the same Unity version, the same Bakery version.
    Adjust UV padding is disabled.
     
  11. Softelectro

    Softelectro

    Joined:
    Oct 9, 2013
    Posts:
    24
    Hello,

    We use bakery in Unity 2019.2.7, and we have an issue. We can't see the baked lightmap parameters (tilling, offset, preview) in lightmapping after the bake.
    More info:
    • We have no warnings or errors
    • We have tried with Bakery 1.6 from asset store
    • We have tried with the lastest version on github (October 2nd)
    • It works with enlighten or progressive
    Thanks in advance
     
  12. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    893
    There is no tool for that and here is the reason why:
    Lightmaps and regular textures use different texture coordinates (UV1 for regular textures and UV2 for lightmaps) so it's not as simple as combine the textures with the lightmaps (because they wouldn't match), you would need to render your regular textures INTO the lightmaps, and then, you would lose a lot of regular texture resolution (because lightmaps use lower overall resolution than regular textures).
    You can check this out when baking lightmaps without directional lighting (using Baked Normals): you will see the loss of resolution in the normal maps (as they get backed into the lightmaps). That's why Dominant Direction, RNM and SH Lightmaps exist: to keep 3d models normal maps separated from the actual lightmap resolution.
    You could increase global lightmap resolution and use the "Baked Normals" mode, but then you would end up with massive textures that would choke mobile hardware anyway and using the regular way would be faster.

    My advice for Oculus Quest: use low resolution Dominant Direction baking along with the Bakery Shader (to get specular lighting in your scene) and increase the normal map strength in your materials to compensate for the lack of normal map contrast.
    You can't have more quality to performance ratio than this.
     
  13. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    893
    Hey @guycalledfrank , I've been busy with other things and didn't follow Bakery's progress so... does Bakery support tinted transparency already? :p
    I'm on mobile hardware so I can't just use projectors for this (and projectors are monochromatic anyway)
     
  14. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    893
    If it's not supported, you know what would be cool™?
    For Bakery to support colored light cookies.
    That would fix all our windows and stained glass needs.
    Unity only supports monochrome light cookies, but I'm quite sure OptiX supports them in color.
     
  15. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    You can include a small part, these 5 scripts should be enough: https://geom.io/bakery/wiki/index.p..._who_doesn.E2.80.99t_have_Bakery_installed.3F

    There were baked lightmaps on your screenshot though (?). If you mean Unity's "Baked lightmap" viewing option, it doesn't really work for Bakery (and any external lightmaps in general) for reasons unknown (seems to be not respecting actually used scene lightmaps, but reading some undocumented data from the ligthing asset). You can use Bakery's Checker Preview option as an alternative.

    After the bake is done you should normally see "Rendering finished in X seconds" in console.

    Well that was a fun one to debug. The first symptom was L1x/L1y/L1z textures being set to sRGB for some reason. But Bakery is supposed to automatically set texture import settings to correct values, right? The problem was, your output path had "\" slashes, but Unity used "/" ones when importing assets, and so asset string comparison failed :D
    I added a patch to gitthub: https://github.com/guycalledfrank/bakery-csharp/commit/ae3dad034dcba82195e214064b604330398aec98

    - It is quite easy to add RNM/SH to Unlit shaders. Can show you how.
    - Quite problematic to add RNM/SH to Surface shaders, as these do not have any baked lighting override. You can probably just modify Bakery shader instead.
    - Should be now possible with Shadergraph, since they added custom baked lighting input, but I haven't tried yet.
    You can use this code for reference: https://github.com/guycalledfrank/bakery-hdrp-shaders/blob/master/BakeryHDRP.hlsl
    Check BakerySH() and BakeryRNM() functions.

    You should definitely try "Baked Normal Maps" instead of SH. It should just bake normal mapped lighting directly to color lightmaps. No additional maps, no special shaders. The results are also more precise than SH (but well, bumped details will be only as sharp as lightmaps are).
    ... or do what atomicjoe says :)

    - Do you use Unity's "Generate lightmap UVs" checkbox on these models? AFAIK it's guaranteed to work the same across machines. If not, it should affect all lightmappers, and you should ask Unity.
    - Using xatlas? If so, it might be a bug I should report to xatlas dev.
    - Did you ever bake them with the "Adjust UV padding" before? Adjustment instructions were saved for these models and remain even after re-baking them with the checkbox off. You can try to Clear asset meta on them and reimport.

    Yeah, I think Unity broke it and some other things as well: https://forum.unity.com/threads/modifying-data-shown-in-baked-lightmaps-open-preview.617620/
    It seems like there is no longer a direct link between the lightmaps used and the values shown in UIs.
    You should still be able to get correct values via scripts.

    Not yet :( You can kinda fake it with cookie lights though.

    Well it is supported, isn't it? You can set point light projection mode to Cookie and put any colored textured there. In fact, you can even put HDR textures there. Unity's monochromatic rules do not apply.
     
    Tudor likes this.
  16. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    893
    OH I DIDN'T KNOW! You made my day! :D
     
    guycalledfrank likes this.
  17. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    218
    Right, Bakery generated some lightmaps, then aborted and didn't finish. I indicated this in both of my posts and included the log.
     
  18. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    93
    We use Amplify for shaders generally as otherwise my artists can’t do anything with them if they need to change things. However Amplify has a lighting override in its template so I can use that.
     
  19. DEShaders

    DEShaders

    Joined:
    Dec 30, 2018
    Posts:
    73
    Hi frank
    could you give some more info on the "DynamicCapsule" found in the Bakery demo and what scripts could be found for Realtime baking light probe data ?

    cheers
     
  20. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    Hi, I upgraded to the latest version (deleting all the old Bakery files) on my current project. Well, I started with just using the update feature on the Unity store, then after getting this error I started from scratch) and I am now getting this error:
    MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    ftBuildGraphics+<ExportScene>c__Iterator0.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftBuildGraphics.cs:3676)

    and am unable to bake lighting in any of my scenes now using Unity 2017.4.28 (as per a limitation of VRChat). It use to work great. Any ideas?

    EDIT: I got the patch from the git and it fixed my issue. Thanks
     
    Last edited: Oct 17, 2019
    guycalledfrank likes this.
  21. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Your log says
    >Rendering finished in 16602.227 seconds

    I can't see any error messages below that.

    Maybe. I have no experience with Amplify so far.

    Just a regular dynamic object, not baked. I included it there to demonstrate light probes and dynamic shadows that mix with the shadowmask.

    ??
    You can just click Render Light Probes to bake them (maybe I didn't understand the question).

    Ah, seems like it's time to release these patches as v1.65 or something.
     
  22. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    93
    It might be that I need to add it to the template, we shall see. Presumably I should just be looking at Bakery.cginc's BakeryRNM and BakerSH for non-HDRP?
     
    DEShaders likes this.
  23. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    128
    What are all the log files that Bakery generates and writes to, and where are their paths located? I searched both this forum and the wiki and couldn't find anything.

    I'm getting a "UVGBufferGen Error: Can't map texture" "Can't save UV pos" and I have to find out what mesh or texture or uv this refers to.

    [Edit] @guycalledfrank I hunted down my crash error and it seems that when a convex emissive mesh is very thin or very small, it throws this error. For ex I had some unity cubes I had set on Z to very small (0.001) and that caused it. It does not seem to happen with a quad or other custom one-sided-only meshes.

    [Edit2] Actually on some of them even after making them slightly bigger it kept crashing until I disabled selfshadow. The really big ones are fine.
     
    Last edited: Oct 18, 2019
  24. DEShaders

    DEShaders

    Joined:
    Dec 30, 2018
    Posts:
    73

    it would be wonderful to develop a custom expression node in ASE to call in the full power of bakery and build a few function graph nodes for it .. its been on a to do list for a long time

    poke poke @ Frank ;)
     
  25. alex_93v

    alex_93v

    Joined:
    May 22, 2014
    Posts:
    2
    I'm getting a "denoiser error: Unknown error (1)",

    I'm baking(locally) with the latest files from both git repos.
    Tried both "denoise" alone and "denoise: fix bright edges".
    Baking without denoiser succeeds everytime but obviously with lots of noise.
    I'm using the HDRP

    Do you know what might cause it?
    Is there a way to fire the denoiser afterwards?

    EDIT: I downloaded v1.6 again and its working now



     
    Last edited: Oct 18, 2019
    guycalledfrank likes this.
  26. Laiskis

    Laiskis

    Joined:
    Aug 30, 2018
    Posts:
    2
    Hello,

    I've managed to beautifully lightmap the objects in my scene with Bakery in Unity 2019.2.5f1. Due to poor planning, I'm now tasked with transferring this scene (models and baked lighting) to another project that is locked on Unity 2018.3.5f1.

    I'm looking for help / documentation of any process that could enable this. My go to approach of packing the scene containing the models and all dependencies in a unitypackage and importing that did not work out. Most of the scene looked fine and as expected, but some parts seem to be suffering from some UV issues. They're clearly mapped to incorrect parts of the atlas.

    What could be the key issues here? Unity re-importing the model files and fiddling with UVs causing the mismatch? (I'd expect this to affect all models in the scene) Bakery-made UV changes not transferring with my package? Bakery Editor-files not liking the Unity version change?

    Sorry for so many questions. I'm already past my original project deadline so I'm trying to be thorough in explaining my issues. I'd be extremely grateful if anyone can help in any way!
     
  27. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    585
    Because i have no experience about baking larger structures than a car i must come back to a post from you on page 1.
    What is the best strategy to bake the road and gras mesh of a longer structure, here 4km, like the track in the middle.


    Ismaning BMW Testgelände Aerial.jpg

    Out of performance reasons and to run compute shader for wheatering and gras the gras and the road mesh is 4km long.

    e.g the gras mesh

    004.JPG

    zoom in
    002.JPG
    same for the road mesh
    With this UV layout for texturing.


    005.JPG

    One vertex color is already used for wheatering and the mesh density is not enough for baking to to another vertex color.

    Do you have reommendations for best practice like on your city from your post?
    Splitting up the mesh would be performance loss and raise the draw calls a lot (doubles per cut in some camera perspectives). Gras shader and surface wetness are constructed in DX11 compute shaders and are better to handle too.
    The gras shader also pick s up the surface color from the gras mesh. So i have to bake it to get nice gras color integration from ground to gras with the correct color per illumination.
    Here a test.

    DX11Grass_Test001 (3).JPG


    4km on a 8K Lightmap Layout? Think it is not enough.
    Baking the probes is another fun topic.
    How would you solve this?
    I need to bake to UDIMS?.)
     
    Last edited: Oct 18, 2019
    guycalledfrank likes this.
  28. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    157

    Ok but can you at least show us how to resolve them so that we can eliminate the warnings and clear out our console. We could resolve them ourselves but I can't be sure that I have the correct fixes here are the warning I need resolved:

    Warning CS0612 'ColorPickerHDRConfig' is obsolete BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\shader\Editor\BakeryShaderGUI.cs 119 N/A
    Warning CS0612 'ColorPickerHDRConfig' is obsolete BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\shader\Editor\BakeryShaderGUI.cs 119 N/A
    Warning CS0618 'PrefabUtility.GetPrefabType(Object)' is obsolete: 'Use GetPrefabAssetType and GetPrefabInstanceStatus to get the full picture about Prefab types.' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\BakeryLightmappedPrefab.cs 22 N/A
    Warning CS0618 'PrefabType' is obsolete: 'PrefabType no longer tells everything about Prefab instance.' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\BakeryLightmappedPrefab.cs 22 N/A
    Warning CS0618 'PrefabUtility.FindPrefabRoot(GameObject)' is obsolete: 'Use GetOutermostPrefabInstanceRoot if source is a Prefab instance or source.transform.root.gameObject if source is a Prefab Asset object.' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\BakeryLightmappedPrefab.cs 29 N/A
    Warning CS0618 'PrefabUtility.FindPrefabRoot(GameObject)' is obsolete: 'Use GetOutermostPrefabInstanceRoot if source is a Prefab instance or source.transform.root.gameObject if source is a Prefab Asset object.' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\BakeryLightmappedPrefab.cs 39 N/A
    Warning CS0618 'PrefabUtility.GetPrefabObject(Object)' is obsolete: 'Use GetPrefabInstanceHandle for Prefab instances. Handles for Prefab Assets has been discontinued.' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\BakeryLightmappedPrefab.cs 46 N/A
    Warning CS0618 'PrefabUtility.GetPrefabObject(Object)' is obsolete: 'Use GetPrefabInstanceHandle for Prefab instances. Handles for Prefab Assets has been discontinued.' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\BakeryLightmappedPrefab.cs 81 N/A
    Warning CS0618 'EditorApplication.hierarchyWindowChanged' is obsolete: 'Use EditorApplication.hierarchyChanged' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\ftLightmaps.cs 278 N/A
    Warning CS0618 'EditorApplication.hierarchyWindowChanged' is obsolete: 'Use EditorApplication.hierarchyChanged' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\ftLightmaps.cs 279 N/A
    Warning CS0618 'MaterialEditor.TexturePropertyWithHDRColor(GUIContent, MaterialProperty, MaterialProperty, ColorPickerHDRConfig, bool)' is obsolete: 'Use TexturePropertyWithHDRColor(GUIContent label, MaterialProperty textureProp, MaterialProperty colorProperty, bool showAlpha)' BakeryRuntimeAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Bakery\shader\Editor\BakeryShaderGUI.cs 343 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 1148 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 1157 N/A
    Warning CS0618 'PrefabUtility.GetPrefabParent(Object)' is obsolete: 'Use GetCorrespondingObjectFromSource.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2048 N/A
    Warning CS0618 'PrefabUtility.GetPrefabType(Object)' is obsolete: 'Use GetPrefabAssetType and GetPrefabInstanceStatus to get the full picture about Prefab types.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2051 N/A
    Warning CS0618 'PrefabType' is obsolete: 'PrefabType no longer tells everything about Prefab instance.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2052 N/A
    Warning CS0618 'PrefabUtility.GetPrefabParent(Object)' is obsolete: 'Use GetCorrespondingObjectFromSource.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2068 N/A
    Warning CS0618 'PrefabUtility.GetPrefabParent(Object)' is obsolete: 'Use GetCorrespondingObjectFromSource.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2163 N/A
    Warning CS0618 'PrefabUtility.GetPrefabType(Object)' is obsolete: 'Use GetPrefabAssetType and GetPrefabInstanceStatus to get the full picture about Prefab types.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2171 N/A
    Warning CS0618 'PrefabType' is obsolete: 'PrefabType no longer tells everything about Prefab instance.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2172 N/A
    Warning CS0618 'PrefabUtility.GetPrefabParent(Object)' is obsolete: 'Use GetCorrespondingObjectFromSource.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2185 N/A
    Warning CS0618 'PrefabUtility.GetPrefabParent(Object)' is obsolete: 'Use GetCorrespondingObjectFromSource.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2191 N/A
    Warning CS0618 'PrefabUtility.GetPrefabParent(Object)' is obsolete: 'Use GetCorrespondingObjectFromSource.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 2354 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 5026 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 5035 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 5045 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildGraphics.cs 5123 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildLights.cs 115 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildLights.cs 340 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildLights.cs 675 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftBuildLights.cs 708 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftRenderLightmap.cs 4725 N/A
    Warning CS0618 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftRenderLightmap.cs 5081 N/A
    Warning CS0618 'PrefabUtility.ReplacePrefab(GameObject, Object, ReplacePrefabOptions)' is obsolete: 'Use SaveAsPrefabAsset or SaveAsPrefabAssetAndConnect with a path instead.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftRenderLightmap.cs 5667 N/A
    Warning CS0618 'PrefabUtility.GetPrefabParent(Object)' is obsolete: 'Use GetCorrespondingObjectFromSource.' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftRenderLightmap.cs 5667 N/A
    Warning CS0618 'ReplacePrefabOptions' is obsolete: 'This has turned into the more explicit APIs, SavePrefabAsset, SaveAsPrefabAsset, SaveAsPrefabAssetAndConnect' BakeryEditorAssembly D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Editor\x64\Bakery\scripts\ftRenderLightmap.cs 5667 N/A
    Warning CS0618 'TextureImporter.linearTexture' is obsolete: 'linearTexture Property deprecated. Use sRGBTexture instead.' Assembly-CSharp-Editor-firstpass D:\Development\StudioDecay\Maquette\Art_6499\Maquette-Unity\Assets\Standard Assets\Effects\CinematicEffects(BETA)\TonemappingColorGrading\Editor\TonemappingColorGradingEditor.cs 250 N/A
     
  29. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Yeah. Bakery.cginc is the same as the HDRP include, but smaller, as it reuses some of the Unity standard code (e.g. GGX).

    Log files are located in Assets/Editor/x64/Bakery/ by default, but you are free to move this folder. Basically it's where the exes are.
    Files to look for are (yes, names start with "." - this is to make Unity ignore the files, as it was locking them and causing all kinds of weird errors):
    .ftracelog.txt: main lightmapper log.
    .uvgblog.txt: UV GBuffer rendering log. Check it if you have any UVGBuffer-related errors during scene export.
    .denoiserlog.txt, .denoisedirlog.txt, .denoiseshlog.txt, .denoisemasklog.txt: logs for color, direction, SH and shadowmask denoising respectively.

    Log entries are appended to the end of the file, and the file is never cleared, therefore sometimes logs can get multi-megabyte sizes. Deleting them is safe, as they'll be recreated again.

    Additionally there is bakery_times.log in the root directory of your project, which simply logs [date/scene name/render time]. This is sometimes useful to compare baking performance when you change the scene.

    This is not related to any particular mesh or texture in your project, it just fails to create an intermediate UV GBuffer texture. Usually caused by extreme lack of VRAM or Unity running under incompatible GAPI (make sure your editor is on DX11).

    ... on the Light Mesh? Huh, could be a bug then.

    Glad it works now! Denoiser errors are usually a sign of driver incompatibility. Often you can just update the driver to fix them. There were some reports of the denoiser still failing somehow on some machines, and I built a variant using a different version of OptiX which seemed to work.

    Different versions of Unity have some differences in their UV unwrapper implementation, so they can re-unwrap your models differently. This is the case even if you're using built-in lightmappers. Needs a rebake unfortunately.

    These shouldn't be a problem.

    If the grass/roads are relatively flat, it is best to have a simple planar UV layout (UV = scaled XZ). Long roads are a nightmare for automatic unwrappers and it's better to avoid them in this case.
    I'd also suggest cutting the world into smaller chunks (at least the ones you can cover with a single 4096x4096 map).

    True. You can go with a quadtree approach, implementing culling yourself:



    Have small detailed squares near the camera, but large, less-detailed ones in the distance. You can put each detail layer to a different LOD group with different distance (so Bakery won't let them cast shadows on each other) and assign a different lightmap group with different resolution to each.

    I'm not sure if you even need to go that deep, as becoming drawcall-bottlenecked when every drawcall uses a whole 4k lightmap sounds like you'll get into VRAM problems way quicker (unless Unity's streaming tech is actually mature enough now, but I have some doubts... or unless you have your own streaming tech, which isn't very hard to implement for a fixed pool of same-size textures on a fixed GAPI).

    Some aren't easy to resolve without redesigning the DLLs. Every new Unity release adds a few more, stuff being deprecated constantly. Something being obsolete on one Unity version is the only way on another. Fixing these can cause some compatibility problems on older versions, so I just don't.
     
    Tudor and keeponshading like this.
  30. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    893
    Click on the little yellow triangle in the console in order to hide warnings.
    Warnings aren't very useful anyway and they are always spammed with stupid things like "obsolete" messages and "you declared a variable but didn't use it! OMG what are we gonna doo!"
     
  31. Laiskis

    Laiskis

    Joined:
    Aug 30, 2018
    Posts:
    2
    Thank you for such a quick response.
     
  32. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    128
    Thanks. Weren't sure where all the logs were.

    Yes my (possibly false) intuition is that there's a bug when there is a very small light mesh, or a very thin light mesh, coupled with the rays that need to be cast from it. If you make a cube, make it a light mesh, set its Z scale to 0, then it should throw this error even with selfshadow disabled. If you make a very small non-zero cube it might work without selfshadow, but it will not work with selfshadow enabled.

    Also I just noticed that light mesh direction is the positive Z axis of the game object. But if you use a Quad as a light mesh and set its Z scale to -1, bakery will bake the opposite of where the surface is :) Not sure how to fix that but there you go, it wasn't intuitive. Especially not for artists who just flip meshes all the time. :p
     
    guycalledfrank likes this.
  33. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,360
    Have anyone Bakery with Lux shaders? Will it work?
    I'd like to know before I purchase it.
     
  34. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    110
    Hi!

    Today during my lighting work, i discovered that the lightmaps are not been split into scenes using the "Split be Scene" option, at least not all of them.

    I have 8 scenes loaded, i bake lightmaps and i realised that not all the scenes had their own lightmaps, reviewing the lightmap section in the MeshRenderer i discovered that some scenes where fused into one lightmap.

    For example i have scene A, B and C. A has their own lightmap called SceneA_LMA1, but B and C are combined into one, named SceneB_LMA2. I'm not sure what is causing this.

    Also, i been having this issue lately,
    upload_2019-10-23_12-51-56.png
    At the end of rendering the light probes, even when the lightmaps are visible in the scenes and working, the only solution is to rebake the lighting. This is a constant error, sometimes happens after re-opening the project of just playing the game, i don't know why the reference to the lightmaps is lost. the log it only says that can't read a lightmap file. this happens for ALL the scenes in the project, the files are there, but the scenes loose the reference to the LightMap.

    I will do some test and come back if i find something else.

    Best.
     
    Last edited: Oct 23, 2019
    guycalledfrank likes this.
  35. gingernugget

    gingernugget

    Joined:
    Dec 1, 2015
    Posts:
    4
  36. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    157

    I can tell you from experience that that is a bad idea. Eventually, you will get caught where a warning would have told you what the issues you are facing are related to. Instead, you fudged around trying to figure things out. I prefer a clean console. Don't believe me? Wait and see :p
     
  37. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    893
    And I can tell you from experience this is the ONLY way to have a clean console on a large project with several assetstore plugins designed for several Unity versions.
    I currently have more than 162 warnings in the console from things like inconsistent line endings, unused variables, variables hiding inherited members, obsolete function calls and unreachable code. None of which are of any concern to me or my builds.
    I focus more on getting things done than on respecting code etiquette.
    I think I would have already noticed this in the past 30 years, but I guess I'll just have to wait longer :p
     
    fwalker likes this.
  38. Abrasive

    Abrasive

    Joined:
    Jul 24, 2019
    Posts:
    11
    You can just disable obsolete warnings.
    Here is how - Link :)
     
    guycalledfrank and atomicjoe like this.
  39. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    893
    That's pretty awesome, thanks!
     
  40. Balours

    Balours

    Joined:
    Nov 27, 2013
    Posts:
    52
    I'm using lightmapped prefabs and lightmaps are not working on another PC with git versioning, I'm not versioning local storage et global storage asset, what am I missing? I'm sure it was working at some point. I'm using a mix of classic lightmaps and vertex lightmap.
    Thanks!
     
  41. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    157
    Kudos to you, then :)
     
  42. remingtonspaz

    remingtonspaz

    Joined:
    Oct 1, 2014
    Posts:
    2
    Hi, I'm really interested in trying this asset out :). One thing that'd be great to know for sure though is how friendly is the whole process for additive scenes? Specifically, my project is using SECTR Stream. Also it's in 2018.2 for full disclosure. Thanks!
     
  43. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    585
    FYI. In addition.
    One of the biggest problems non Bakery related in loading additive scene lighting is solved in 2019.3. Finally.
    Did not not checked it with Bakery for now.


    Additive Light Probe loading

    Lighting
    Now when you additively load scenes, new light probes will merge with your existing light probes.
     
    remingtonspaz and Loards like this.
  44. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,360
    Got an issue with the exporting process:
    upload_2019-10-23_10-27-45.png
    Code (CSharp):
    1. MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
    2. Your script should either check if it is null or you should not destroy the object.
    3. UnityEngine.Object.get_name () (at C:/buildslave/unity/build/Runtime/Export/Scripting/UnityEngineObject.bindings.cs:189)
    4. ftBuildGraphics+<ExportScene>d__141.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftBuildGraphics.cs:4517)
    5. ftRenderLightmap+<RenderLightmapFunc>d__218.MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3761)
    6. ftRenderLightmap.RenderLightmapUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3227)
    7. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:303)
    Is there a way to find out what gameobject is causing this?

    Edit: Okay it seems there's a patch for it at git.
    If anyone encounteres the same - grab compiled csharp scripts, git access here:
    https://geom.io/bakery/github-access.html
     
    Last edited: Oct 23, 2019
    guycalledfrank likes this.
  45. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,360
    I've encountered a weird issue.

    If the lightmapping is interrupted or error has occured - scenes that have been lightmapped are opening REALLY slow.
     
  46. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,360
    Is there a way to debug what's being lightmapped and what isn't?
    When baking via Unity's PLM after bake everything that is not baked isn't lit (black).

    When I bake with Bakery I can't tell what is baked and what's being lit by realtime light (which is faked by Unity).
    Is there a way to force editor to shade only via baked lightmaps?
     
  47. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,360
    Also, does anyone know why do lights not do get baked to the lightmaps of the terrain?

    I've got them setup as Bakery lights, tried Full Lighting and Shadowmask modes, without any results.
    (Terrain is set to contribute GI and gets baked, but not lights rendered for it, even though it works with PLM)

    Tried clearing baked data from Unity, Bakery, reverting scenes to the previous state.

    Edit: Sky light and Direct Light works, Point light does not.
     
    Last edited: Oct 23, 2019
  48. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,360
    Okay, it seems like its a terrain problem. Lights are baked for the non-terrain meshes.
    I'm using different shader for it, maybe that's the case.
     
  49. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    I think there was indeed a bug related to that, which I since fixed. Try the github version and see if it helps.
    ... edit: it appears I somehow reverted that fix by mistake recently :eek:
    ... edit: put it back.

    Light Meshes don't really have a direction, as they emit light from every triangle of the model. It can be a sphere, a torus, anything.

    Ahh yes. Light Mesh vertex transformation doesn't account for negative scale. Will fix that.

    Hmm weird. It might be because I added some code to join multiple small lightmaps into larger ones once after the scene split option was made. If you open ftBuildGraphics.cs and comment/remove this line:

    if (!autoAtlasLodLevels.Contains(autoAtlasGroups[g].sceneLodLevel)) autoAtlasLodLevels.Add(autoAtlasGroups[g].sceneLodLevel);


    will it change anything?

    Is it Legacy or L1 probes? For L1 it's best to just run regular Render and not click Render Light Probes at all, as they'll be produced anyway, together with lightmaps.

    These are in fact internal files in the temp folder, not the lightmaps in your project.

    Ah, you'll need to include them too then. I'm fine with that.

    Ah, my two favourite bugs. Prefabs sometimes act funky on anything newer than 2018.3. The exact reason is not yet found (it's just Unity now loves to reset all lightmap scales/offsets/IDs on them, frequently. My scripts try to counteract it though). Versioning and multi-machine sync has some pitfalls, guidelines are here, yet often people seem to make it break anyway somehow. Maybe re-read them and see if you missed something. Try right click -> reimport on broken models.
    The best advice I can give though is to use pre-made UVs (not autogenerated) when extensively syncing projects across machines. This way you'll be immune to all possible inconsistencies of both Bakery and Unity (you can even upgrade/downgrade Unity without rebaking). Max, Maya, Blender all have great automatic UV generation tools, and they often result in better quality packing.

    Additive scenes should work great in general. I never tried SECTR Stream though.

    That's a greeeat addition, yeah! Previous versions of Unity can only use one set of probes at a time.

    There shouldn't be a difference like that. Lightmapped scenes can of course load slower than non-lightmapped, but the fact that you had an error or not should not make any difference. Can you describe it step by step how you end up with slowly loading scenes?

    If you open Lighting -> Baked Lightmaps and select any of the scene objects, you should see a corresponding lightmap highlighted in yellow:

    upload_2019-10-24_13-28-44.png

    Huh weird. Can you see if there is any difference when switching Terrain Optimization on/off?

    upload_2019-10-24_13-32-35.png
     
    Tudor and xVergilx like this.
  50. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,360
    1. Start baking process;
    2. Kill Unity, e.g. via Task Manager;
    3. Reload Unity - it is now slowed down to the crawl.

    Its fine when the baking process is canceled.

    Also, if you cancel lightmapping while in multi-scene setup, first scene (by the build index) will be set as active scene instead of previous active scene.

    Its no big deal if you've got VCS, but it may screw someone else's project.


    Yep, that did it. Now point lights appear on the lightmap! Thanks :)
     
    guycalledfrank likes this.
unityunity