Search Unity

Bakery - GPU Lightmapper (v1.6) [RELEASED]

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

  1. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    332
    For now Bakery does not benefit from multi gpu.
    So there is no faster bake for now.
    1 GPU is enough till solved.

    What instance type you used exactly?

    All instance types i tried (Linux and Windows ones with Blender Cycles Multi/Single GPU rendering and bake) an initial manual installation of the NVidia driver was needed.

    You also should try SpotInstances when success with your M60.
    They are really cheap. up to 90% less.
    Depending on GPU for 1GPU around 0.20usd/h or 8GPU around 1.50usd/h.

    It s not a safe as on demand because you could get a notification 2min before they need them. But you can freeze the instance before and resume.
     
    Last edited: Sep 3, 2019
    guycalledfrank likes this.
  2. Johnny-Ge

    Johnny-Ge

    Joined:
    Apr 26, 2014
    Posts:
    10
    Hi,
    Any plan for supporting version 2019.3? Cause Im gonna update the project using "Universal RP " that is rename of LWRP, but I tried both of URP and LWRP, fixed the include path error, after baking something is not right. The bake log is well, nothing error. The final image of project after baking is the attachment. I tried 2019.1, that's working with LWRP.

    Appreciate any help~~~ Thx
    -------------------------------------------------------------------------------------------------------------------
    Update:
    The issue is caused by one of bugs in 2019.3f10, which is baking issue in linear space. So after update 2019.b1, version 1.6 is working with Universal RP under my modification.
    Please ignore !!!!!
    Thx anyway.
     

    Attached Files:

    Last edited: Sep 5, 2019
    guycalledfrank likes this.
  3. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    26
    Do you support Area Lights??
     
  4. Brackaterts1

    Brackaterts1

    Joined:
    Jan 13, 2018
    Posts:
    4
    Hello,
    I was trying to find ways to reduce lightmap size. I found that you cannot crunch compress the lightmaps like you can do with other textures. Is there a reason for this?

    Thanks.
     
  5. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,087
    Ouch. The reason might actually be something else. Do you get it every time or still only with large texel sizes? I don't have access to my networked setup this week unfortunately, so it's kinda hard to reproduce.

    Maybe try updating the driver?

    No, but take a look at example_prefabs_bake and example_prefabs_assembled scenes included in v1.6.

    Ah yes, this looks familiar. Try the latest github patch from these branches:
    https://github.com/guycalledfrank/bakery-csharp/tree/more_changes
    https://github.com/guycalledfrank/bakery-compiled/tree/more_changes
    Funnily enough, this could be caused by some warning/notification messages shown before the bake. You can try unchecking some in the Warnings section of the window and see if it helps.

    BTW, it would be really helpful if you could write a little guide on instanced bakes, I'd gladly add it to the wiki :)

    Yes.

    I didn't know that, I guess it is more of a question for Unity devs. The only ways I know are reducing resolution and using regular platform-specific compressed formats. Having good compact UVs made outside of Unity also helps tremendously.
     
  6. Thall33

    Thall33

    Joined:
    Sep 18, 2013
    Posts:
    55
    Our studio is currently looking for a tool to make multi light maps per scene. We have dense VR environments that have multiple states, right now our single state environments/scenes are being baked, so unfortunately we have to use a real time lighting solution for multi state scenes, which is very resource heavy compared to a full baked lighting solution.

    We can bake new sets but Unity automatically reorganized the uv atlas if we re-bake (obviously to optimize full use of light maps)

    Can you offer some advice or a solution so we can create a full light map atlas that's locked so we can bake different light maps for the whole scene?
     
  7. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,087
    Do you need multiple lightmaps that are pre-unwrapped outside of Unity? If so, sure, you can do that, take a look at Lightmap Groups, particularly Original UV mode: https://geom.io/bakery/wiki/index.php?title=Manual#Bakery_Lightmap_Group_Selector
     
  8. kouglov

    kouglov

    Joined:
    Mar 12, 2018
    Posts:
    4
    Hi, just bought the Bakery yesterday, very happy with it !
    Astonoshing performances, great control over many options.
    Been struggling with buil-in Unity lightmappers for weeks, now it's just a bad memory :)

    I have just one question regarding Gamma and Linear.
    When I imported Bakery, I was in Gamma space. I'm conducting some lightning and performance tests to developp on the Oculus Quest (stand-alone VR).
    I managed to make a render test on my machine, wich achieved this look.
    It gave me that : https://imgur.com/a/AVxxM3S
    (Just ignore the posts effects, it was just for the screenshot)

    After that, I saw the message on the Bakery window recommending to switch to Linear.
    Clicked the button, and left my computer reimport 12 Gb of assets during the night.
    In the morning, I discovered this : https://imgur.com/a/qfAdLYA
    (screenshot from the editor, in-game view show the same colors)

    I'm clearly not a specialist of color and Linear or Gamma space, and I would like to understand what is going on here, as it seems strange and funny.
    Should I revert back to Gamma ?
    What can cause this red ambiance ?
    I only have a few lights in the scene, two of them are orange mesh lights (light bulbs in the grey floor lamp on the right)

    thanks in advance for your time.
     
  9. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,087
  10. dylanjameswalch

    dylanjameswalch

    Joined:
    Jun 20, 2018
    Posts:
    12
    Hello,
    I am confused by why some of my scenes only require 1 lightmap while others generate 15+ lightmaps. The bakery settings are the same on both of the scenes? Is there anything I can do to maintain a low number of lightmaps?
    Thank you for your help!
     
  11. kouglov

    kouglov

    Joined:
    Mar 12, 2018
    Posts:
    4
    Oh god yes, that's the same :D

    haha, glad I'm not the only one with this !
    Well, roll back to Gamma for dev until Unity fix this I guess !

    Thanks a lot for your really quick answer !
    My shame not reading the last page, I searched the thread for "Linear" and "Color" but did not saw this message !
     
    guycalledfrank likes this.
  12. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    26
    Just ran my first experiment with Bakery on a large environment.
    So it appears all lights require a Bakery script, correct?
    I see scripts for Direct and Point lights but what script goes onto Area Lights.
    Thank you.
     
  13. Juanola_

    Juanola_

    Joined:
    Sep 29, 2015
    Posts:
    7
    Hello!
    I ve been using Bakery some time with great result. None the less, Im no being able to make it work with git.

    When I put the project through Git, the baked lightmaps reference dont go through. On the one side, I get this reference:

    upload_2019-9-5_16-43-29.png

    When I pull, I dont get any reference:

    upload_2019-9-5_16-52-14.png

    I used the debug script that was posted before. In the information, I see that the maps reference on the pull side are not there.
    upload_2019-9-5_16-55-0.png

    I have added to gitignore both the bakery folder and the editor/x64/bakery folder.

    I am missing something??

    I m using Unity 2019.1.14f

    Thanks!
     
  14. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    332
    You requested some instanced bake tips.
    Here an draft buisness case for an Bakery AWS service.)

    For now it is not efficient to use an AWS for Unity Bakery because you could not split bake jobs per compute device like i requested after my little benchmark nor multi gpu.

    So when this will be finally possible i will do an animated wiki for you.)

    For now here some stuff i tested in Blender on Linux and Windows in holiday time some years ago to learn AWS stuff.
    There are much better instances available now.

    An 8 GPU Spot Instance is around 1.50 dollar/h.

    K-80 drivers need to be installed for a P2 instance.

    p2_setup_instance.sh
    Code (CSharp):
    1. sudo yum update -y
    2. # load the latest kernel version, really dont skip this
    3. sudo reboot
    4.  
    5. # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/accelerated-computing-instances.html#install-nvidia-driver
    6. sudo yum install -y gcc kernel-devel-`uname -r`
    7.  
    8. wget http://us.download.nvidia.com/XFree86/Linux-x86_64/375.66/NVIDIA-Linux-x86_64-375.66.run
    9. sudo /bin/bash ./NVIDIA-Linux-x86_64-375.66.run
    10.  
    11. # load the kernel update
    12. sudo reboot
    13.  
    14. # configure the GPU settings to be persistent
    15. sudo nvidia-smi -pm 1
    16. # disable the autoboost feature for all GPUs on the instance
    17. sudo nvidia-smi --auto-boost-default=0
    18. # set all GPU clock speeds to their maximum frequency
    19. sudo nvidia-smi -ac 2505,875

    Install Blender. It s free.

    allowBlendering.sh
    Code (CSharp):
    1. sudo yum -y install freetype freetype-devel libpng-devel
    2. sudo yum -y install mesa-libGLU-devel
    3. sudo yum -y install libX11-devel mesa-libGL-devel perl-Time-HiRes
    4.  
    5. # Insert any url for Linux 64 bit blender
    6. # https://builder.blender.org/download/
    7. wget 'https://builder.blender.org/download/blender-2.79.tar.bz2
    Simple example to bake this SplitJob on one GPU (CUDA_0)on MultiGPU P2 EC2 AWS instance:

    config.py
    Code (CSharp):
    1.  
    2. import bpy
    3. # https://blender.stackexchange.com/questions/5281/blender-sets-compute-device-cuda-but-doesnt-use-it-for-actual-render-on-ec2
    4. bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
    5. bpy.context.user_preferences.system.compute_device = 'CUDA_0'
    6. bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = True
    7.  
    8. bpy.context.scene.cycles.device = 'GPU'
    9.  
    10.  # Like pressing the 'Bake' button in Blender
    11.  # this will remain locked until the bake is complete.
    12.  bpy.ops.object.bake(type='COMBINED')
    13.  
    14.  # You might want to inspect the materials and extract images
    15.  
    16.  # save-as by setting the target path and saving
    17.  image.file_format = 'EXR'
    18.  image.filepath_raw = "//my_new_bake.exr"
    19.  image.save()
    20.  
    For bake on all available 8 or 16 GPU at once with Blender Cycles simple use this.

    Code (CSharp):
    1. bpy.context.user_preferences.system.compute_device = 'CUDA_MULTI_2'
    This is little slower than bake on 8x or 16x jobs splitted per compute device. cuda_0 to cuda_8.

    Windows works the same but was more hassle.

    bake.sh
    Code (CSharp):
    1. BLEND="/tmp/cheap_fast_bake.blend"
    2. /home/ec2-user/blender --background "$BLEND" \
    3.     --use-extension 1 \
    4.     -noaudio -nojoystick \
    5.     -E CYCLES -t 0 \
    6.     -P "config.py"
    Another great example that the split of the bake load to compute devices in an MultiGPU System rocks.
    Just do it.)

    You can do pretty crazy calculations.
    The prize for one of the used GPU is 3000USD to 5000 USD.
    You buy 8 for 40 000 USD.

    For 40 000USD you can bake 26666h on 8GPU s on AWS.)
    And you have not to pay the power consumption.
    Could be enough for your game.

    On demand instances are around 10x more expensive as Spot Instances. However. Still fair pricing.

    Little spoiler.
    Optix is already integrated for Cycles Rendering. 2.81
    OIDN is already integrated. 2.81
    Cycles Optix bake is finished soon.
    Simple change for around 50% speedup

    Code (CSharp):
    1. #.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
    2. .context.user_preferences.addons['cycles'].preferences.compute_device_type = 'OPTIX'
    3.  
     
    Last edited: Sep 5, 2019
    guycalledfrank likes this.
  15. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    26
    Please disregard my earlier question about Area Lights and scripts to use.
    Duh ... read the documentation ... some lessons you can't learn often enough.
    Regards ...
     
    guycalledfrank likes this.
  16. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    48
    Weird... I took a computer to work and the bug (losing server connection on upload) is here at home but not at work. At work it would connect but return very strange results at higher Texels. ( I was using X-Atlas at work sadly and changed back to default at home I should have not changed at home that maybe an issue I need to investigate.)

    4 texel work = 4_texel.jpg

    8 texel work:
    8_texel.jpg

    12 texel work:
    12_texel.jpg

    20 texel work:
    20_texel.jpg

    At home all fails above 4 texesl "loses connection to server on upload"

    I am confused and I have been a programmer all my life. Maybe I can get some time soon to dive into what you have. Any ideas where to start would be good. There is quite a bit of unknown code.
    (used to be AAA graphics programmer on a god awfully huge Unreal engine. So I maybe able to dig in if I ever get time... pretty crazy busy these days. )

    The texels do decide the error so possibly a data overload to the sockets and maybe an issue between home router and office router. I also wonder if the debug spam in the console might delay socket transactions, no idea just guessing right now. Just tested a 4 texel and it worked at home yet the 8 texel did not. "lost server connection."

    So far I have tried Wifi and wired with no difference at home.

    Anyway Ideas would be great. This is a heck of a tool where I can work while the computationally expensive operations are unloaded. AWESOME!

    Again thanks for the product I am sure you have poured a TON of effort into this. Me and Jon Olick produced the first Unreal in game engine light mapper way back when. I think my favorite part was referencing alpha maps with the ray casting. O the days....Thanks for any information.
     
    guycalledfrank likes this.
  17. Thall33

    Thall33

    Joined:
    Sep 18, 2013
    Posts:
    55
    Not really. I just want to create a initial light map atlas with everything (all static meshes) turned on, then bake multiple light maps for the different states when certain objects are turned off so the full bake doesn't have shadows, ago and GI from the objects that are turned off.

    Also thanks for your quick reply, really appreciated!
     
  18. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    26
    I am baking a large scene.
    The first couple of times I did it I averaged around 30 minutes at the default settings.
    Awesome as Enlighten takes 1 hour average for this.

    But it has gotten progressively slower and slower since.
    I am up to about an hour now and I noticed that there were over 10K files in the sub dir I am writing to.
    That I really didn't like and cleaned it all out including the plugin from my project.
    Shut down, rebooted, re-loaded the plugin and started all over.

    The time to bake still has not improved.
    Right now I am at just 9% and into it for an hour.
    I should add I have almost all Area Lights in this scene, with a few Point Lights.
    I put the BakeryLIghtMesh script on each of the Area Lights.
    And the BakeryPointLight script on the Point Lights.

    I am running 64 GB of RAM, on a NVIDIA GTX 1080, Win10

    Obviously I have something goofed up.
    Anything obvious to the enlightened I should take a look at in the settings?
     
  19. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    163
    Hey @guycalledfrank , we've run into an issue on 2019.2 that I'd love your help with

    So we are using a system where we use Point Lights and Bakery Point Lights at the same time - the point lights are used to illuminate certain objects that aren't baked on a few layers whereas the baked lights are obviously for our lightmaps

    However, we've noticed an issue where the lights are being set to a Lightmap Bake Mode - Lightmap Bake Type of baked where we'd prefer that to be set to Mixed. This is only visible when looking at the editor in debug mode, so it stumped us for a while (all of our non baked items weren't lit until we duplicated the game object which created one with the bake type set to realtime / mixed

    Not sure if its just a setting we can change? Thanks for your assistance!

    upload_2019-9-7_12-10-0.png
     
  20. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,087
    Similar to built-in Unity lightmappers, Bakery tries to pack all scene objects into lightmap atlases based on their surface area. If one atlas cannot fit more objects with the required texel size per unit, another is allocated. On top of that, there is a limitation preventing objects from multiple LOD levels to be in the same atlas. You can lower lightmap count by either reducing texels per unit/scale in lightmap and/or increasing max lightmap size.

    Make sure you are committing:
    - the scene file
    - the lightmaps
    - all modified *.meta files (Unity refetences assets by their id stored in meta, not their name)

    Odd! How complex the scene should be to cause this behaviour apart of the resolution? It would be ideal if you could reproduce it on a minimal scene and, after getting the bug, send me both the unitypackage of the scene and contents of the temp folder (by default server writes it to Users/Your username/AppData/Local/Temp/ftServer), only files modified during the bake (you can sort them by date or clear the folder before baking).
    If it works locally but becomes this over the network, my best bet is incomplete file writes, and comparing real scene data vs what's written in the temp folder will give us the answer or at least way more clues.

    Respect! :)

    Thanks heavens modern GPUs have bindless textures! Made it a lot more straightforward than I anticipated :D

    Got it. I still suggest unwrapping the scene in advance using any modeling package, making sure lightmap UVs will stay the same in all states. Then bake each state one by one.

    Very puzzling. Did it get slower without you changing anything at all and stayed this way after a reboot? Either you actually did change the scene or settings or it's a hardware problem (or... wild guess, some kind of power saving stategy enabled in BIOS or drivers?...)

    Hint: if you have really large area lights, you should be able to replace them with simple emissive materials without any quality loss, and it will be faster. Light Meshes are good for small bright sources.

    Hmmm... indeed, lights with complete direct+indirect contribution are marked as baked. Perhaps the "correct" solution would be to have 2 separate lights. You can also just hack ftLightmaps.cs script which actually sets this mode thing on the light every time the scene is loaded.
     
  21. GR_3D

    GR_3D

    Joined:
    Apr 3, 2018
    Posts:
    2
    Hello all!

    I having a pretty perplexing issue with subtractive lighting using bakery. Currently everything works great save for shadows and light not getting cast between two dynamic objects, self shading not tested but I suspect it wouldn't work either way. Currently I have test scene with some boxes a couple baked spot lights and a direct light. I have tried it out on subtractive, shadowmask and unity progressive cpu subtractive.

    Bakery Subtractive (notice that the spheres don't cast shadows or receive lighting on each other.)
    Subtractive_NoShadoworLight_on_spheres.PNG

    Bakery Shadowmask
    Shadowmasking_No issues..PNG

    Unity Native Subtractive
    UnityNativeSubtractive_BothShadoworLight_on_spheres.PNG

    Does anyone know whats going on here? Is there anything I should be turning on to get dynamic shadows on my dynamic objects?

    Edit: One thing I forgot to clarify is that the spheres cast dynamic shadows on static objects, just not each other or on other dynamic object.
     
    Last edited: Sep 9, 2019
  22. Zoidberg656

    Zoidberg656

    Joined:
    Sep 26, 2018
    Posts:
    8
    dasdasd.PNG dsadsa.PNG
    Using RNM direction mode. After Uploading my world to VRChat, I noticed a constant specular when I looked at shiny surfaces. I disabled EVERYTHING in my Unity scene except for the house, but the specular remained in the middle of my view.

    I have no idea why this is here or how to remove it.
     
  23. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    77
    Hey! long time not asking something haha.

    Well, My scenes are using Full lighting mode, and some scenes are lighted completely by Mesh emissive objects and i noticed that Light Probes are not getting all the lighting intensity from the emissive objects, in fact light probes looks even darker than the baked object around them, this resulting in dynamic objects not being lighted properly.

    This could be Bakery related or unity related?

    Picture for reference: The big Sphere is a well mesh sphere, as you can see the light probes are dark even with the high intensity of emission lights.
    upload_2019-9-11_16-14-52.png

    Thanks!

    Working on unity 2019.2.4f01
     
  24. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    28
    My standalone build lose all the baked GI due to static batching, it looks correct in editor for both static batch on and off, but all GI disappear in standalone build, when I turn off static batch it looks correct even standalone build, but I will lose static batching. is there a way to make it work for when static batching is on?

    I am baking in Shadowmask render mode, would other mode work with static batching?
    update* my Bakery point light script is set to Baked contribution indirect only*

    also I am loading my scene using addressable, if that makes a difference.

    Thanks.
     
    Last edited: Sep 12, 2019 at 1:56 AM
  25. ActualStu

    ActualStu

    Joined:
    Jan 21, 2018
    Posts:
    2
    Hi,

    Bought Bakery but it crashes Unity when I try and render a Lightmap every time.

    The scene is just a quickstart test with a cube and a plane, 1 Bakery Skylight and a Directionlight component. Thats it.

    I have a GTX 970 and Unity 2019.2.0f1. Attempting to render produces an error 'Device is not DX11' and then everything crashes.


    EDIT - Unity had defaulted to DirectX 12 - switch it back to 11 fixed the issues :)
     
    Last edited: Sep 12, 2019 at 10:53 AM
    guycalledfrank likes this.
  26. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    48
    Still getting "error sending data to server" dealing with these two snippets.

    SocketException: No connection could be made because the target machine actively refused it.

    I am digging around the source.
    Current thoughts are a overload or timeout.. why its refusing is not understood.

    Firewall is off and no AV software running. Still looking into how this is happened. Made distributed rendering not work and I love it to much to give up!...

    I have tried using Render Light Groups and normal same issue.

    Thanks so much!

    O and I am altering that code a little in there diagnosing the issues.
    This happens with your original great plugin straight install.

    Possibly it is pounding the socket with opens and closes and finds the socket closed due to it being in use? Just guessing. I am no network guru...





    Untitled-1.jpg




    ---- Update: Found something....
    Once I slowed down the transfer manually with just approving each render sequence it worked....
    BUT not sure how to get a delay in the editor without some bad code I do not want to use.
    This is not a Unity Coroutine so I cannot use wait for seconds nor is it a monobehavior but a static method.

    Worked first try I need to do more testing..... Be back later...


    sadasd.jpg


    Update 2---------------------------------------------------------------------

    Welp nothing like a magic number but o well it worked lol

    ftClient.cs:

    for (int i=0; i<serverFileList.Count; i++)
    {
    Thread.Sleep(1000);

    Currently working.. still testing.

    If this works out maybe a spam delay in advanced settings would help. I think I am going to put one in my code base so I can set it in the editor.

    Lots of testing left.


    Lastly I am considering a 700 dollar Geforce RTX 2080 to save me time.
    Anyone have any experience with the RTX rendering?
    I have a 1070 and 1060 I am working with now.


    -- Update the sleep actually fixed it.
    Another option maybe to not open and close the socket so often but I am happy now. =)

    Next multiple computer rendering would be awesome... But I think lighting groups can kind of do that right? Send one to one pc then another to another and just retrieve.
     
    Last edited: Sep 13, 2019 at 12:03 AM
    guycalledfrank likes this.
  27. elamhut

    elamhut

    Joined:
    Sep 13, 2013
    Posts:
    45
    Hey Frank!

    We updated our Unity to 2018.4.5f1 because of PS4 and LTS and it seems that Bakery is not working anymore :/

    Some emissives are not baking and lightmaps are not showing up in the Baked Lightmap scene view. I just saw that Bakery has been tested on Unity up to 2018.2. Any chance we could get an update for the LTS version? Please?
     
  28. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    71
    We are having a lot of trouble loading different Baked scenes and I wonder if anyone at all can help us.
    We have 4 scenes, by different artists that have baked lighting. The scenes look good on each computer. My job is to combine the 4 scenes in one. We use perforce. We are following the instructions for Bakery per the manual:
    We commit:
    • Any updated assets unrelated to Bakery.
    • All updated *.meta files.
    • Lightmap textures.
    We do not commit: (Although at some point they were committed by someone in terms of changes to ftGlobal (and local) AssetStore.asset )
    • Bakery folders.
    If UVs don't look right.....
    Yes, this is exactly what is happening: So we right click affected models and click Reimport... this works great some times in some scenes, but not at all other times. And I am at a loss to what to do.

    So in summary. The artists commit working scenes with bakery lighmaps, I (and others) download the new scenes, we load one at a time. If the scene has broken UVs we reimport the meshes (all of them in fact). Then open another scene and repeat. Note there are no shared meshes between the scenes.

    Why does the import sometimes work and not other times? This can even happen in the same scenes. Load once, import meshes... work great. Have the artist make changes, load again reimport and still broken.

    Please help !!!!

    I noticed that clearing the GI cache removes the lightmap information. WHY?
    Where is the UV information for the lightmaps stored? If I clear the cache how do I restore the lightmaps?
     
  29. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,087
    Weird. In fact in looks like spheres are fully probe-lit. Which Unity version are you using? Settings like this are only partially exposed in engine API so I could miss something, but it gets better in >= 2017.4.
    It actually seems to work properly in my example_subtractive scene in 2017.4:

    upload_2019-9-14_11-36-55.png

    Does this scene work correctly for you? If so, can you see if there is some difference in settings?

    Are you using Bakery shaders with "Enable Lightmap Specular"? It will indeed create a single specular highlight with direction approximated from RNM components. Unlike Dominant Direction or SH, direction vector derived from RNM is less precise and may appear almost "camera-facing" (but not exactly). Lightmap specular is mostly useful for more rough surfaces. For mirror-like materials your best bet is a reflection probe.

    It depends on the light probe mode (switchable in experimental settings). Default (aka "Legacy") mode works by only using lightmapper to calculate direct and point lights, while emission/GI comes from rendering an in-engine cubemap from the position of each probe. If your engine shaders use dimmer values then this is what you'll get captured in the probes.
    When setting probe mode to "L1", everything will be calculated inside the lightmapper, hence emission response will match exactly. The downside of the L1 mode is that it produces less SH coefficients (4 instead of 9), so lighting may look a bit softer.
    Basically you can either make sure your engine shaders output correct brightness to the screen or use L1.

    All scenes I tested worked fine with static batching. I didn't know about addressables, when did they add that? :D Perhaps they are the problem indeed. Check if it works with a "classic" scene loading method.

    Wow. Thanks for testing! Weird stuff. Since it's TCP, no packets should be missed, so indeed it sounds a bit like there is some sort of a spam limit. Do you really need 1 second though? Does it fail with e.g. 100 ms?

    It is possible to distribute lights over multiple PCs, but it's trickier with GI, as each PC will have to propagate the results to other PCs after each bounce.

    Hopefully answered you on Twitter


    Are all scenes made in the same version of Unity? It seems like you're doing everything correctly. I'm not really sure what went wrong, but I heard a few other mysterious mismatched-UV reports over the year. When extensively syncing multiple machines together, your best friend is pre-made UV layout. Unwrap everything in a large atlas in e.g. Max/Maya/Blender (use automatic packing, you don't have to do it by hand), use "original UV" mode, disable UV padding adjustments. This works rock solid and gives you the best use of your lightmaps. If you don't want to do this, just disable "Adjust UV padding" everywhere, clear asset meta for previously adjusted models, rebake.

    How do you "clear GI cache"? Which information goes missing?
     
  30. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    48
    Wow. Thanks for testing! Weird stuff. Since it's TCP, no packets should be missed, so indeed it sounds a bit like there is some sort of a spam limit. Do you really need 1 second though? Does it fail with e.g. 100 ms?

    I brought it down to 500 and that was enough for me I could test lower later. It works now thanks!

    100 ms works also.
     
    Last edited: Sep 14, 2019 at 8:40 PM
    guycalledfrank likes this.
  31. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    332
    fyi. someone already checked this out?

    ...
    GI: Added extra verification for Experimental.Lightmapping.SetCustomBakeInputs API to make custom bake easier to use.
    ...
    https://unity3d.com/unity/beta/2019.3.0b1

    and finally
    ...
    "Light Probes from different additively loaded scenes can now be merged, making it easier to handle lighting for large scenes that are broken up into smaller chunks. Using a simple API call after all additive scene loads are done, you can get all currently loaded probes retedrahedralized and used by renderers in the scene."
    ...
    https://blogs.unity3d.com/2019/08/27/unity-2019-3-beta-is-now-available/
     
    Last edited: Sep 14, 2019 at 10:38 PM
    guycalledfrank likes this.
  32. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    332
    I use them since 8 months(in non Bakery scenes for now). Current version became pretty stable and helpful.

    Would be nice when you coulde integrate Adressables.
    in an Bakery test scenario.

    5min test

    Install Adressables from Package Manager.
    Here you can find some useful minimal examples which are regulary updated.

    https://github.com/Unity-Technologies/Addressables-Sample

    most relevant...
    Scenes/Foundation
    • This is the scene you transition to from Bootstrap.
    • "Load *" buttons will open other scenes additively.
    • "Unload *" buttons will unload scenes that have been additively loaded.
    Bake 2 of the as Adressables marked subscenes.

    Hit Build Content (Adressables Window)
    Hit Build
     
    Last edited: Sep 14, 2019 at 11:37 PM
    peeka and guycalledfrank like this.
  33. jrb2122000

    jrb2122000

    Joined:
    Nov 11, 2018
    Posts:
    1
    having an issue with trying to use bakery after my scene accidentally duplicated, I deleted all the duplicate scenes but im still having this errer
     

    Attached Files:

  34. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    71
    Where are the UV's created by Bakery stored? What file?
    Why does reimporting the meshes work (when it works)? What is happening exactly?
     
  35. Brackaterts1

    Brackaterts1

    Joined:
    Jan 13, 2018
    Posts:
    4
    I have tried using the prefab component and it is not working. Am I missing something....? I have two scenes I am trying to combine and cannot bake them together because I run out of video memory. Using Unity 2017.4.28f.

    1. I group everything from one scene into a gameobject

    2. I make it a prefab

    3. Add Bakery Lightmapped Prefab to parent

    4. Add FT Lightmaps Storage script inside gameobject

    5. Bake light

    6. Click "Save current render settings to prefab"

    7. I drag prefab into the other scene which already has everything baked

    8. Prefab has no lighting data baked into it

    Am I doing something in the wrong order? I have tried debugging by doing a very simple scene and small house but it didn't work. I have a large city and a high detailed building inside of it. The building is baked at much higher textiles than the environment. I cannot bake the city and building together at their set textiles. I originally tried adding the city and using the Render Selected Groups option cause I thought that would only bake the light for the city with the script attached to it.. but it actually created many artifacts for the high detailed building lightmaps for some reason.
     
  36. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,087
    Try clicking Bakery->Clear baked data multiple times, until the error is gone.

    Here is the way it works:

    - "Adjust UV padding" is enabled and you hit Render.
    - Bakeable objects from open scenes are gathered and packed into lightmap atlases. They are packed as rectangles with their size dependent on (surface area * texels per unit).

    == Next steps are only performed for models with "Generate lightmap UV" checkbox on. No extra steps are taken for models with custom UVs ==

    - Given the final pixel size of each rectangle an optimal UV padding value is found for each mesh (3 pixels in atlas space). If the original UV layout of the mesh has smaller padding, charts will leak over each other. If it's larger, there will be wasted space.
    - This optimal value is then written to model *.meta files as additional data. Note that it only works well on Unity >= 2017.1, on older version the same data is stored in ftGlobalStorage.asset.
    - If this new value differs from the older one, the model is reimported.
    - During reimport, ftModelPostprocessor.cs is called. It checks asset meta (or ftGlobalStorage) for Bakery padding data. If it's found, it calls Unwrapping.GenerateSecondaryUVSet using stored padding for each mesh inside the model (or xatlas, depending on settings). Note that Unity does not allow modifying meshes coming from model assets directly, therefore currently the only way to apply any changes is reimport + asset postprocessor.

    Therefore "Bakery UVs" are not stored anywhere. Only unwrapper instructions are stored, and UVs are recalculated for the assets on each machine during model import. Reimporting may help in case model import happened before ftModelPostprocessor.cs was compiled and used by Unity (I guess).

    So is the component not working or you run out of memory? These are two different problems. If you run out of memory... bake smaller/less lightmaps?

    You don't have to do it. Prefab will automatically add what is needed.

    This will just save render settings (texels per unit, bounce count, etc). This is just for convenience to transfer settings between scenes. It doesn't save lightmap data anywhere (it should be auto-saved after the bake anyway).

    Are there any errors/warnings when you click Render? Any popup windows saying something? Anything written in the Lightmapped Prefab component UI?

    Bakery v1.6 comes with example scenes regarding prefabs. Do they work correctly for you? (example_prefabs_bake, example_prefabs_assembled)
     
  37. Brackaterts1

    Brackaterts1

    Joined:
    Jan 13, 2018
    Posts:
    4
    Okay I think I've narrowed down the issue. My prefab is not creating the FT lightmap storage script. Do I have the setup the prefab a certain way hierarchy wise for this to be generated? Should it generate after baking the lights? I have looked at the 1.6 scene and they work fine. Dragging the example prefab contains baked lightmaps.. I cannot seem to make it work myself however.

    I even took example_prefab_corner, dragged it onto a scene, removed the lightmap script and prefab component and cleaned it up. Assigned a new prefab component to the parent object of the prefab and no script was generated after baking light. Maybe there is a setting in the render tab? A video would be very helpful to eliminate me being dumb or something not working.
    Also dragging prefab onto new scene does not generate it. I am going crazy.
     
    Last edited: Sep 17, 2019 at 12:07 AM
  38. HenriSweco

    HenriSweco

    Joined:
    Aug 8, 2016
    Posts:
    27
    Thank you bansheesoft. I was running into the same issue. Larger models would stop at the socket connection error. That one line fixed it. Although 100ms was too low for me. Successfully baking at 1000ms right now, but I will try lowering it for further tests.
     
    guycalledfrank likes this.
  39. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    28
    Right now I fall back to use indirect baking, which works with addressable scene. would be nice to have shadowmask support for addressable scene though.
     
  40. guycalledfrank

    guycalledfrank

    Joined:
    May 13, 2013
    Posts:
    1,087
    Make sure:
    - There are no script compilation errors in the project.
    - Prefab component UI does not show any errors.
    - You have "Lightmapped prefab validation" checkbox enabled in the main window.
    - After you click Render you don't get any warning dialog boxes about the prefabs.

    upload_2019-9-17_10-28-49.png

    upload_2019-9-17_10-30-4.png

    upload_2019-9-17_10-33-11.png

    upload_2019-9-17_10-32-34.png
     
  41. SteenPetersen

    SteenPetersen

    Joined:
    Mar 13, 2016
    Posts:
    22
    I am trying to make a simple light map using Bakery for VR experiences. I am using 30 Texels perunit, 5 bounces and 60 samples. Along with Bicubic interpolation for lightmaps AND multiplication for shdowmasks and I am still getting shadow leakage.

    Am I missing something? I have attached an temporary image to show the problem.

     
  42. GR_3D

    GR_3D

    Joined:
    Apr 3, 2018
    Posts:
    2
    I'll give it a shot. However please note we are using 2019.1. IS there any major differences when using 2019.1 vs 2017.4 with bakery?
     
  43. unity_cKYah4HC0V_66A

    unity_cKYah4HC0V_66A

    Joined:
    Aug 29, 2019
    Posts:
    1
    Hello! I cant seem to get any emissive to bake into the lightmap. any ideas?
    Works just fine using progressive gpu
    unity 2019.1.7f1