Baking lights issues

Hi, i have a lot of issues and questions about baking lights on windows.

Starting by, is it normal to have a baking light process that takes more than 24h for a 60x60 terrain with a couple hundred trees and not much else, 1 directionnal light as “baked” and 1 light point with a range of 25 ?

  1. Is it normal to have the previous step blocked at 5% : preparing bake ?
  2. Is it normal to when Unity is in the background, the amount keep flashing between 5%, 96% and 99% with estimate times that goes with all kind of numbers ?
  3. What can help reducing the baking time without taking out static of the whole scene’s environment ?
  4. Why do neither my cpu, memory nor GPU seems affected by starting a baking process ?

My perks :

  • CPU Intel(R) Core™ i7-10700 CPU @ 2.90GHz overclocked at 4.4GHz
  • GPU NVIDIA GeForce GTX 1650 Ti
  • RAM 16 GB 2933MHz SODIMM

That behavior and those baking times sound abnormal to me, quite possibly a bug. We’ve made many improvements to the baker since 2021 LTS. Might be worth upgrading your project to see if there is any improvement. Either way, you can submit a bug report with your project attached if this is blocking you.

That said, bake times will depend heavily on your lighting settings, and especially these ones, all changeable via the Lighting Window (Window > Rendering > Lighting):

  • Direct samples
  • Indirect samples
  • Environment samples
  • Lightmap resolution
  • Light probe sample multiplier (if the scene has light probes)

Also, make sure you have Progressive GPU selected as the Lightmapper, it’s much faster than using the CPU.

The lightmap scale of the terrain is also important, which you set via the terrain inspector

If you want to continue troubleshooting this, I would start by lowering all of these until you are able to get a bake completing in at most a few minutes. If that fails, your scene is probably triggering some pathological case in the baker, and we can continue from there.

Hi, thanks for your response.

However I can’t change version due to dependencies to VR package that are already old and updating will break everything… (sadly it’s the fault of the organization that did not kept the project up to date)

I’ve updated the settings to :

  • Direct sample : 32 => 16
  • Indirect samples : 512 => 256
  • Environment samples : 256 => 128
  • Light probe sample multiplier : 4 => 2
  • Lightmap resolution : 40 => 1
  • Lightmap max size 1024 => 512
  • Indirect intensity 1 => 0.6
  • Lightmap parameters : VeryLowResolution

Terrain :

  • Scale in lightmap : 1 => 0.128
  • Lightmap parameters : VeryLowResolution

I’m using Progressive GPU with the GTX 1650 Ti

The issue is still there…

Alright then. Given that info, the best suggestions I have for you are:

  • Make a new scene with something like a single static cube. Does it bake fast?
  • Check your editor log. Do you see anything suspicious near the end?
  • If you have access to another machine, you could try baking on that, and see if it makes a difference, to isolate whether the issue is the scene or your machine setup.

Regardless, I’d recommend filing a bug report so we can take a look at your scene.

On a almost empty scene :

  • Its fast, almost instantaneous
  • Here is the editor logs : Untitled (km12ovz5) - PasteCode.io
  • I’m not sure what i should be looking for in the logs but i don’t find anything suspicious
  • On other machines its the same

So it’s probably something in your other scene triggering a pathological case in the baker. Hard to say what exactly without access to the scene. You linked the log for baking the simple cube scene, correct? How does it look when baking the other scene?

Some other scenes are more or less fast but almost every scene can bake the light.
The logs are for a scene with a plane, a couple of letters that are animated and move straight and a couple of small and empty objects.

I’ve filled a bug report, its currently uploading

I’m trying by creating a scene and adding everything from the other scene by a small amount each time.

And it seems i found a track, i’ve got objects with LODs, when just adding the terrain as static, the light built correctly, but it seems when i add an object that contain other objects with LOD, the Preparing Bake seems to have an issue.
Do you think it could be due to this ? Is their a way to say to bake the light for the smaller LOD ? (not culled)

Sounds like it could be a LOD related bug, yeah :stuck_out_tongue:

You should be able to configure which LOD levels are lightmapped by setting the Contribute GI and Receive GI settings on individual LOD levels. If you don’t want a LOD level to be considered during baking at all, disable contribute GI. If you want it contribute, but not receive a lightmap, set the receive GI mode to Light Probes.

1 Like

Okay i’ve got more information linked to this :

  • Their are FX stuff that seems to use a custom shader (its from a downloaded asset)
  • When adding this FX to the global illumination I’ve got the bug

Interesting. Is the shader animated by any chance? We had an issue a while back with shaders that are animated causing infinite bakes. Either way, make sure to include the shader in your bug report

Yep it’s animated.

image

Another asset using a custom shader which could be animated too make the error.

I’ve changed the report ti see how we could get this working

Which version of Unity are you on, exactly? Down to the minor version

2021.3.25f1 Personal

Based on what you’ve shown so far, this looks like a known issue to me. If I am right about that, I made a fix a while ago which landed in 2021.3.28f1. Update and it should be fixed :slight_smile:

I will try update but i’m not sure about the other XR issues in my project, i hope it wont break things xD

Hi again, i’ve updated the unity version to 21.3.41f1

Good news it sovle the issue

Bad news I have a new issue, it stays at 99% of “Baking…”

Edit : nevermind it works just is very very slow (an hour per baking)