Search Unity

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

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

  1. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    84
    Just did it again,
    Bakery --> Create Skylight
    Matched the color with the scene.
    No warnings about UVs.
    Hit render.

    It gave me the same result.



    I compared it with the one in the sample scene but couldn't find a difference.
     
  2. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,234
    Try putting a cubemap there, any cubemap, to see if it works.
     
  3. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    84
    It didn't :(
     
  4. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    84
  5. davesmeathers

    davesmeathers

    Joined:
    Aug 18, 2015
    Posts:
    6
    We're building cliffs out of overlapping rock meshes. The rocks have LODs and what I'm finding is that when the rocks aren't at the same LOD level there are visible shadow seams between the rocks. Does anyone know of a good workaround for this problem?

    CliffShadows.png
     
  6. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    363
    I'm looking for advice on the API.

    I'm trying to automate my baking process for multiple times of day in a scene.

    But for some reason the script exits the loop once the first render is complete.

    It will run the while loop while it's baking, but once the bake is complete the code just ends.

    Code (CSharp):
    1.         public IEnumerator BakeLighting()
    2.         {
    3.             ftLightmapsStorage storage = ftRenderLightmap.FindRenderSettingsStorage();
    4.             TimeOfDaySetting[] phases = { morning, afternoon, evening, night, lateNight };
    5.             foreach (TimeOfDaySetting phase in phases)
    6.             {
    7.                 ProcessTODS(phase);
    8.                 storage.renderSettingsOutPath = phase.lightmapLocation;
    9.                 var bakery = ftRenderLightmap.instance != null ? ftRenderLightmap.instance : new ftRenderLightmap();
    10.                 //bakery.LoadRenderSettings();
    11.                 bakery.RenderButton(false);
    12.                 Debug.Log(phase.lighting.name + " is now rendering!");
    13.                 while (ftRenderLightmap.bakeInProgress)
    14.                 {
    15.                     //Debug.Log("Currently Baking...");
    16.                     yield return null;
    17.                 }
    18.                 //Never reaches this point
    19.                 Debug.Log("Baking Complete!");
    20.                 ApplyLightingData(phase);
    21.                 EditorUtility.SetDirty(phase.lighting);
    22.                 Debug.Log(phase.lighting.name + " has been processed.");
    23.             }
    24.             Debug.Log("Lighting bake finished");
    25.             EditorSceneManager.MarkAllScenesDirty();
    26.             EditorSceneManager.SaveOpenScenes();
    27.             yield return null;
    28.         }
    Any advice?
     
    Last edited: Sep 13, 2021
  7. Nykster

    Nykster

    Joined:
    Jan 16, 2015
    Posts:
    8
    Hello,
    I just started exploring Bakery and it's features. So far it looks awesome!
    I would like to test it in my project, but we use Amplify to create our Shaders and we are on the build-in renderer.

    As anyone been able to create an Amplify Shader that works with Bakery? I've tried looking at the NOT_Lonely examples butI wasn't able to make it work.

    @NicolasDuboc, were you able to make it work?

    I've tried adding custom Bakery.cginc and using the function from BakeryDecodeLightmap.hlsl -> DirectionalSpecular_float, but with no success. I have to say that my Shader skills are very very low.

    When I include bakery.cginc in my shader, I get these two compilation errors:
    - Shader error in 'Main_Environment_Opaque': undeclared identifier '_MainTex_ST' at Assets/Bakery/shader/Bakery.cginc(223) (on d3d11)
    - Shader error in 'Main_Environment_Opaque': Unexpected identifier "UNITY_SHADOW_COORDS"

    What I would like to do is add Bakery Volume support to a shader made with amplify.

    Any help appreciated!
    Many thanks!

    Update: Just noticed this asset, https://github.com/BenWoodford/Bakery-ASE I will look into that.
     
    Last edited: Sep 14, 2021
    guycalledfrank likes this.
  8. mikeohc

    mikeohc

    Joined:
    Jul 1, 2020
    Posts:
    162
    I'm a little confused about how volumes work in HDRP? The shadows on dynamic objects are baked into static objects when it's within a global bakery volume. I looked at example_volumes_simple and followed it but I'm still confused what I need to do to get the lighting change on dynamic objects when under shadowed areas.

    I tried looking at example_volumes_advanced to see how I'd use local volumes, but without a directional light, the lighting is completely wrong even after bake.

    I tried for hours to get it to work. I started a fresh HDRP project with Bakery but all I get is the follow results. Any ideas how I can fix it to understand the example?

    Screenshot (339).png

    Edited: It seems the issue has to do with sky reflections in HDRP. Without setting the parameters in indirect multiplier in HDRP volume to 0, the scene will appear like the image above. Have to use a reflection probe.

    The manual doesn't explain what other parts of the volume do. When is a volume trigger needed? Why would I use local when global seem to do the same? Local volume needs a trigger collider? It just seems like the set up for HDRP is completely different from what the manual says because the shadowmask example just outright doesn't do what it says.
     
    Last edited: Sep 15, 2021
  9. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,470
    Yeah it looks like BetterLit doesn't apply fresnel to indirect specular that I output (I thought it does). Just submitted a fix where fresnel is applied directly in Bakery stackable code.

    ...returning in a few hours to answer other questions...
     
    keeponshading likes this.
  10. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    363
    Another issue with the API is if I bake with the "renderbutton" function it will not output to the proper path like pressing the actual render button does.
     
  11. mikeohc

    mikeohc

    Joined:
    Jul 1, 2020
    Posts:
    162
    I feel like I'm just fighting an uphill battle with Bakery trying to get it to work in HDRP.
    1) Skylight doesn't work? Followed the manual Quickstart but gets a completely different result in a fresh HDRP project.
    2) Shadowmask (not distance shadowmask) doesn't cover shadow areas in volume? What's the point of using volume if it only works for distance shadowmask?
    3) All examples need to lots of extra work to even remotely see what's happening. e.g. need to place extra reflection probes to get lighting to work. Manually switching to the shadergraph ver, but how would I know which to replace it with when I can't even looked at the examples properly?

    Screenshot (341).png Screenshot (343).png
     
  12. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    59
    Hello,
    I think i encouter a bug with Xatlas packer with post-packing option on.
    It looks like some random objects aren't considered in the shadowmask map. The space is plain black and i can see other islands padding bleeding over it. The GI map looks correct. In result, the real time lighting never enlight those objects.
    Thanks.
     
  13. Npicouet

    Npicouet

    Joined:
    May 17, 2018
    Posts:
    23
    Hello! I've been running into this recently:

    Whenever I do "Render", I immediately afterwards want to do a "Render Light Probes", but I always get this error message. It makes it so I always have to bake twice if I want to render out the probes, which can be a waste of time when bakes get longer.

    Any reason this is occurring?
     

    Attached Files:

  14. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    363
    You might be doing what i did and tried using the "blend probes" setting instead of setting lightmap scale to 0
     
  15. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,470
    Disagree, I do both! Reality is an inspiration to me. I don't want to "sweeten" it in CG too much, rather just focus on things I find beautiful. People often can't see beauty around them.

    It should work, but can also result in many weird bugs when combined with GI.

    Yeah, it might be possible, but I'm not sure what data layout/runtime logic will work. The most brute-force solution would be to store a bunch of volumes for different frequencies (or just a lowpass coeff?) + reverb parameters + direction SH for each "audio probe" in relation to each other probe. When you play a sound, just find closest sound probes and listener probes and look up the array. Actually it might be feasible? E.g. 16 byte payload with 4096 probes would be just about 256 MB. And it can be streamed.

    Do you have terrains? Can you check if disabling "terrain optimization" fixes it?
    If it's not the case, are you sure that your objects are properly unwrapped (have UV1? have "generate lightmapping UVs" enabled?)
    "Look dark": are you using Bakery light components?
    https://geom.io/bakery/wiki/index.php?title=Manual#Quickstart

    Area lights themselves don't have this problem, but as mentioned in the docs:

    Similar problem may also occur when using very small and very bright emissive surfaces, or similarly small surfaces lit by a very intense light. 


    Basically if you have an area light very close to an object, this object will be lit bright enough to become an emissive light source itself. But as surfaces lit by Light Meshes are not Light Meshes by themselves, rays may miss them frequently, depending on their size. How are your Light Meshes placed?

    If you're trying to imitate indirect lamps like these:



    ... then it's easier to fake it a bit using the reflector AS the light source (Light Mesh), for a cleaner result. Otherwise it would require too many GI samples.

    Is there any problem just using plain Skylight instead of per-window area lights? Are windows small?

    Now I'm not sure it's about fireflies. Main problem with Light Meshes without the "self-shadow" option is the "blobby" look, as they break down to a bunch of randomly placed virtual point lights. This problem is mainly visible in close proximity to the Light Mesh. It can go away when increasing the sample count (sometimes it's OK to turn it up to even ~16384 for a single light). Moving the light a bit away from the geometry will also help.

    Does it happen with OptiX 7 denoiser? If so, can you check if using any other (e.g. OptiX 6) works better?
    Otherwise I'm not sure.

    Yeah, somehow I forgot to add this file to the store version :eek:
    You can get it via the patcher, and it'll be fixed in the next store release. I'm also attaching this file to the post.
    It is only used when you have LODs in the scene, atlas packer is set to xatlas, post-packing option is enabled, and you're baking in Shadowmask mode.

    Cancel it as soon as it's longer than 20 minutes. There is something horribly wrong with your setup. No UVs? No Bakery lights? 100 km terrains with a billion of painted trees? It might be a good idea to just take a small chunk of your scene and try to bake it, for quick iteration. Then try it on a larger scene.

    Phew!

    Woah. But are you using OptiX 7?

    Tried, but can't repro :confused:
    Any example package/project would help.

    Perhaps bake the indoors separately? In e.g. separate scenes or as Lightmapped Prefabs. It should also bake faster, skipping the exterior.
     

    Attached Files:

  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,470
    Do you mean it happens when different rocks are at different LODs? Seems logical, as each rock LOD level is baked with other rocks of the same LOD level. It's not possible to fix with just bake settings.
    I would probably switch the LOD for multiple intersecting rocks at once.

    Where do you run this script from? If Bakery is set up to unload scenes, and the script is running from a non-static method within the scene, it will get unloaded.
    Usually I use static methods and EditorApplication.update, as they're global:

        static IEnumerator progressFunc;

    IEnumerator BatchBakeFunc()
    {
    ...
    static void BatchBakeUpdate()
    {
    if (progressFunc.MoveNext()) return;
    EditorApplication.update -= BatchBakeUpdate;
    }
    ...
    progressFunc = BatchBakeFunc();
    EditorApplication.update += BatchBakeUpdate;


    Was fixed. Please use the patched version (will be on the store soon): https://geom.io/bakery/wiki/index.php?title=Github_access

    Hmm what was the problem with NOT_Lonely's graphs? Perhaps I can ask him if you have any error messages or something.

    Yeah, I have it mentioned here: https://geom.io/bakery/wiki/index.php?title=Manual#Notes_on_HDRP.2FURP

    In HDRP, the default HDRI sky intensity is high (11) and sky reflection is not being occluded by default. Together with default eye adaption it may result in some example scenes being hardly visible, as they are baked using much lower intensities. Reduce HDRI sky intensity to 1 in this case. HDRI settings are usually located in Assets/HDRPDefaultResources/DefaultSettingsVolumeProfile.


    So each volume is simply:
    - 3x 3D textures with colors coming from different directions.
    - (optional) one 3D texture with shadows from shadowmasked lights.
    - A couple of Vector3s defining volume's bounds.

    If shader supports volumes, it just needs these things to be set on the material. And you can do just that (they're not exposed in the UI though). But as we don't really want to create unique materials for every scene/area, we can also

    a) Set them globally (using Shader.SetGlobalTexture/SetGlobalVector). This way all scene materials will use these values, if they don't have their own. "Global" checkbox does this, but it's only OK if you have just a single large volume per-scene (or some fallback volume).

    b) Override them per-renderer, not per-material, via MaterialPropertyBlocks. Trigger/receiver scripts are an example of how it can be implemented. Note that they're just an example. It is possible to script any other property-setting logic, without using any trigger colliders. Trigger is just the simplest possible example I could think of. You can check these scripts, they are very simple.

    There is currently no shadowmasked volume graph for HDRP. I'm not sure how to wire it up there yet. Even BetterLit implementation misses it currently. Shader graphs don't provide any injection point for shadowmasks, and BetterLit author didn't figure it out in the code. HDRP is generally not very friendly when it comes to extending it.

    What does it do if it doesn't work?

    You don't need extra probes. Following these notes should be enough to get them looking OK: https://geom.io/bakery/wiki/index.php?title=Manual#Notes_on_HDRP.2FURP

    Are you sure you're at least on v1.9?

    upload_2021-9-15_23-6-39.png

    It shouldn't happen, BUT is there a reason to do it immediately? L1 light probes are automatically baked during normal "Render" anyway. The button is really only useful for the Legacy light probe mode.
     
    mikeohc likes this.
  17. Npicouet

    Npicouet

    Joined:
    May 17, 2018
    Posts:
    23
    Oh I didn't know it automatically baked the probes! I feel like it didn't look like they were baked, but it could just be old habits dying hard. I'll take a closer look after my next render to make sure the probes automatically baked correctly.

    Thanks!
     
    guycalledfrank likes this.
  18. noam_2000

    noam_2000

    Joined:
    Sep 14, 2017
    Posts:
    11
    I've been using Bakery for a good while and haven't ran into any issues, until today on a specific scene I am working on - where every object that is marked for GI contribution, although bakes correctly, becomes a lot darker and badly lit.



    The weird thing is, even if clearing & deleting the bake data, this artifact stays. Neither does an editor restart help - it's as if the model becomes "tainted" after the bake. If you duplicate it, the duplicate doesn't contain this artifact.

    As mentioned, this issue only appears for me in this one specific scene and none other, so I assume there is something wrong with it - I'm just not sure where to look, and would really appreciate some direction if you have some ideas on what might be going on.

    Unity Version: 2019.3.7f1
    Rendering Pipeline: HDRP 7.1.8
    Bakery Version: 1.9.0

    Bake Settings:


    ** Used without Bakery shaders. And yes, all models have proper UVMaps with generated lightmaps UV's.

    Light Setting Example:


    If there is any more useful info I can hand out, please let me know, as I'm running a bit blind on this. Thank you for your time!
     
  19. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,234
    Go to the Bakery options menu and clear all bakery scene settings.
    This will clear any corrupted scene settings.
    You will lose the Bakery render config, but not any light settings in your scene, so it's easy to just reconfigure the render options.
    Bakery stores a per scene config on a hidden object in the hierarchy, this option deletes this object from the scene, but it is recreated on the next render, so it's ok.
    If that doesn't fix it, it may be related to Bakery's UV adjustments per mesh. You can also reset any UV adjustments Bakery made in the options menu.
    Those adjustments will be redone on the next render.
     
  20. davesmeathers

    davesmeathers

    Joined:
    Aug 18, 2015
    Posts:
    6
    Exactly that. That's a shame, I was hoping there was some solution that I'd missed. Thanks for the reply.
     
  21. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    612
    I'm following the quickstart guide in the manual. When I click "Match scene skybox to this light", nothing really happens and it says in the inspector "Skylight doesn't match skybox: texture doesn't match". What's going on there?

    I'm using HDRP in Unity 2021.1.19f1
     
  22. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    59
    Indeed, it happens with OptiX 7.
    It's fine with open image denoiser, and OptiX 6.

    Concerning shadowmap issue with postpacking.
    Yes, i'm on the latest patch
     
    Last edited: Sep 16, 2021
    guycalledfrank likes this.
  23. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    84
    Fixed my issue and know I can bake my skylight :) thanks @guycalledfrank


    Just have 2 issues.

    - Tress look too dark:



    This is the real color with camera light:




    The second issue is some very dark edges:



     
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,470
    Do you have a Skylight? Looks like your pre-baked scene was using flat blue ambient colors, so you should use Skylight to emulate this: https://geom.io/bakery/wiki/index.php?title=Manual#Bakery_Sky_Light
    Or you can try something like this: https://geom.io/bakery/wiki/index.php?title=How_do_I...#How_do_I_add_fake_ambient_lighting.3F

    - It doesn't work in HDRP.
    - You don't really need it, as it doesn't affect the bake.
    Updated the docs a bit.

    Thanks! Will investigate.

    Are you sure?... is your postAddMask.ptx the same as in this post? https://forum.unity.com/threads/bak...preview-released.536008/page-112#post-7498115

    Otherwise I'm not sure why it can happen. Any test package/project will help me debug it.

    Are they unwrapped?...
    Maybe check how they look with my UV debug material: https://geom.io/bakery/wiki/index.php?title=Community_extensions#UV_Debug_Shader

    Are you using Ambient Occlusion? Is the ground a regular Unity terrain or a mesh? Do road borders have two-sided geometry by any chance?
     
  25. noam_2000

    noam_2000

    Joined:
    Sep 14, 2017
    Posts:
    11
    guycalledfrank likes this.
  26. mikeohc

    mikeohc

    Joined:
    Jul 1, 2020
    Posts:
    162
    I think the main point missing is that the doc says :
    The profile set in Unity Lighting Tab -> Environment seem to no longer work. Need a gameobject with Unity's global volume override to affect the scene. What matters the most is that Bakery Direct intensity is set to 1, and Match Real-time with Lightmapped for the lighting to look correct.

    Once the Bakery Direct intensity is set to 1, most scene work correctly. In the example_directional_SH the SHGraph, and SpecSHGraph gives this result.
    Screenshot (350).png

    Skylight does work, it was the button Match scene skybox to this light that doesn't. But it was address in the post above.

    Thank you for this. I couldn't find anything in the doc to refer to when this problem came up.

    1) So global volume switches all material within the volume to use apply the 3D textures, whereas local applies these 3D textures per renderer ONLY WHEN a receiver is triggered (or called)?
    2) Would the set up for a large scene be to use a single large global volume, then place small local volumes within? Or would it be placing multiple global and multiple local volumes all separately, wherever is needed?

    Thanks for taking the time to reply. Appreciate all the help.
     
    guycalledfrank likes this.
  27. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    812
    Don t know if this helps but here' s some general useful Shadomask information in SRP.

    https://catlikecoding.com/unity/tutorials/custom-srp/shadow-masks/
     
  28. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    84
    I didn't get it. In the manual you say it's a good practice not to check "Generate Lightmap UV" in Unity but sometimes you say it's good to do it otherwise the bake will give errors.

    I'm not using Ambient Oclussion. It's a regular Unity terrain.

    Some borders are clean:



    And some are not (even it's the same prefab):




    It happens more where there is water (the water moves but it contributes to GI):




    Also the grass that "touch" the water is dark, but not the grass that doesn't:



    Im using this settings:


     
    Last edited: Sep 17, 2021
  29. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    59
    It's a better practice to have a proper lightmap UV channel made in your 3d package.
    Unity unfolding is an automatic process. It will project from different angles and add cuts where you don't necessarily want.
    But...for some very geometrical meshes, it could do the job for zero effort. It could also help debugging in case the mesh has badly unfolded UV's causing artefacts (basicaly because of artists making a poor job...).

    You have to check adjust sample position to fix the black pixels artefacts. I'm not sure if your water should be static tho.
     
    matiasges likes this.
  30. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,234
    Automatic unfolding does a better job than me to unwrap a mesh without stretching :p
    It will however create more seams and UV islands than making it by hand, but again, it can be configured.
    I think that manual unwrapping is a legacy feature from a time that was either that or primitive projection mapping and which was only useful to paint the mesh texture in a 2D app like Photoshop and reusing or mirroring parts of the texture.
    Nowadays, I use auto unwrap for everything and it works wonders. (except for very specific shapes like spheres)
     
    guycalledfrank likes this.
  31. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    83
    Is it possible to bake volumes only?
    I have empty "character" scene with Bakery Volume and I am instancing character on play, so i need baked ambient. Bakery wont let me bake scene with no static mesh though and even with some static cube after bake it seems like the volume data is not working as expected.
    Other usage of this is baking grass shadows onto terrain but omitting them when baking Volumes to avoid black when Volume res is low
     
  32. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    84
    I checked adjust sample position and it looks way better.

    However I still get some black spots...

    This is one building from one side:


    The other side (same building):


    It has those black shadows in different areas.

    Also some black spots out of nowhere?





    I'm still having issues with the trees. They look to dark outside.
    This is how a tree looks inside a building (dark interiors):



    This is how it looks outside:




    Problem is that if I don't mark it to contribute to GI it looks yellowish after baking. Everything that doesn't contribute to GI look yellowish.

    This is one of my characters who looks yellowish after baking:



    And if I check contribute to GI to the character it looks better but dirty:

     
  33. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    363
    Ah I see, I might have some difficulty with that, as my script has a lot of scene references. In short the script applies various configurations for the time of day which has a lot of object references.

    I might not be a good enough programmer for this one XD, not in the timeframe I need anyway.
     
  34. OmnifariousStudios

    OmnifariousStudios

    Joined:
    Mar 12, 2018
    Posts:
    23
    So I've been using Bakery for the past few days and everything has been going really well for multiple scenes. Then on one scene it's just been crashing every time I try to start Baking or even start the Preview add-on. I get this notification when it crashes. Any ideas?

    upload_2021-9-17_22-37-32.png
     
  35. OmnifariousStudios

    OmnifariousStudios

    Joined:
    Mar 12, 2018
    Posts:
    23
    I'm working on a fast-paced, action VR game for PCVR (and eventually Quest 2 port) so I'm really trying to optimize as much as possible.

    I've just been using Indirect mode, setting all my Bakery lights to Direct and Indirect, and leaving 1 Unity Directional light as Mixed.

    But I've heard that Subtractive was the most performant mode and would be good for VR in general. Is one better than the other, specifically for VR and performance?
     
  36. NotQuiteSmith

    NotQuiteSmith

    Joined:
    Oct 27, 2013
    Posts:
    88
    Purchased Bakery + Realtime preview yesterday - looks very promising!
    Could someone please advise or link to the best workflow to use? i.e.

    - Is the idea that, in a new scene, you create Bakery light sources instead of regular Unity ones as you build the scene? If I do, there's none of the regular feedback in the scene view of how the light affects the scene. I have the realtime previewer so it's not a problem but was wondering what everyone else does.
    - When you have existing lights to convert to Bakery, is it best to add the bakery point/direct/etc. script to the light and leave the existing Unity light script alone (using the "match lightmapped to realtime" button to set it up)?
    - I have one scene with LOTS of existing lights - is there any way to add the correct Bakery script to all of them...?

    Thanks for any help!
     
  37. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,234
    I do that.

    There is not.
    That's one thing that Bakery could improve.
    But you can use the search bar in the hierarchy window to search for all lights in your scene by type of light, select them all at once, apply the Bakery light component and press the match button to match them all at once.
     
    NotQuiteSmith likes this.
  38. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    28,021
    Is there a method I can call to blend lightmap seams but on my own texture/UV set? I want to use Bakery's code to enhance my own personal modelling workflow and the lightmap seam blending is very nice (I have an inhouse texture painter). Can I call it on my own textures and UV set? Please advise, it would save so much time :)
     
  39. Felinde

    Felinde

    Joined:
    Sep 19, 2021
    Posts:
    1
    Hi guys, is there the possibility of drag a "Bakery volume" parented to an object? It would be perfect to create a shadows and ambient occlusion for non-static objects.
     
  40. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    812
    Yes. Check the 2nd Volume Demo with the train. The elevator has an moving volume attached.
     
    guycalledfrank likes this.
  41. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,470
    AFAIK you can modify the default settings asset instead of creating a new settings gameobject. Docs point to Assets/HDRPDefaultResources/DefaultSettingsVolumeProfile.

    Apparently HDRP modifies base light intensity when porting scenes from standard pipeline? Added this note here: https://geom.io/bakery/wiki/index.php?title=Manual#Notes_on_HDRP.2FURP

    Weird. What version of HDRP/Unity is it? Does it change after a rebake?
    Last version I tested was HDRP 11 on Unity 2021.1.7:

    upload_2021-9-20_22-13-45.png

    True, updated the doc: https://geom.io/bakery/wiki/index.php?title=Manual#Feature_support_across_shaders

    No, it's global for everything being rendered in a frame. It's used for everything that doesn't have a per-material/per-object override. It simply sets global shader variables.

    Yes. Exactly to make it work "within the volume".

    Yes, it makes sense. Other option is to just use multiple local volumes (if your objects can't get out of them).

    Yeah, there is nothing hard about it in SRP, I have it working in my own SRP :)
    The complexity comes from the HDRP shader system. Shadowmasking is buried very deep and there is no way to modify it from shader graphs, as far as I know. And unlike standard CGIncludes, I can't reliably patch HDRP package code, because it regenerates through the package manager and because it changes frequently.

    Hmmm where did I say it's not a good practice? If you have brilliant pre-made UV1, then yes, it's unnecessary. Otherwise, it's required. And the results are usually pretty decent, especially when combined with xatlas atlas packer and "hole filling".

    Does it move/deform using a vertex shader? Is it higher when using a simple/standard shader? Lightmappers can't use vertex shader deformation (it happens purely on the GPU and can't be read back), they only see original undeformed mesh (note that skinning/blendshapes are still supported).
    And given the dark grass... it feels like your undeformed water mesh is indeed floating above the visible one.

    Currently not, because of some core implementation details. Basically probes/voxels reflect the light coming from the scene and the lights. To get bounces from the scene, it has to cache/bake it on the scene first. If you only need volumes, you can try setting Scale In Lightmap to 0 on everything static or use a low texels per unit value.

    Either it's not unwrapped or perhaps the resolution is super low? If "generate lightmap UVs" is enabled here, try increasing "scale in lightmap" on these objects (to, like, 50).
    It's also a good idea to check your scene with Checker Preview before baking to make sure there are enough texels everywhere.

    Possibly it's your water (that is lowered by the vertex shader)?

    Your trees look like they are not baked at all. Are they static? Do they have a lightmap? Are they regular models or SpeedTrees? (speedtrees don't have UV1 and need light probes).

    "Yellowish" is your realtime light apparently. Try clicking "Update skybox probe". Also check if it comes from your realtime directional light(s). Possibly place light probes or volumes as they are required for dynamic object lighting.

    "Dirty" look happens because of the low resolution.
    Don't statically bake dynamic characters, it's not what you want in most cases.

    Feels like xatlas bug when it tries to pack/unwrap some model. Try disabling xatlas and see it works?

    I would avoid Subtractive and prefer Shadowmask if possible. Subtractive mode assumes you have one shadowed light and your shadow color is the same everywhere: https://docs.unity3d.com/Manual/LightMode-Mixed-Subtractive.html
    When these assumptions are violated (and they will be if you bake any reasonable GI), it can look pretty bad.

    You can have both Unity + Bakery components on lights. Realtime lights will be deactivated after bake.

    Yep.

    You can search lights by type using "t:Light" in the hierarchy window. You can quickly select many lights filtering by both type and name, e.g. "Point t:Light" or "lamp t:Light". Select all of these, add a Bakery component, click "match lightmapped to real-time".

    Hmmm, currently I don't have such function. You can try hacking it perhaps:
    - Create a scene with your object.
    - Mark it static (contribute GI).
    - Put a Lightmap Group on it, using "Original UV" mode.
    - Bake it and cancel it just after it finishes scene export.
    Geometry/UVs are now exported/cached and can be used by the seam fixer.
    - Save your texture as DDS (there are e.g. nvidia/intel plugins for Photoshop) to Bakery's temp folder (default is Users/You/AppData/Local/Temp/frender). Use 16-bit RGBA format:

    upload_2021-9-20_22-59-46.png

    (File should use an older, non-"DX10" header, if there is an option in your exporter about it).
    - Go to the Editor/x64/Bakery
    - Shift click empty space -> Open command window here
    - Type this and press enter:

    seamfixer "C:/Users/YourUserName/AppData/Local/Temp/frender" 0 YourTexture.dds


    Your DDS file should be now updated and you can import it back.

    If it turns out actually useful, I can make some easy-to-use script :D
     
    Last edited: Sep 20, 2021
  42. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    28,021
    Cheers :D Will take a look, it looks hard to automate though!
     
  43. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    83
    Understood, and does texels per unit value influence the volume resolution or does it work with different numbers e.g. clamped with Volume resolution?
     
  44. mikeohc

    mikeohc

    Joined:
    Jul 1, 2020
    Posts:
    162
    Still the same after rebake. I'm using a slightly older version of Unity: 2021.1.0f1. Maybe that's why?

    Screenshot (356).png

    Ah got it, so the global volume bounds are just indicators for where baking stops, not which materials are affected.
     
  45. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,235
    upload_2021-9-22_17-23-7.png
    upload_2021-9-23_11-11-17.png
    Geometry bakes fine in 2021.1.18 (HDRP 11.0.0).
    But on current beta (2021.2.0b HDRP 12.0.0) some areas seem not to reflect light.
    Mesh + import settings and all other settings are identical.
    All buildings are one mesh.
    Replacing buildingmesh by Unity-Cubes renders fine, so its something with the mesh.
    Any idea?
     
    Last edited: Sep 23, 2021
    guycalledfrank likes this.
  46. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    84
    I keep getting a big amount of lightmaps. The Atlas packer is set to xatlas. Terrain optimization is off. Post-packing is enable Texels is set to 5 and I get around 350 lightmaps. With 10-15 texels is above 1000.

    I just have one Skylight.

    What could be wrong?
     
  47. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,234
    The UVs of the 3d models.
    Be sure to set them to import with "generate lightmap uvs" enabled, reimport all the models you are using in your scene and try baking with bakery again.
     
  48. matiasges

    matiasges

    Joined:
    Jan 24, 2021
    Posts:
    84
    All of them have the check to generate lightmap uvs.

    My terrain is 1000x1000 with interiors as well. Maybe that could be a factor?

    Changed the resolution to the highest and almost no difference with the minimum but still giving me around 350 lightmaps
     
    Last edited: Sep 23, 2021
  49. DonCornholio

    DonCornholio

    Joined:
    Feb 27, 2017
    Posts:
    62
    @guycalledfrank hi there ! sorry to bother you, i have quick and simple question:
    I love that you can use Bakery Meta pass, but i wonder if i can make the shaders that use it SRP Batcher compatible ? Or will it still work as Meta Pass is not used at runtime?
    Thank you for your hard work and dedication :)
    upload_2021-9-23_15-6-27.png
     
    guycalledfrank likes this.
  50. DonCornholio

    DonCornholio

    Joined:
    Feb 27, 2017
    Posts:
    62
    Does anybody know why objects that are set to contribute to global illumination but receive only light probes don't seem to contribute to GI and dont throw any shadows ?
    upload_2021-9-23_18-59-48.png
     
unityunity