Search Unity

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

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

  1. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Oh well. Killing Unity doesn't kill Bakery process (it's separate!), so you're still baking. Look for ftrace.exe.
     
    xVergilx likes this.
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Got another weird issue.
    I've got a ceiling model / mesh and it doesn't gets baked for some reason.
    I've tried placing lights directly underneath it.

    It is completely black in the scene after bake.

    When I select it and open baked lightmaps preview it shows this:
    upload_2019-10-25_12-39-58.png

    Baked:
    upload_2019-10-25_12-40-54.png

    Realtime:
    upload_2019-10-25_12-41-10.png

    What can be causing this?
     
  3. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    It seems like it is present in the lightmap, but for some reason object is not displaying correctly:
    upload_2019-10-25_12-55-31.png
     
  4. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    116
    Spent the afternoon playing with ASE and the BakeryStandard.shader source and remembered why I don't write shaders manually.

    It's... quite a challenge. Seems like the most appropriate way would be to write a template for ASE that has the Bakery stuff built in, but even that is quite a bit of work to do
     
  5. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    73
    Is there a way to modify the bakery shader in a way that it uses UV1 for the occlusion?
    We like to have albedo with a tiling texture and have a different uv set without overlapping for an occlusion texture.
    This was possible with Uber shader but I can't specify it in Bakery shader.
     
  6. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437

    the key would be to have a custom function node call into the bakery script and then just add the ASE float / texture / vectors into a function nodes as needed, however it would need some level support with frank so its not lost every time bakery updates

    example
    Xxxxxxx
    #if AMPLIFY_SHADER_EDITOR
    Xxxxxxx
    Shader.SetGlobalTexture("Bakery_ ??
    Shader.SetGlobalFloat("Bakery_ ??
    Shader.SetGlobalVector("Bakery_ ??
     
  7. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    I am getting this error again:
    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)
    I am on the latest version, I tried resetting the settings to default and turning off Terrain Optimization. I am unable to bake anymore on any scene..
     
  8. wzxy1322

    wzxy1322

    Joined:
    Jul 3, 2018
    Posts:
    3
    Hello, there's a hint in my console "Lighting data asset ‘emptyLightingData’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt." According to the warning operation, it still can't be solved. Can you help me?I wonder if this file can be deleted?
     
  9. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    116
    I think the better way is through a template as the Bakery stuff is quite big and does a lot of post-work after the standard shader is applied.
     
  10. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    I wonder if it's too reflective? Regular lightmapping only covers diffuse lighting, with specular coming from reflection probes. You can also try Bakery shader with Lightmapped Specular option and bake either in Dominant direction or SH mode.

    Well you can hack it. E.g. open Bakery.cginc and look for

    half occlusion = Occlusion(i.tex.xy);


    Try replacing i.tex.xy with i.ambientOrLightmapUV.xy for example.

    On the one from github? Line 3676 doesn't seem related, so you're probably on the old one.

    You can ignore this message. It is actually compatible.
     
    xVergilx and wzxy1322 like this.
  11. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Yep, that was the case.

    I've switched from Lux Specular to Lux Metallic setup adjusted values and it has baked correctly. Thanks :)
     
    guycalledfrank likes this.
  12. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
    The Git hub says error 404 not found, even after requesting access.
     
  13. Visitor1980

    Visitor1980

    Joined:
    May 8, 2017
    Posts:
    4
    Is it possible to be use volumetric light like spot light and if it yes - how?
     
  14. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    73
    Is there a documentation how all the uv channels are called? I have several in my model and want to use one of these. Not the lightmap uvs

     
  15. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    PC 2019.2.10f1

    Hi Mate,

    Can you give some advice how to use Ambient Occlusion for a single Prefab that has Bakery LightMap Group Selector attached? All the stuff is scewed up currently.

    Untitled-3.jpg

    There is only one mesh in the prefab that is marked as static. The AO map should be generated locally.

    Untitled-2.jpg Untitled-4.jpg


    The goal is to have a local AO map that is passed through a custom shader to the single mesh by material.
    And using the UV2 of the local mesh.

    The custom Shader:
    Untitled-1.jpg

    Code (CSharp):
    1. Shader "Custom/AO-WallShader"
    2. {
    3.     // Info to access different UV from a surf shader
    4.     // https://forum.unity.com/threads/custom-uv-sets-for-shaders-tutorial.645670/
    5.  
    6.     Properties
    7.     {
    8.         _Color("_Color", Color) = (1,1,1,1)
    9.         _MainTex("_MainTex (RGB)", 2D) = "white" {}
    10.         _UNITY_UV2_AO("_UNITY_UV2_AO", 2D) = "white" {}
    11.         _AO_Shadow("_AO_Shadow", Range(0,5)) = 1
    12.         _AO_Light("_AO_Light", Range(0,5)) = 1
    13.     }
    14.     SubShader
    15.     {
    16.         Tags { "RenderType" = "Opaque" }
    17.         LOD 200
    18.  
    19.         CGPROGRAM
    20.         #pragma surface surf StandardSpecular fullforwardshadows
    21.         #pragma target 3.0
    22.  
    23.         sampler2D _MainTex;
    24.         sampler2D _UNITY_UV2_AO;
    25.  
    26.         struct Input
    27.         {
    28.             float2 uv_MainTex;
    29.             float4 color : COLOR;
    30.             float2 uv2_UNITY_UV2_AO;
    31.         };
    32.  
    33.         half _Smoothness;
    34.         half _Specular;
    35.         half _AO_Shadow;
    36.         half _AO_Light;
    37.  
    38.         UNITY_INSTANCING_BUFFER_START(Props)
    39.         UNITY_DEFINE_INSTANCED_PROP(fixed4, _Color)
    40.         UNITY_INSTANCING_BUFFER_END(Props)
    41.    
    42.         void surf(Input IN, inout SurfaceOutputStandardSpecular o)
    43.         {
    44.             half4 c = tex2D(_MainTex, IN.uv_MainTex)  * UNITY_ACCESS_INSTANCED_PROP(Props, _Color);
    45.             half4 lm = tex2D(_UNITY_UV2_AO, IN.uv2_UNITY_UV2_AO);
    46.             lm.r *= lm.a;
    47.             lm.r += _AO_Shadow;
    48.             lm.r = min(lm.rgb, 1);
    49.  
    50.             o.Albedo = c.rgb * lm.rrr *_AO_Light * IN.color;
    51.             o.Specular = _Specular.rrr;
    52.             o.Smoothness = _Smoothness;
    53.         }
    54.         ENDCG
    55.     }
    56.     FallBack "Diffuse"
    57. }

    Results are mostly black or sometimes totally over brighten.

    Untitled-5.jpg
    * What are the correct setting in Bakery? (what extra settings here? Mode?)
    * Does AO settings have any effect on baking AO maps?
    * Do I need the Directional Light on the DirLight? What settings here as well?
    * What settings on the group selector? Mode? Packing mode?

    Thanks a lot!

    On shaders sometimes occur.. Requesting non existent keyword at index 262/263..
     
    Last edited: Oct 28, 2019
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Did you request access here? https://geom.io/bakery/wiki/index.php?title=Github_access
    It should give you invitation links if it's successful.

    Volumetric lighting is not related to lightmapping and requires separate real-time rendering techniques. I'm pretty sure there are many assets for that (HDRP should support it out of the box if I'm not mistaken). You should be able to use any of them together with Bakery.

    Bakery.cginc is basically copied from Unity's own CGIncludes code to resemble Standard shader as much as possible, but also allow for additional magic. Variable names in question were inherited from Unity code. Standard shader only supported UV0 and UV1. Although adding additional channels is possible, it may be not compatible with all shader features, as it can already easily hit interpolator limit (amount of variables passed from vertex to pixel shader).
    If you're not using any detail maps, you can easily hack the shader to store your preferred UV channel in tex.zw, look for BakeryTexCoords() function.

    Hmm. What you are doing is correct, it should work. If you can send me the unitypackage with the scene/prefab, that'll help.

    I'd use "Ambient occlusion only". Any mode should display properly on the prefab though.

    Does it matter if you're only baking AO?

    Your mode is set to Original UV. This is correct if your model is unwrapped to a single non-overlapping layout (separate objects inside the model don't overlap as well). In any other case additional packing is needed (set to Pack Atlas).

    ?? do you have more details/context on this?
     
  17. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    116
    @guycalledfrank I know this is a bit of a pain in the ass to ask for, but could you do a quick write-up on how to apply RNM/SH to an existing shader or possibly what steps are taken in the code to utilise the generated maps if we wanted to use them without the Bakery includes? There’s quite a view layers of depth in the functions called in the BakerySH function which makes it quite hard to work out exactly what I’d need to do if I wanted to reproduce the results.

    Edit: saying that, reading through it again with fresh eyes, most of it seems to be all in one function, with a couple of custom renditions of built in functions like Texture2D? Would be good to know if those are doing anything special
     
    Last edited: Oct 29, 2019
    hippocoder likes this.
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Bakery seems really intriguing! Is there a demo or such, I would love to test it in my ongoing game in progress. Sadly it seems Unity's own GPU PLM is not really up to the task.

    I have to use my own custom shaders in my project and it's not a negotiable point but I make them using Unity's shadergraph. Is this an issue?
     
    guycalledfrank likes this.
  19. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    116
    Just grab it, well worth it if PLM is driving you nuts. Works fine with custom shaders, I’m just looking for the extra features that RNM/SH mode provide (like baked specular lighting, which makes a huge difference when you can barely have any real-time lights)
     
  20. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Thanks for heads up. The RNM/SH for Universal Pipeline looks like something I want in on as well, so I'll wait to hear!
     
  21. POC0bob

    POC0bob

    Joined:
    Feb 22, 2017
    Posts:
    28
  22. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    150
    Hello, how does it goes? I have the newest github update and the problem is sill there.
     
  23. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    116
    Revisited the template again, cried a little more and gave up. I think this may well be either a custom node or custom template job.

    The ASE devs are quite happy to help with writing templates and nodes if you wanna ask them to give some pointers Frank ;) ShaderGraph is nowhere near ASE's level yet so I'd love to see an ASE template that can provide RNM/SH modes for Bakery, while letting us write our own shaders for everything before that. I simply don't have the Shader-writing chops to tackle this myself.
     
    DEEnvironment likes this.
  24. Jan_Hasse

    Jan_Hasse

    Joined:
    Sep 11, 2017
    Posts:
    21
    Hi Frank,
    im wondering whether its possible to Bake two different Lightmaps in one Scene?
    I have an outdoor part, where the user never go into and a indoor part, where the user can walk.
    Is it possible to bake the outdoor a with a lower texel per unit and the Indoor with high texel per unit?

    Greetings
     
    xVergilx likes this.
  25. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Also: I don't use HDR rendering, just LDR but I do have linear lighting. This is for mobile - can I still get something from RNM / SH ?
     
  26. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    +1 would like to know as well if different texel unit setup is possible.
     
    hippocoder likes this.
  27. remingtonspaz

    remingtonspaz

    Joined:
    Oct 1, 2014
    Posts:
    2
    EDIT: Fixed this. Didn't include baked shader variants before :p

    I'm having problems where textures in the built game is completely whitewashed. Only lightmap static objects are affected so I'm pretty sure it's got something to do with the lightmaps.



    In the editor things look fine.



    Any thoughts?
     
    Last edited: Oct 29, 2019
    guycalledfrank likes this.
  28. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    This is a good idear anyway. There is a bakery lighting group selector script where you can tell Bakery to use different GameObject groups to have different bake settings and resolution. But it's not possible separate the result into different light maps strictly. From what I know.

    I wish it would possible to control the baking process more effectively by the bakery lighting group selector
    and it's group parameters.The group parameters should contain options:
    1) Bake lightmap separately and into folder: [X] [Assets/etc...] (Does not have to go into the Unity Lightmaping itself)
    2) Select what it should be baked [AO, Directional, Rm. SH..]
    3) [X] Take non static objects into GI baking diffuse light account.
     
    Last edited: Oct 29, 2019
  29. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    OK just bought it. Time to burn some cookies, wish me luck everyone.
     
    guycalledfrank and wetcircuit like this.
  30. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    upload_2019-10-30_0-48-1.png

    The ui is a bit smashed in newer Unity...


    Edit:

    Good results so far but can I stop it from trashing my skybox on builds? I need to use my own shader and my own skybox :)

    Edit:

    Bakery resets and forgets it's own settings if I make an android quest build.
     
    Last edited: Oct 30, 2019
    guycalledfrank likes this.
  31. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Yeah it's not really that convoluted:
    - BakerySH() does the job.
    - shEvaluateDiffuseL1Geomerics() is called from BakerySH().
    - diffuseColor/specularColor arguments are marked as inout, so instead of returning a value, the function just adds it to the arguments.
    - if BAKERY_SHNONLINEAR is defined, high quality non-linear sampling is used, simple/cheaper one otherwise.
    - if BAKERY_LMSPEC is defined, specular is computed.
    - BakeryTex2D() performs a bicubic texture lookup if BAKERY_BICUBIC is defined and you're on DX11. Falls back to regular tex2D() otherwise.
    - SmoothnessToPerceptualRoughness(), PerceptualRoughnessToRoughness(), GGXTerm() used in specular computation are coming from Unity includes (UnityStandardBRDF.cginc). This is to make sure specular is consistent with other materials. You can replace these with any other BRDF formula and roughness/smoothness mapping though.

    Not much. See this table: https://geom.io/bakery/wiki/index.php?title=Manual#Feature_support_across_shaders
    Basically if you are using anything that built-in lightmappers already can do (regular color lightmaps, directional maps, shadowmasks), Bakery will just supply these to your shaders, not requiring anything extra. However, if you want to use specific Bakery features like RNM/SH maps or per-vertex baking, then you can either use the extra shaders coming with the package or extend your own to sample this data.

    Yes.

    One way to achieve that is to simply set different "scale in lightmap" value on different mesh renderers. E.g. you can leave 1 on nearby objects but set it to 0.1 to distant backgrounds.
    Another option is to use Lightmap Groups, grouping nearby and distant objects to separate atlases.

    I prefer to just unwrap areas in advance (in 3dsmax) for a more predictable workflow, knowing for sure which objects belong to which atlases, use a group for each atlas and set different resolution depending on importance.
    For example:

    1. I have one main 4096 lightmap for all objects that player can inspect close enough:

    upload_2019-10-30_9-53-16.png

    2. I have a 1024 planar map for the floor around the player, because I use SH lightmap for that (to shade grass mainly):

    upload_2019-10-30_9-54-10.png

    3. And I have a separate 256 map for all the distant unimportant stuff:

    upload_2019-10-30_9-55-18.png


    4. And the rails? They use per-vertex SH, because no unwrapper can handle long thin lines well.

    This is my workflow. You are of course not required to split your scene in advance this way, everything can be done directly in Unity using its built-in unwrapper and Bakery's auto-atlasing system, tweaking Texels Per Unit, Min/Max Resolution and Scale in Lightmap. Doing everything directly in Unity is also great for prototyping/drafts, but for a more strict/production workflow, I choose this approach.

    3dsmax automatic atlasing isn't the best, BTW. I've seen people producing amazing results in Maya:

    upload_2019-10-30_10-3-47.png

    it has legit the most efficient packing algorithm I ever saw. This is something you won't be able to get from Unity-only workflow. But being a Maya noob myself, I couldn't tame it yet :D

    Just keep in mind that unwrapping/atlasing and baking are two separate problems. Bakery's aim is to solve the latter, and even if it has some tools to control atlasing automatically, there are always better tools for that.

    1 Lightmap Group = 1 separate lightmap. Pretty strict.

    Currently all baked maps go to "output path" you can set in advanced settings. I can make it a per-group value, not sure how important is that though.

    You can do that per-group. Select group asset and choose the mode. This is how I bake SH just for select objects for example.

    You can achieve that by marking objects as Lightmap Static and setting their Scale in Lightmap to 0. This will give you a completely non-lightmapped object that still casts shadows/GI into lightmaps. This trick used to work with Beast in older Unity versions, so I just made it work the same way.

    Oooops. Which version is that? I wonder how many other assets it broke...

    How exactly does it trash the skybox? Lightmap render shouldn't affect its value. Perhaps you used the "match skybox to skylight" button on Skylight? (hint: it's not necessary)

    That's weird. I didn't build anything for Android Quest though. Anyway:
    - The settings are stored in an invisible object inside your scene.
    - The object is saved together with the scene. Changing settings and not saving it will make them reset.
    - Perhaps not exactly intuitive, but "Clear baked data" option clears settings as well.
    - If you are using similar settings across most scenes, you can save time by setting them as default (Bakery/Utilities/Save settings as default)
     
    Jan_Hasse, hippocoder and xVergilx like this.
  32. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I'm doing exactly this. Except baking with 3-5 texel per unit is still way faster than with 10-15.
    That's why I've asked in case there's a way to tweak it.

    Oh well, I guess I could just do a low quality pass, then do a final render and call it a day.
     
    Last edited: Oct 30, 2019
  33. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    What would really help is a quick and dirty subshader / function node. Basically it's just a bit of code dropped into the shadergraph itself. If you could point me where/how/example function I can convert it would help a ton, thank you :)

    As for UI - suspect it's probably anything to do with 2019.3 or 2020.1 because the UI has changed in Unity for those. Also when importing to 2020.1 I had to let it run the script upgrader. Not sure what damage it's done if any.

    So far so good though, excellent alternative to Unity's GPU PLM. And a bit surprising one guy can beat a billion dollar company at lightmapping.
     
    guycalledfrank likes this.
  34. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    150
    Something got changed in the git repo, now I am not able to simulate indoor ambient lighting with 6 Directional lights with no shadows - baked indoor scene is solid black.

    EDIT: with version from asset store this is possible
     
    Last edited: Nov 1, 2019
    guycalledfrank likes this.
  35. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    Stop being surprised dude...
     
  36. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    In England, where I live, that comment is me being NOT surprised in the most polite way I possibly can be... :)
     
    AcidArrow likes this.
  37. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    haha :)

    Fair enough.
     
  38. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    (Not high priority): Question: anyone know how I can prevent committing a gb to version control ? I mean bakery makes a ton of temp files and I'd rather only commit the ones used by the game...

    Current bugs:
    • Bakery doesn't play nice if you want to move it into a plugins folder. You have to edit the paths manually - annoying fix
    • No Universal Pipeline version of the shader (or subgraph) so you will have to rename *.lightweight to *.universal (and where caps apply if any) - easy fix
    • Making a build will not reload the scene correctly as of 2020.1 (possibly 2019.3 too) so you will need to reload your scene manually as Bakery will mistakenly show default settings until you do
    • UI label bugs on any Unity version that uses their new UI

    Current issues:
    • Not sure how best to manage files for version control. Is it cleaning up the old folder when you bake the same scene again? Unity cleans up after itself so things don't spiral out of control with version control
    • Has hidden stuff in the scene, not a good idea IMHO. Please store in asset file instead like a good unity citizen

    I'll hold off on asset store review until I become more experienced in Bakery but the the fact I've still not thrown it off my hard drive is a great sign! :)

    Unity should not be happy with their current results with baking until they can match this.
     
    guycalledfrank likes this.
  39. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Eventually at some point we might want parts of Unity's features and parts of Bakery. Is it possible to make it easy for us to use the UV mapping features you've provided or the light probes baking you've done with Unity's own stuff so if that's an easy thing then it would be cool also... Mostly it's the UV mapping that's cool. That library seems to beat Unity's results.

    edit:

    Going back to Unity for baking. Unity's is slower, and lower quality but it does work for my odd scenario which is LDR + Linear on mobile. I just keep getting washed out results for that scenario with Bakery. If I stick to HDR and so forth it seems fine. It may well be my LDR skybox or something but I'm out of time for this iteration and will revisit later. Great so far, for high end.
     
  40. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    When working with single objects and AO the whole production process will benefit extremely from per group save path texture. Currently I must setup each mesh that should get AO manually, then wait for it's to end, then start with the next one. It's a extremely waste of man and production time.

    Having a separate group path, let render the stuff in one job for a lot objects. Simply run and forget.

    When this option is enabled, please go not pass any light-map into the unity light-mapping system. This is completely useless and wasting system performance.

    NVIDIA has very stable and robust drivers. Eg. when starting rendering AO maps in a loop for 200 objects perhaps should take care of removing files and free memory correctly and use
    Code (CSharp):
    1. long GC_MemoryEnd = System.GC.GetTotalMemory(false);
    from time to time on iteration to make sure the memory allocation does not overflow.

    Code (CSharp):
    1. Resources.UnloadUnusedAssets();
    2. System.GC.Collect();
    3.  
    Would be also a good choice to call from time to time, mostly at the the beginning of the loop.
    Only a small hint. Perhaps you do already.

    Issue or missing option:
    • It seems Bakery enable Global Illumination in Lightmap Settings on play-mode or build. This behavior requires an option to disable.
    My simulation fails in this case. Some objects loose environment lightning for any reason.
    I use only AO baking for DOTS (disabled real-time global Illumination and disabled baked global illumination)
     
  41. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    Hello everyone! I have some problem with the use of Lightmap specular and baked Dominant Directional. Observed seams between the quads. I think they appear bright because of the edges on the Directional Map. Maybe someone knows how to fix it?
     

    Attached Files:

    • edge.png
      edge.png
      File size:
      686.4 KB
      Views:
      550
  42. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    78
    Is it possible to bake only the direct lighting ? No shadows, no GI ?
    Basically what i see with realtime lights with no shadows.
    Thanks !
     
    Last edited: Oct 31, 2019
  43. r8zbeh

    r8zbeh

    Joined:
    Dec 4, 2018
    Posts:
    40
    HI guys
    I'm working on a detailed interior scene with high poly meshes in Unity 2019.1.4.f1 using Area lights(Bakery mesh lights) and Point lights to lit the scene ,
    all lights are Baked Only.
    I've done some comparison between Bakery and Enlighten based on artifacts and final quality . ( different light intensity outcomes isn't important in this test )

    PROBLEM 1 :

    First i have noticed that when the baking settings,Lightmaps size ,texels per units and objects lightmap scales are all the same for Enlighten & Bakery , the Bakery Lightmaps produce much bigger artifact and shadow leaks on final render compare to Enlighten .(mostly on Uv seams - even i have tried different Uvs with larger padding )

    *** baked by Enlighten :
    1.enlighten.png


    *** baked by Bakey 1K*1K :
    2.bakery.png



    But the problem get solved,when i increase the texels per unit size or object's light map scale. i increased the scale till i get same result as Enlighten baked lights.


    *** baked by Bakey 4K*4K :
    3 bakery 4k.png


    1024*1024 Enlighten lightmap quality (Decompressed - 16 MB) = 4096*4096 Bakery lightmap quality (Decompressed - 128 Mb )

    QUESTION 1:

    Is such an act normal by Bakery or am i doing something wrong ? in case that its acceptable,wouldn't such a big lightmaps generated by Bakery ,end up occupying huge amount of VRam and make it less useful for such cases ?


    QUESTION 2:

    I have noticed that texels size by bakery is much bigger than texels in Enlighten .compared them in inspector by Bakey Checker preview.(based on same settings). is it how Bakey works or i'm mistaken ?

    QUESTION 3:

    in Enlighten lightmaps , baked UV isles gets dilated till get to the adjacent UV isle.
    But in Bakey most of UV paddings are left pitch black. isn't there any settings for increase the dilation or soften UV seams light ?

    QUESTION 4:

    I have read somewhere that Bc6h compressed format (format Bakery use) doesn't need to be decompressed in Vram ! is it true ?
     
    Last edited: Nov 1, 2019
  44. texturoija

    texturoija

    Joined:
    Aug 25, 2017
    Posts:
    1
    Hi, I'm trying to bake with terrain and the get these strange "spots" to bake. Is there option that I'm missing in terrain inspector setup? upload_2019-11-1_15-57-10.png
     
  45. mlhope

    mlhope

    Joined:
    May 23, 2013
    Posts:
    4
    Hey, @guycalledfrank thanks for this tool. It has a lot of the granularity of control that I've been needing for rapid iteration on lightmaps.

    I encountered one issue so far: when trying to use xatlas to adjust my UVs it seems like it's crashing Unity due to the xatlas dll throwing an access violation error:


    xatlasLib.dll caused an Access Violation (0xc0000005)
    in module xatlasLib.dll at 0033:283583fb.


    I did a quick search of this thread and didn't notice anything similar. Are you familiar with the issue?
     
    guycalledfrank likes this.
  46. dl290485

    dl290485

    Joined:
    Feb 4, 2018
    Posts:
    160
    I get this error:

    "unity bakery object_exporterrain was destroyed mid-export"

    I searched Google and found the same error messaged in this thread, to which you asked some questions back including what is the shader on the terrain. I looked forward a bit but didn't see any follow up replied. I'm now checking my own scene by setting the terrain as not static, and it is rendering right as I'm typing now.

    I have 2 terrains in the scene. One is using a standard Unity terrain with standard shader, and the other is using a terrain made using Landscape Builder (https://assetstore.unity.com/packages/tools/terrain/landscape-builder-55463) with Complete Terrain Shader (https://assetstore.unity.com/packages/tools/terrain/cts-complete-terrain-shader-91938)
    It's one or both of these things which is causing the error. Do you know if either of these is or is not compatible with Bakery?
     
  47. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
    Oops. Thanks for noticing! Fixed.

    You mean the temp folder (which is in AppData\Local\Temp\frender by default)? It shouldn't be needed to commit it at all.

    ??
    That should work fine out of the box (at least it used to). Which paths did you have to edit?

    Right, Universal pipeline is fairly recent (newer than my latest store release...). I'll see if I can include an updated shader in the next one.

    Not really at the moment because I'm paranoid about deleting anything. Files with identical names are overwritten though.

    Still needs a scene->asset link. Where should it be stored?

    If you mean UV padding adjustment or xatlas, you can combine it with Unity by just... using Unity's lightmappers after Bakery done adjusting the UVs. You also should be able to combine Bakery lightmaps with Unity light probes, because they are loaded from different sources (probes always come from Lighting Data Assets, Bakery lightmaps are loaded via scripts), but not the other way around.
    Additionally, you can combine Enlighten realtime GI with baked Bakery lightmaps/probes, as dynamic/static GI takes different paths in the engine.

    Any screenshots? Might be something known/easy to fix.
    Unity performs HDR->LDR conversion on its own when importing assets. The source of original HDR maps shouldn't make any difference.

    TBH there is a plenty of free and great per-object AO-only baking software, e.g. xnormal (and it also uses CUDA, being pretty fast). Perhaps you should try that. Bakery is optimized for scene-level baking.

    Yeah, that turned out to be unnecessary ("bakedGI" field sounded a bit ambiguous). I removed it since.

    Looks a bit familiar. First, try the github patch, there is one seam-related fix.
    If that doesn't help, try disabling denoising and see it it makes a difference. I will investigate further depending if it's a denoiser "smudging" the direction across the edge or if the artefact is generated during baking.

    You can bake directional/point/spot lights with no shadows (set Samples = 0) and disable GI (Bounces = 0). There is no constant ambient factor though, but there is a workaround to achieve it.

    Even if they are the same, they don't necessarily match. Things like "texels per unit" are just hints for the atlaser. Final resolution depends on many factors, as individual layouts get packed and rounded.

    The colored artefacts in question come from texture compression. Could appear due to a different arrangement of charts in the atlas, pretty sure you'd get the same with Enlighten, just at different spots. Disabling compression on baked lightmap assets will fix the issue (but it's generally not a good idea). Increasing resolution also helps (I'd compare the actual size in pixels in your Enlighten/Bakery results, they can differ).

    Would be really interesting to see both textures. I wonder if there is some packing problem.

    As I previously said, there is a different approach to packing/rounding, so texel settings may not match exactly.

    OK, that shouldn't happen. Normally Bakery dilates everything the same way. Please try the github patch.

    Yup. It's a native GPU format that can be sampled directly (just like DXT). Note that mobile devices and WebGL usually don't support it though.

    Interesting. Can you try changing Terrain Optimization option?

    Yeah, I noticed xatlas doing that on some models. The exact reason is unknown at the moment, and my attempts to help the maintainer to reproduce it weren't successful so far. Generally xatlas seems to be a bit unstable.

    Ah yeah. Github patch. Get it.
     
    sewy likes this.
  48. Darthlatte

    Darthlatte

    Joined:
    Jan 28, 2017
    Posts:
    27
    @guycalledfrank Hi, is there any way to save the UV's generated by Bakery (either the optimized padding or Xatlas generated UV's) to the fbx file so it can be exported with lightmaps to another application? Thanks
     
  49. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,672
  50. Darthlatte

    Darthlatte

    Joined:
    Jan 28, 2017
    Posts:
    27
    Last edited: Nov 4, 2019