Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

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

  1. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Unfortunately I can't reproduce this bug. Can you get it happening on a simple test scene loaded via bundle? Is there anything special about this particular object (as other objects are apparently fine)?
     
  2. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Alright, v1.45 was submitted!
    This is a minor update that should hopefully resolve all common problems.
    Full changelog:

    - Added checker preview to analyze texel sizes and packing before baking.
    - Added Lightmapped Prefab component.
    - Added double-sided option to Bakery shader.
    - Added option to mix Bakery lightmaps and Enlighten real-time GI (thanks TheXiexe).
    - Fixed various problems with version control.
    - Fixed errors in light probe calculation, they should now have proper contrast/saturation/directionality.
    - Fixed banding artifacts on point light shadows.
    - Fixed noise sometimes appearing in shadows and slightly improved leak prevention.
    - When assigning channels to shadowmasks, bitmasks are now respected, meaning you can have > 4 overlapping shadowmasked lights if they use a different bitmask.
    - Fixed bitmask being reset on lights when selecting multiple lights with different values.
    - Denoiser library is upgraded to prevent driver crashes after recent Win10 updates.
    - Added option to produce separate atlases for every scene in a multi-scene setup.
    - Multi-scene bakes no longer store references to all lightmaps in every scene, and runtime scene unloading is now properly handled.
    - Material.MaterialGlobalIlluminationFlags are now respected.
    - Unnecessary data (like bake settings) is now stripped from builds.
    - All error messages are now more descriptive.
    - Fixed incorrect overlap detection for models with custom UVs.
    - Removed cross-dependencies from code to allow scene distribution with only a minimal set of scripts.
    - Removed tonemapping from Sponza examples to prevent missing references to the old postprocessing system.
     
  3. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    183
    Nope, sorry if it wasn't clear - this is happening to every object that has the bakery shader with that particular RNM lighting. Actually, I have been able to also reproduce it in editor by loading a baked room via asset bundle instead of direct reference (like in a build) - when loading from a bundle, the room appears super glowy just like in a build (only in the player, not in scene view) Interestingly, if I delete a mesh renderer and then ctrl+z, the reverted renderer has the right material (without the super glowy lights)...

    I tried something else. I created a completely new camera first, to ensure that our image effects weren't the issue. I discovered that unchecked 'Allow HDR' on the camera also fixes the issue
    With HDR:

    Without HDR:


    I'll see if I can create a test project

    Thanks for all your hard work on this!
     
    Last edited: Nov 13, 2018
    guycalledfrank likes this.
  4. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    And it's on the store now!

    Hmm, interesting, but that still doesn't happen on my example scenes though. I'd appreciate if you could send me a minimal bugged unitypackage.
     
    CoastKid likes this.
  5. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    Happy Bakery Updating Day!
     
  6. Flow-Fire-Games

    Flow-Fire-Games

    Joined:
    Jun 11, 2015
    Posts:
    245
    Hello,
    One question, it says "Supports baked prefabs"
    Could you ellaborate how this works?

    Can I have per example one building (with overlapping UV), then bake a lightmap as usual, and when it ingame is built, it has the lightmap loaded from the prefab?
     
  7. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    You still need valid lightmapping UVs.

    "Baked prefabs" means you can bake prefabs and then clone/instantiate them in editor and at runtime, and they will always retain previously baked lighting. It might be useful when assembling your game level from many similar parts/modules and when reusing the same lightmap across all instances is not too noticeable, allowing to save baking time and memory.
     
    Lars-Steenhoff likes this.
  8. Flow-Fire-Games

    Flow-Fire-Games

    Joined:
    Jun 11, 2015
    Posts:
    245
    Thanks! So this sounds like that works what I planned
    Is it possible to bake non directional occlusion?
     
  9. Cre8ing

    Cre8ing

    Joined:
    Jun 2, 2018
    Posts:
    5
    currently I am experiencing problems with compatibility between Backery and Post Processing stack. I have created a new project to test this. When I import Bakery, I get the following error messages:
    Knipsel-Unity.JPG

    when I then import Post Processing Stack I do not get to see the scripts of this package. When I restart the program, Bakery appears to have disappeared from the topmenu. I tested this in unity 2018.2.14 and 15. Bakery 1.45.
    Knipsel-Unity2.JPG

    Yesterday I tested Bakery with my 4 GTX 1080ti's and to my great joy they were all 4 used. Everything looked much better than with Unity's standard lightmappers. Unfortunately, my joy is short-lived.

    Hopefully this can be resolved quickly.

    thanks,
    Bert


    P.S. Bakery also does not work on a mac with Nvidia GPUs (with latest drivers). I have a somewhat older Mac Pro with 2 GTX 980ti's. Bakery is at the top menubar but the screen does not appear.
     
  10. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Hmm what do you mean? You can bake sky occlusion.

    These are harmless.

    Seems more like a post-processing stack bug, than a Bakery bug. Maybe try these suggestions:
    https://www.reddit.com/r/Unity3D/comments/90md1i/package_manager_dissapeared_after_upgrading_the/
     
  11. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    183
    Done, sent you a PM
     
    guycalledfrank likes this.
  12. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    Yes! Upgrading to 1.45 + bumping up samples a bit more worked like a charm and the white splotches are gone, thanks.

    About this, I have a bit more of info:
    1 - Not only occasionally a channel is skipped inside the lightmaps (sometimes red is missing, sometimes green, sometimes both) but every so often they become entirely black (all channels missing?). The funny thing is that the directional maps (Dominant Direction mode) are baked correctly:
    emptylightmaps.PNG

    2- It only seems to happen when I double the Texels Per Unit for that scene for a final rendering (outputs 15 lightmaps with its 15 directional maps). In minor tests (4 lightmaps), they seem to be baked fine. I guess I could live with half the lightmap resolution for now :) Any ideas though?

    Edit: what is that "halffloat2hdr" item which interacts with each lightmap at the end of the bake, maybe it is related to that?
     
    Last edited: Nov 15, 2018
    guycalledfrank likes this.
  13. Cre8ing

    Cre8ing

    Joined:
    Jun 2, 2018
    Posts:
    5
    guycalledfrank likes this.
  14. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    It can possibly happen because of video memory limits. However, all lightmaps are baked in isolation except GI. Can you check if the problem persists with bounces=0?

    It just converts final lightmaps into .hdr format for Unity. Bakery itself operates LZ4-packed DDS files (because they're just tiny header + raw pixel data).
     
    JohnLabern likes this.
  15. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    Dang, I have 8 gb dedicated + 8 shared. The scene is intense but I don't know if that much.

    Just did the test with 0 bounces and baked fine, d'oh.
    5345345.PNG
    I'm retrying again with full bounces, maybe it has miraculously fixed itself. :p
     
    guycalledfrank likes this.
  16. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    In that case, can you try setting GI VRAM optimization = Force On?
     
  17. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    New baking with 5 bounces gave black lightmaps but good directionals again. I've keep track in task manager of GPU memory used and never went above 6GB. (normally kept between 2-4 GB range).

    I have it always forced on in these cases of demanding scenes.
     
  18. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    In this case... did you try it with OFF before?
     
    JohnLabern likes this.
  19. JohnLabern

    JohnLabern

    Joined:
    Nov 13, 2017
    Posts:
    75
    I'll run a test this night to check. :)
     
    guycalledfrank likes this.
  20. samdpt

    samdpt

    Joined:
    Oct 1, 2018
    Posts:
    14
    Hey @guycalledfrank ! I'm trying to light my scene using an HDR as my SkyLight, but getting some noisy and nasty areas usually where there is the most direct lighting - usually little scattered spots as in screenshot. Using a 4K HDR from HDRI Haven.

    The scene is just being lit using a Skylight currently. What might I do to smoothen out the results of the Skylight bake?
     

    Attached Files:

  21. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    That's the problem. Extremely high resolution HDRIs need insane amount of samples to get right. Affects all ray tracers, not just Bakery. Instead of using a 4K map, I recommend downsampling it to something around 256x256. The diffuse lighting difference will be negligible, but you won't get bright fireflies, and it'll be fast.
     
  22. samdpt

    samdpt

    Joined:
    Oct 1, 2018
    Posts:
    14
    Ahh that makes a lot of sense! Thanks Frank my man!
     
    guycalledfrank likes this.
  23. Ruonan

    Ruonan

    Joined:
    Dec 6, 2012
    Posts:
    41
    Hey frank, after updating to 1.45. Denoise get the same old problem. Do I have to use the old patch you send me?
     
  24. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Which one? Was it the blue screen? 1.45 should have the fix I sent to you before.
     
  25. JohanL

    JohanL

    Joined:
    Apr 15, 2013
    Posts:
    12
    I'm getting alot of ArgumentOutOfRangeException: Argument is out of Range after 1.45.

    upload_2018-11-16_12-10-36.png
     
    guycalledfrank likes this.
  26. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
  27. JohanL

    JohanL

    Joined:
    Apr 15, 2013
    Posts:
    12
    Seems to be working fine now, cheers! :D
     
    guycalledfrank likes this.
  28. JohanL

    JohanL

    Joined:
    Apr 15, 2013
    Posts:
    12
    Now I'm getting this error instead, on another scene:
    upload_2018-11-16_16-44-1.png
     
    guycalledfrank likes this.
  29. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
  30. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    183
    So here's a question
    My team and I use git, and have separate branches for different things. Let's say someone does work on branch A, and someone else does work on branch B. When we merge, this will mean that the ftGlobal / ftLocal storage assets conflict, and they can't be merged. What happens, will this break things?
     
  31. Frank-1999-98K

    Frank-1999-98K

    Joined:
    Jun 30, 2015
    Posts:
    13
    Hey,
    I'm really interested in your asset but I have a question about "Doesn't support AMD cards for baking".
    I don't know if, by AMD 'cards', you mean the GPU, the MB, or what..

    This is what I use:
    CPU: AMD Ryzen 7
    MB: MSI X370 Gaming Pro Carbon
    GPU: Asus GeForce STRIX-GTX1080
    OS: Windows 10

    Can I use this asset?

    Diego
     
  32. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    208
    OF course you can, you have a GTX 1080 and it will work smoothly, CPU is not important here cause Bakery utilizes GPU so cpu almost stay idle.
     
    guycalledfrank likes this.
  33. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    If you have at least Unity 2017.1 and Bakery 1.45, you don't even need to commit these assets anymore. The data is now stored in Unity's meta files that should merge well.

    Oh, just the GPU :) And since you have GTX1080, you can use Bakery.
     
  34. Frank-1999-98K

    Frank-1999-98K

    Joined:
    Jun 30, 2015
    Posts:
    13
    Thank you kindly, I just wanted to make sure I wasn't buying something that I couldn't use..
    Really promising asset, though. I really can't wait to test it out myself!
     
    lolclol and guycalledfrank like this.
  35. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    111
    I do not think so. I can't even move the cursor during baking on i5. It's utilize cpu and hard drive very well while read/write operations.
     
  36. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    653
    Hi, I just downloaded Bakery and imported the package. I got:

    Shader error in 'Bakery/Standard': 'FragmentSetup': cannot convert from 'half4[3]' to 'float4[3]' at Assets/Bakery/shader/Bakery.cginc(614) (on d3d11)

    Unity version 5.6.6f2
     
    guycalledfrank likes this.
  37. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    It doesn't utilize CPU much. You can't move the mouse because GPU can't bake and redraw Windows at the same time. If you try running some CPU-intensive task while baking (e.g. compress files), it should run fine.
    Hard drive is used in bursts, only between different passes.

    Well that's surprising. There are differences between data types Unity expects in shader macros, and Bakery shader checks some conditions to make sure it works everywhere. I tested it on 5.6.0 (using it all the time), multiple 2017 and 2018 versions, but it appears 5.6.6 might be doing something differently.

    Can you try opening Bakery.cginc and replacing all occurrences of

    #if UNITY_VERSION >= 201740


    with

    #if 1


    ?
     
    lolclol likes this.
  38. liudian208

    liudian208

    Joined:
    Aug 30, 2018
    Posts:
    59
    I'm thinking using just one shadow mask, and combine the shadow mask into the alpha channel of color lightmap. Is it possible? Will it affect displaying a lot?
     
  39. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    That's not as easy as it sounds, because Unity doesn't use simple RGBA formats for lightmaps, and for a good reason. Lightmaps are supposed to store HDR data, not just 0-255 color. As far as I know, these are the formats Unity uses on different platforms:
    - High-end (desktop): BC6H - compressed HDR color, no alpha channel.
    - DX9 and decent mobiles: RGBM, compressed as DXT5 or something similar. Here alpha channel is used as color multiplier to decode full HDR data.
    - Very low end: "double LDR", or basically RGB*2 like in early 2000 games. This is only useful on old/cheap devices with very limited support for compressed formats. E.g. Android devices with only ETC1 format avaliable - this one can barely compress RGB and doesn't have an alpha channel.

    You can use an uncompressed RGBA format (RGBA16F on high end or RGBA8 for double LDR), but then you'll just waste memory. Separating color and mask to different textures actually saves VRAM in this case.
     
    Last edited: Nov 19, 2018
  40. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    653
    This fixes it, thanks!
     
    guycalledfrank likes this.
  41. Thomas-Pasieka

    Thomas-Pasieka

    Moderator

    Joined:
    Sep 19, 2005
    Posts:
    2,118
    @guycalledfrank Hey there mate. Quick question. Does Bakery create lightmaps that are useful outside of Unity? Meaning, could I export/copy the lightmaps to be used elsewhere?
     
  42. rrahim

    rrahim

    Joined:
    Nov 30, 2015
    Posts:
    189
    Hi, the asset looks awesome. One quick question.
    I hoped to find an answer in the forums but; would this work with a Quadro card?
    Specifically I'm using the Quadro K4100M

    I do have a GTX780 on my desktop, but I was wondering whether I could use it on my laptop.
     
  43. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Hi! Yes, you absolutely can. Just use Lightmap Groups (check the docs) with the "Original UV" mode to force Bakery use existing UVs with no atlas packing. Then you will just get .hdr texture files you can use anywhere else.

    Seems to be Kepler-based, so should work just fine.
     
    rrahim and Thomas-Pasieka like this.
  44. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    890
    Hi there!
    I just bought Bakery and I have been playing with it for hours now.
    Overall it's excellent, but I have a problem with Light Probes being darker than they should.
    I'm using only a grey sky light with an intensity of 128 to illuminate everything with a diffuse light.
    The scene bakes perfectly, but the light probes for dynamic objects are darker:
    The same sphere looks much brighter when backed than when using light probes.
    (same shader, same everything)
    This is a problem because light probes doesn't match overall lighting.
    Any thoughts?
     
    Last edited: Nov 19, 2018
    guycalledfrank likes this.
  45. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Light probes currently gather sky lighting from the scene, not the Skylight component. That means your visible skybox should match the Skylight in brightness and color. This is going to be improved, but currently you have to make sure they match. If you have e.g. default Unity procedural skybox set, then light probes will see it instead of Skylight.
     
  46. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    890
    Ok, Thanks!
    I was testing this right now.
    The problem seems to be that when I click on "Match this light to scene skybox", it doesn't actually match it's intensity correctly, so I have to manually boost it. I suppose that's why I'm having problems to match the lightprobes with the baking.

    PS: I have incremented the intensity multiplier of unity's environment lighting to 1,75 (maybe that's why it doesn't match?)
     
  47. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Hmm... what kind of material are you using for scene skybox? Also, are you using Gamma or Linear color space?
     
  48. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    890
    I have been trying to adjust that, but it's not possible: the calculated sky light intensity is way darker than with Unity's Enlighten or Progressive.
    I can match the perceived luminosity by multiplying bakery's sky light intensity x10, but even then, when I calculate the light probes, they are way darker than they should.

    I'm on linear color space.
    The Skybox is the regular cubemap skybox material with an HDR cubemap and the default parameters. (grey color, exposure 1)
    The only parameter that's not by default is the Environment Lighting Intensity Multiplier at 1,75
     
    guycalledfrank likes this.
  49. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    890
    I will try to make you a repro project.
    I really want bakery to work! :)
     
    guycalledfrank likes this.
  50. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,344
    Just in case, try Skybox/Bakery skybox material. It's the most straightforward shader you can imagine, and the "exposure" value is just a linear multiplier. I recall default Unity shaders had some peculiar non-linear response, and even though I think I adapted the "match" button for it, it's still a good idea to do a ground truth check by using Bakery skybox.
     
unityunity