Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. SteenPetersen

    SteenPetersen

    Joined:
    Mar 13, 2016
    Posts:
    103
    But even in your scene u can see the jagged edge of the shadow on the floor.
     
  2. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
  3. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    If:
    - Model meta files are identical across machines (at least their padding data)
    - ftModelPostprocessor.cs is present on all machines
    - No script compilation errors are present
    - You tried right click -> Reimport
    ... and model UVs still differ, then I can only imagine there is a bug in this particular version of Unity making the built-in unwrapper behave differently on different hardware. You can try using xatlas instead.

    It's not obvious how to properly convert it to color. I wonder if Unity has a way to get the really final float3 used by the light...

    Seems to be a popular question, so I've just added a detailed answer here: https://geom.io/bakery/wiki/index.php?title=Troubleshooting#I_get_too_many_lightmaps

    I thought the problem was this:

    upload_2019-9-22_13-33-29.png

    Regarding jaggies:

    upload_2019-9-22_14-1-26.png
     
    Bovine likes this.
  4. ESludden

    ESludden

    Joined:
    Aug 27, 2012
    Posts:
    19
    Using Bakery, is it still the case that "Unity does not support combining multiple sets of light probes, they are basically global".

    If I wanted to instantiate multiple Lightmapped Prefabs with separate LightProbe groups, that this would not work. In my test scene, my Prefabs show up with only the reflection Probes there, the LightProbes have no data.
     
  5. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    116
    It looks like they just use Mathf.CorrelatedColorTemperatureToRGB?

    Code (CSharp):
    1. // m_Light.intensity is in luminance which is the value we need for emissive color
    2.             Color value = m_Light.color.linear * m_Light.intensity;
    3.             if (useColorTemperature)
    4.                 value *= Mathf.CorrelatedColorTemperatureToRGB(m_Light.colorTemperature);
    There might be a bit more to it than that mind you, so take it with a grain of salt.
     
    guycalledfrank likes this.
  6. oldcloud

    oldcloud

    Joined:
    Apr 15, 2019
    Posts:
    6
    When can support Unity2019.2?
     
  7. DerekYC

    DerekYC

    Joined:
    Jan 7, 2018
    Posts:
    3
    Hey Frank! Just checking in on the light-probed-prefabs thing. Is That still not possible?
     
  8. zeuscfeduex

    zeuscfeduex

    Joined:
    Oct 19, 2018
    Posts:
    2
    Hi Mr F,

    1. In the image with glass material. I keep on getting this weird pixels whenever I bake the scene. That is just a regular mirror material made using Substance.

    2. The Base Board on the wooden floor has this weird light leak that runs through a specific stretch of that mesh. Every time I bake the scene, the light leak along the base board changes.

    The mesh has correct normal and there is no gap between the floor and the wall&base board. There is also thickness on the wall.

    3. I've been reading a lot in this forum in order to improve my baking. I was using 3ds MAX VRAY Baking before for my VR Scene but I just recently changed my workflow.

    I tried to use Bicubic Interpolation for Lightmaps to soften up my shadow and lessen the jagged edges (I'm using 0.05 Shadow Spread on my light). - I got this error when I clicked the button for Bicubic Interpolation.

    FINALLY, I just want to know what is the use of multiplication for shadowmask. I can't see any detail that expounds the meaning of this feature in the editor. Thanks for constant support in this wonderful plugin.

    Sorry if I have a lot of questions.. If you guys have any critique or suggestion in improving my bake. I will greatly appreciate it. I'm using Bakery for VR. I use 3ds MAX - Substance Workflow. This is a VR scene for Oculus Go/Rift.

    Bakery_Inquiry_003.PNG Bakery_Inquiry_002.PNG Bakery_Inquiry_001.PNG
     
  9. aeldred28

    aeldred28

    Joined:
    Dec 16, 2017
    Posts:
    30


    Our lights will not use indirect lighting on any mode, even if the lighting is set to 2000000% on both the light itself and the baker window. Did I just miss something, or is Bakery not working on Unity 2019.2.4f1?

    There is also another issue: The cubemaps we are using do not match the baked result. Bakery is making the lightmasks darker, which makes it difficult to make the baked result look like the dynamic light. Any idea as to why Bakery reads point light cubemaps differently than dynamic lights with the same value?
     
  10. Kabookie

    Kabookie

    Joined:
    Mar 13, 2018
    Posts:
    16
    @guycalledfrank

    Unbaked lights in bakery cause this weird issue
    (2018.3), we get this:
    upload_2019-9-25_11-59-9.png

    All of the shadows in are scene flicker badly when the camera is moved, as well as being incredibly dark and weird looking. How can I fix this issue? It's almost as if Bakery "broke" my shadows in the entire project. If we bake lighting with the asset, it's no issue, but even after removing the bakery lighting scripts on every light, as well as the entire asset itself (as we don't need it anymore), these are still apparent, even after restarting unity.

    It seems somehow Bakery has changed/broke the shadows in our game, when I turn shadows off, the issue disappears. But I need shadows! :p

    Any help would be greatly appreciated.

    Spotlights seems to be affected much worse.
     

    Attached Files:

    Last edited: Sep 25, 2019
  11. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Yes, but it seems like they added support for it in 2019.3 beta: https://blogs.unity3d.com/2019/08/27/unity-2019-3-beta-is-now-available/

    Light Probes from different additively loaded scenes can now be merged,


    But I didn't test it yet. Also note that it's just "additively loaded scenes", so it probably won't work with prefabbed probes.

    Umm, it's great if it's that easy. Shouldn't be a problem to add to the next release then.

    What problems do you experience on 2019.2?

    You mean these?

    upload_2019-9-26_13-3-47.png

    Looks like regular aliasing to me. You seem to have a very thin patch of light close to the glass and it starts to shimmer in the distance or from a sharp angle. Maybe try enlarging the glass, so it overlaps with the window frame a bit, perhaps it'll block this light.

    Can you try increasing "scale in lightmap" for this particular board a bit (or a lot)?

    Ah yes. You'd need to run Unity as administrator and try again. It's not exactly clear to me why it's needed on some machines, but not the others.

    https://geom.io/bakery/wiki/images/6/6a/Image34.jpg
    Left is reference, right is default Unity behaviour. Middle is when this option is enabled.

    Specifically setting intensities to such high values can cause a numeric overflow and paint everything black (actually NaN). I don't recommend using extremely high numbers there.

    Wow. Bakery doesn't really do anything to the lights it doesn't bake. Real-time shadows are only governed by Unity's renderer. Can be a bug in your version of HDRP/Unity or something. I can investigate it, if you can send me some scene with this bug (as unitypackage).
     
  12. greengremline

    greengremline

    Joined:
    Sep 16, 2015
    Posts:
    183
    @guycalledfrank The high lighting intensity was just to see if that was the issue, we don't normally use such intensities - any idea what might be happening? This is on unity 2019.2 so I have a hunch its related to something in the newer updates, not sure what tho

    This might be a blocker for us since we are trying to release an update soon, so hoping it's a quick fix!
     
  13. aeldred28

    aeldred28

    Joined:
    Dec 16, 2017
    Posts:
    30
    The indirect lighting doesnt work on any value whatsoever. 20000% was just to see if anything was happening at all. This is a fresh install of bakery, and I know that indirect has worked in the past. This leads me to think there’s something wrong with the update, or I’m missing something obvious.
     
  14. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    313
    Bakery does not save properly with nested prefabs in a shared scene.

    My setup is:
    One scene with a light setup, used for all rooms in a dungeon.
    Each room has 3 variations, each of which are prefabs
    Each room is built from wall pieces, which are prefabs
    Each room is a prefab

    After baking lights I get:
    The object you are trying to replace does not exist or is not a Prefab.
    UnityEditor.PrefabUtility:ReplacePrefab(GameObject, Object, ReplacePrefabOptions)
    <ApplyBakedData>d__219:MoveNext() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:5667)
    <RenderLightmapFunc>d__218:MoveNext() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:5145)
    ftRenderLightmap:RenderLightmapUpdate() (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3227)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

    Attached a vastly stripped down and simplified screenshot of the scene
     

    Attached Files:

    Last edited: Sep 27, 2019
  15. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Can we get rid of a lots of warnings for Unity 2019.2 please? Such as :

    Assets\Editor\x64\Bakery\scripts\ftBuildLights.cs(115,13): warning CS0618: 'GL.IssuePluginEvent(int)' is obsolete: 'IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.'
     
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Make sure built-in examples bake correctly on your version of Unity. If they don't, it'll be easy to track and fix. If they do, then it's something related to your scene. Can be e.g. custom shaders that don't implement Meta Pass and also don't use _MainTex as albedo.

    If you're using the Lightmapped Prefab component, indeed, I don't think it works with nested prefabs. This is hard to achieve, as Unity did not design nested prefabs with any lightmaps in mind and hacking around them is hard. If you just happen to have nested prefabs in a scene and they somehow don't get baked, that'd be a bug.

    It's harder than it sounds and these warnings don't really break anything.
     
  17. bfoddy

    bfoddy

    Joined:
    Mar 27, 2012
    Posts:
    85
    With more than a few bakery prefabs in the scene I get an index out of range error while the plugin is trying to apply the baked data to the prefabs. Happens every time - see attached screenshot. It successfully applies data to the first two prefabs and then the exception is thrown and it hangs with the 'Finished Rendering' dialog still up.

    I have seven prefabs in the scene.

    /edit also, the baked result (after I force-quit) looks fine in the scene, but if I instantiate more copies of the prefabs, their lightmaps are corrupted - about 50% of the prefab looks right, and the other 50% looks like it has been overwritten with junk data.
     

    Attached Files:

    Last edited: Sep 30, 2019
  18. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Can anyone shine some light into on how to use occlusion probe baking? Do I need to install this from somewhere and then use bakery occlusion probe baking feature? Anyone has done it before? Does it work?
     
  19. XRA

    XRA

    Joined:
    Aug 26, 2010
    Posts:
    265
    I think it is because you have Global Illumination bounces set to 1 *edit* actually that should show the first bounce I think.
    Can you try cycling from Full Lighting to Subtractive, then select a Bakery Light, check that "Baked Contribution" is Direct & Indirect, then switch back to Full Lighting. I've had issues where Baked Contribution is not correct but hidden due to being in Full Lighting.
     
    guycalledfrank likes this.
  20. Shane_Michael

    Shane_Michael

    Joined:
    Jul 8, 2013
    Posts:
    158
    Is possible to add any directionality to a light mesh, or if this is something that might be added in the future?

    I am looking for a way to implement something like a "light proxy meshes". That is, baking incoming light into a mesh (likely just a quad) at one location, and then emitting the outgoing light somewhere else. In general, this could be useful for transporting baked light across multiple scenes, but my specific use case is for transporting light between static portals in a single scene. Using a baked light map as an emissive texture is less than ideal due to its lack of direction. Even a global direction for a given light mesh would be useful (for this and just light design in general), but support for any of your directional lightmap modes would be really awesome.

    I am pretty interested in Bakery already just for its ability to bake out RNM (extracting the directional data from the progressive lightmapper for this purpose so far has been pretty disappointing), but I am curious about transporting light from one location to another.

    Ideally, I would want something like a light transport mesh that would apply a matrix transform to any ray that hits it, but that is likely too specific of a use case to expect your lightmapper to ever support.
     
  21. lzardo2012

    lzardo2012

    Joined:
    Apr 11, 2013
    Posts:
    80
    Hello

    I just acquired your asset and I´m still learning how to use it.

    But, I´m having some issues:

    Using primitives and default material, everything seems to work fine, but, with my own objects and custom shaders I´m not succeding in creating any lightmap.

    I mean, the lightmaps ARE created, I can see the preview (although, most of the times, i cannot OPEN the preview to see the full image, but not always)

    But, in the mesh, nothing is visible.

    To clarify, my shaders have support for lightmaps.

    Also, what I need is to lightmap prefabs and only occlusion mapping (the main reason I bought your asset), I´m using several objects tyhat can combine themselves to create huge maps I intend to use in a mobile game.


    Another thing, the rendering is painfully slow, 10 times slower than Unity´s and I have two 1070 Ti videocards onboard, do I have to set the nvidia acceleration somewhere for it to be used?
     
  22. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Just bumping on more info about occlusion probe baking... I tried this but it didn't seem to affect anything on how the objects are getting affected by the light probes.. No occlusion is happening.. Maybe @guycalledfrank can explain how to use this "occlusion probe" since the tool supports baking it?
     
  23. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Also, baking light probe using Bakery cause this :

    upload_2019-10-2_14-16-17.png

    Tried to use "Remove Ringing" option but it didn't help. Baking using normal Unity didn't produce this error.

    I also get the seam between my modular wall pieces..( as you can see from above ) which I can't seem to get rid of. Tried to increase resolution, increase padding, different atlas method ... nothing helps.
     
    Last edited: Oct 2, 2019
  24. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    150
    Suddenly I started to get
    error: unknown error (1)
    when using Bakery with denoiser. Even in the empty scene (with simple unity cube).

    Any idea about thist? I have updated my nvidia GTX 1080 card with no changes.
     
  25. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Hi! I've just saw your comment on github as well. The bug seems to be fixed, but the fix was on the more_changes branch, and I finally merged it to master. Can you check if it works?

    Occlusion probe is a chunk of additional data stored on each light probe which has 4 shadow masks (each being a single float) for the 4 closest lights. Occlusion probes provide approximated shadowing from mixed lights on dynamic objects instead of using actual real-time shadows. There is a C# access to probe colors, but not to the occlusion data, meaning Bakery can not directly patch them. Therefore I had to hack it and force Unity to at least bake the occlusion data in its own way (Progressive/Enlighten) but let Bakery do everything else and this is what happens if you enable the "Occlusion probes" checkbox and press Render. You'll get the currently active built-in lightmapper calculate the occlusion, then Bakery will continue from that.

    Interesting idea. I'm also getting close to the problem mentioned, as I design and bake parts of the game world separately, and it's not convenient to load and bake everything at once (for now I just place proxy shadow casters, but there is no proxy GI). Existing light meshes are not directional, Bakery just computes how much they are visible/unoccluded from every texel. It's also kinda hacky, as it only uses the real mesh for close rays, but falls back to a cloud of half-point lights (these are basically similar to 180-degree spotlights) with distance to avoid frequent ray misses, and if "selfshadow" option is disabled, only the approximated cloud is used. Direction of these half-point lights equals triangle normal.
    Baking just a single direction into the "light proxy mesh" is unlikely sufficient, as even a single lit plane will emit rays in a whole hemisphere of directions (every point of it). However, you might be able to hack it:

    - Use a "dominant direction" mode to capture incoming light on a quad. Use Lightmap Group with original UV mode to get a dedicated lightmap for the plane. Disable "cast shadows".
    - Generate new mesh, a grid of smaller quads, with each quad corresponding to a texel from the previously baked lightmap;
    - Rotate each quad according to baked dominant direction.
    - Texture the mesh with the lightmap (uncompressed HDR or BC6H). Each quad on the grid should get one solid color.
    - Add a Light Mesh component to it. Make sure "self shadow" is disabled. Set sample count to the number of quads.

    ... now if it actually works, then you'll get a grid of small geometric patches emitting previously recorded light (somewhat). But:

    - Direction precision won't be great. It won't even properly capture a simple directional light, as it doesn't know how parallel the rays should be, so it will result in softer lighting.
    - Equally intense lighting from opposite sides won't work well.
    - Light Mesh won't know about proper attenuation. All quads will have inverse quadratic attenuation, as if they were the actual origin of the light. This can be a problem, especially if you try to put pure directional lights into the "proxy" mesh.

    Did you check it with standard shaders? Either there is something with the mesh (no usable UVs or normals?) or with the shader (not sure).

    Which part is the slowest and which Render Mode do you use? Are you sure you're comparing identical resolution/sample count/bounce count?

    Yep, that's ringing. Did you bake with "Legacy" or "L1" light probe mode?
    Also, while "remove ringing" is ignored by Bakery (there is no ideal way to do it), Bakery shader offers an option to fix it (see Non-linear Light Probe SH): https://geom.io/bakery/wiki/index.php?title=Manual#Bakery_shaders

    Only denoiser throws that? Could be Nvidia messing with the driver.
    Try this one, rebuilt using newer version of OptiX:
    https://drive.google.com/open?id=1ffPqFhcBc9DxFSZ6myJJwtIf2O7LFu_t
    https://drive.google.com/open?id=1R9DqHy24u9dE37C3XNA5_AdzTxA0DiMi
     
    Last edited: Oct 2, 2019
  26. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    150
    Yes, when I disable it, everything bakes with no problem.
    I currently have driver 436.30-standard

    What do you mean by the links? I've tried
    denoiser.exe
    but it gives me missing optix.6.0.0.dll, if I rename the
    optix_denoiser.6.0.0.dll
    to it, I get this error, when running the
    denoiser.exe
    .

    upload_2019-10-2_18-5-23.png
     
  27. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Are you on Bakery v1.6? optix.6.0.0.dll should be there since the addition of RTX support.
     
  28. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    937
    Hey. HDRP will be out out preview in 2019.3.0.
    Do you plan to provide an Bakery Shadergraph?

    There is a custom function node and a Shadergraph clone from the HDRP Lit in this video,

    After this session i believe there is everything there to do an similar shader like the bakery standard shader from Builtin RP.
    Plus some Shadergraph freedom.
    What do you think?
     
    Last edited: Oct 10, 2019
  29. Shane_Michael

    Shane_Michael

    Joined:
    Jul 8, 2013
    Posts:
    158
    Thanks for your thoughts. Yes, that might work okay for indirect lighting, but I was hoping you might already have a built-in solution for a proxy GI object that could capture directional light. I may need to bite the bullet and just write some kind of minimalist pre-bake portal-aware raytracer. If I pre-calculate just the direct lighting coming through the portals, I should be able to use that as an emissive texture in the meta pass for GI and then add it into the final lightmap post-bake. A naive CPU raytracer should be (relatively) easy to implement and not prohibitively slow if I limit it to only direct lighting from directional/point lights, and then I could simply hand it off to Bakery GPU baker for the full GI bake.

    But thanks again for your input. I haven't picked up Bakery yet, but the flexibility and feature set seems to be a cut above the progressive lightmapper so I think I might have to this week.
     
    guycalledfrank likes this.
  30. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Yes.

    Direct lighting should be the least concern though, isn't it? If you separately bake scenes A and B and want them to seamlessly stick to each other in terms of direct lighting, you should be able to just use lights from both A & B near their border along with some non-baked (scale in lightmap = 0) shadow casters? The biggest problem is transferring GI from A to B, but it has more relaxed directionality requirements.
     
  31. Shane_Michael

    Shane_Michael

    Joined:
    Jul 8, 2013
    Posts:
    158
    In general, yes, but I am dealing with non-euclidean geometry so there is some type of spatial transform happening between the portals. So scene A and scene B are the same scene with some inverse portal transform applied, so in "scene space" the geometry could be overlapping itself any number of times in any number of ways once I untangle all the portals (particularly once you include recursion). There may be a way to get it to work with multiple bakes, bisecting planes, proxy shadowcasters, and the clever use of layers, but that seems like a complex and fragile solution.

    If I had some type of high quality light proxy object, it would be easiest to capture the incoming light, and then emit it at the outgoing portal. I could get recursive lighting through the portals by saving the light proxy each bake and baking the scene multiple times. That would be ideal.

    Failing that, a bare-bones raycaster with a special case to transform rays when they hit a portal is probably the easiest. I only need it to be fast enough to bake out direct lighting. Then I could use a light mesh to approximate the indirect lighting through each portal which, as you say, is not as sensitive to direction.

    Here's a simple diagram of the general idea: a single directional light and two portals. Light enters portal A and exits portal B. So portal A casts a shadow, and portal B casts a regular shadow as well as a kind of "negative shadow" because that part of the floor is being double-lit by the single directional light. With more complex configurations of portals you can imagine how this becomes challenging to bake lighting for.

    portal_lighting.jpg

    This is a fairly unorthodox requirement for light baking so I certainly didn't expect your baker to support it directly, but I was just curious if you maybe had a few tools that might make it a bit easier.
     
    guycalledfrank likes this.
  32. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I feel like this is not going to be possible, but if I disable cast shadow option in say directional light, will bakery respect that when baking?
     
  33. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    150
    I see, I tried to run it as standalone (didnt replace them in the folder). It is working now, I have also found the previous error in the
    .denoiserlog.txt
    (didnt know it exist)


    Code (CSharp):
    1.  
    2. 2019-8-22
    3. Init...
    4. Loading shader denoisePrepare.ptx::oxMain...
    5. Loading shader denoiseFinish.ptx::oxMain...
    6. Tiles: 1
    7. 2019-9-18
    8. Init...
    9. Loading shader denoisePrepare.ptx::oxMain...
    10. Loading shader denoiseFinish.ptx::oxMain...
    11. Error (-1): Unknown error (Details: Function "_rtCommandListFinalize" caught exception: Could not load denoiser library.)
     
    guycalledfrank likes this.
  34. Rangers_Antoine

    Rangers_Antoine

    Joined:
    Sep 12, 2018
    Posts:
    8
    Hi,

    We are in Unity 2018.4.1f1.
    When I bake my scene on my computer, it's fine. Like this : GoodLighting.jpg

    Now I want to commit my changes with source control software ( We use GitHub ). But on my coworker scene, the lightmap is broken :
    BadLighting.png

    We push all the bakery's files but nothing change.
    It's very strange because in my computer, i can't see lightmap preview and i can't see the baked lightmap view in the shading mode of the viewport. But my coworker can. As if Bakery controlled the lightmaps on my computer and Unity control the lightmap on my coworker's computer.

    I bake in experimental mode full lighting, with Dominant direction and RTX mode ( We both have RTX2070)

    Maybe we miss something ?
     
    Kesh and JoRangers like this.
  35. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I need bakery to respect cast shadow option for the lights.. and make the light probe result the same as Unity's so there is no ringing.. When I bake using bakery, I get the ring issue on probes, but not when I use Unitys's Enlighten or Progress..

    I know there was mention about using custom shader to get around the issue, but I don't really want to.. when Unity's probe baking gives me the better result. So Bakery is good for making maps, but for probes it has problems. If bakery is using Unity's baking for light probes why does result differ?
     
  36. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Also I am trying to use xatlas, but i am getting something like below.

    upload_2019-10-4_22-45-55.png

    I am not sure if this looks like it is using xatlas.. I tried to toggle in between Unity's default one, but nothing seems to change.
     
  37. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Ah, that's pretty cool! But how would you solve it with a custom raycaster? Usually for direct lights I trace rays exactly in the light direction:

    upload_2019-10-6_11-5-46.png

    For GI rays are uniformly distributed across a cosine-weighted hemisphere:

    upload_2019-10-6_11-8-3.png

    But how are you going to cast for portals? If rays are targeting the "main" sun, they may never hit a portal. If you're using the hemisphere, you'll need a hell ton of rays to make sure portals are hit (and you can still end up with aliasing/noise at distance, as hit chance decreases). You can perhaps have a separate directional light pass for every portal... but what happens to portals inside other portals?
    Photon mapping techniques may be better suited for this task, as you would trace "photons" from the light to the world, through the portals, instead of the other way around.

    I'm still planning to make Bakery extensible one day, so you can write arbitrary CUDA tracing code but without all the dirty work (scene export, lightmap import, pass combination). Having a quick way to trace massive amounts of rays in your Unity scene could be useful for many tools, even beyond lightmapping. If you have any ideas on how the ideal API/workflow should look, please share :)

    No, BUT you can set shadow samples to 0, and it will effectively disable shadows. Works for directionals and points.

    All guidelines are here: https://geom.io/bakery/wiki/index.p...2Fother_version_control_system_with_Bakery.3F
    I had reports of some cases where even these sometimes didn't help, in which case see my response from the previous page:

    Bakery only uses Unity to get occlusion probe data, not colors.

    Can you post a comparison? This looks like a plausible result from xatlas to me.
     
    JoRangers likes this.
  38. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    Some more illustrated suggestions on ringing:

    upload_2019-10-6_12-28-11.png

    First, try with the L1 mode. Then if you feel like it lacks details or smoothness of the Legacy mode, try reducing values of irradianceConvolutionL2_4_5_7, irradianceConvolutionL2_6 and irradianceConvolutionL2_8 in ftRenderLightmap.cs, as higher order SH coefficients are the usual cause of ringing. This may reduce contrast a bit, but it's somewhat similar to Unity's ringing fix.
     
    atomicjoe and keeponshading like this.
  39. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    For xatlas issue , I cant compare it because even if I change layout option to be unity or xatlas, nothing actually changes. Layout stays the same no matter what option I choose for layout. This is true even if I reimport models after changing options.. it always layouts using each models own layout looking squares and then they are layed out like image. For me, it looks like Unity default ones... I am ofcourse using 64bit windows. And when model imports it has debug message saying xatlas was trying to post process it...

    I could definitely be wrong here... but can xatlas layout uvs of different objects to be more efficient as shown in xatlas blogs link? Or it only works within one mesh which explains why it looks like default unity one?
     
  40. Shane_Michael

    Shane_Michael

    Joined:
    Jul 8, 2013
    Posts:
    158
    I am planning on tracing rays directly towards lights as they would be inside each portal, recursively. The complexity of this is not super-encouraging (exponential with recursion level: lightCount * pow(portalCount, recursionLevel)), but if I keep a light-list and recursion-level for each portal, that should tame it a bit.

    And not hitting a portal is actually an advantage because I always know which portal (or portals) I am expecting each ray to hit so I can do an intersection test against the portal bounding box to exclude most rays before I actually have to cast them. Each recursion level will add a lot more rays, but will also let the pre-test exclude a higher proportion of them so, I think, it will turn out to be not so bad.

    Of course, I'm still working on it right now so I'll see how it goes. Trying to keep it as simple as possible. I did see your article on lightmap baking artifacts so I will see how much of that I can get away with not implementing. It will be only a small portion of the total baked light in any scene so I can afford a higher error tolerance.

    Making Bakery extensible would be really nice because it would be nice to be able to customize the wheel without having to re-invent it. Will see how this goes and then will likely have some ideas if you ever get around to doing that.
     
    guycalledfrank likes this.
  41. Shane_Michael

    Shane_Michael

    Joined:
    Jul 8, 2013
    Posts:
    158
    As a follow-up, does Bakery have an API to get the generated UV Gbuffer for a scene? I am using a (naive) rasterization of the position and normal into a floating point texture, and grabbing those values into a native array to generate rays, but they aren't perfect. From your article it sounds like the ones Bakery is generating would be better if they are accessible.
     
  42. JoJa15

    JoJa15

    Joined:
    Feb 11, 2017
    Posts:
    17
    I am very new to light mapping. What is the best way to get a quick preview of what my light map may look like before committing to a long bake process? currently I adjust a light, bake for 20 minutes, adjust a light bake for 20 minutes, etc.
     
  43. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    112
    Use low values of "texel for unit" i use like 4 or 5 for preview and then 10 to 15 for final.
    reduce bounces to 2 and Samples to 4.
     
    guycalledfrank and JoJa15 like this.
  44. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    The option is really applied when you hit Render and get the UV padding adjustment running. Then the selected unwrapper is used and both padding/unwrapper values are stored and used for future reimports.

    Well if it says so... then you must be seeing the xatlas layout indeed.

    It depends on the model and the padding size really. Larger padding usually produces more UV seams. And padding size depends on lightmap resolution for this particular model (smaller lightmap = larger padding).

    Not yet, but the most important bit is using > 1 samples. In case of Bakery I'm drawing it 5x5 times with subpixel shifts. Albedo and emission are rendered directly in Unity, you can copy the bits from ftUVGBufferGen.cs. Position/normals are done in a DLL where I additionally enable conservative raster if supported by HW, but it doesn't really improve much after the 5x5 grid.

    I feel your pain. Solutions are:
    - As mentioned, try with lower Texels and Samples first
    - In the upcoming version that you can get from github I added a "Samples multiplier" option that simultaneously reduces all sample counts on all lights and GI, exactly for quick preview/prod switching:

    upload_2019-10-8_11-45-2.png

    - Really planning to add a progressive camera-view renderer so it can be even faster!
     
    Shane_Michael likes this.
  45. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I don't think I was able to express what I was experiencing. :

    There is no difference at all for how lightmaps were baked, even if I :

    1. set as legacy (unity) as unwrapper and then reimported the meshes, and baked.
    2. set as xatlas as unwrapper and then reimported the meshes, and baked.

    I keep going back and forth doing 1, and 2 but resulting bake always stays the same. That is why I was asking above and felt it is weird.
     
  46. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,667
    OK, that's weird, yeah. You don't need to manually reimport them, BTW. Are you sure they are exactly identical and not just similar?
     
  47. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Hi, got a few questions. Does Bakery handles multi-scene setup gracefully?
    And how is it compared to the Progressive GPU lighmapper on the VRAM usage?

    I've got a bunch of scenes loaded additively that are quite big in size, and Progressive GPU simply fails even on smallest res due to VRAM limit.
    CPU iteration time is abyssmal with Progressive CPU.

    (My main concern is Terrain + baking on 1.5km / 1.5km scale, will it work on GTX 1050 TI?)

    Also, would like to know, is Bakery compatible with Lux shader pack?
     
    Last edited: Oct 8, 2019
  48. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Ok, I will do more deep comparisions. Just one thing, how can I use Baked Lightmaps preview feature using bakery? It says the light map is not available.. as if it was not baked. I think Unity doesn't know it has lightmap baked because I never used the Unity's own baking feature?
     
  49. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    313
    I ran Bakery overnight, in the morning I have lightmaps textures, however no Lighting Data Asset was created.

    Log is not very useful, beginning and end repeats itself with no other relevant information

    upload_2019-10-9_7-19-31.png


    upload_2019-10-9_7-21-11.png
     

    Attached Files:

  50. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    313
    Bakery settings:
    upload_2019-10-9_7-26-13.png

    upload_2019-10-9_7-26-36.png