Bake gets stuck every time

Hi :slight_smile: ,

I have been trying to add some basic lighting to my unity scene, but every time I try to bake lightmaps, it gets stuck on ‘Preparing bake’.

Also, the estimated time to complete this stage continuously goes up as I wait - after about 5 minutes of waiting, the time has gone from 10 seconds to 4 hours.

I have reinstalled the recommended unity version, and tried creating an entirely new scene for testing, but the problem still happens and I cannot complete a lightmap.

Any help on this would be appreciated :slight_smile:

Thanks

1 Like

This means:
1.You have used high resolution for lightmapping
2. Your system is low end
3. You have used CPU lighmapper that is 10x slower than GPU

Please tell us your system specification

Hi thanks for replying,

My system spec:
Ryzen 7 5800X
GTX 1650S
16GB DDR4

I also tried lowering the lightmap resolution but this didn’t seem to help.

Baking with the GPU is what seems to crash Unity, it seems after I try GPU baking I cannot bake at all again after that, but I’m not 100% sure this is the issue.

Thanks :slight_smile:

what is your OS?

I am on Windows 64 bit

Have you created lightmaps for your assets?
Has Unity generate lightmaps it or did you create in the 3D app?

On my assets I enabled Generate Lightmap UVs and set the margin method to calculate

This may help in some way, if I load the scene and do a CPU progressive bake, it works fine - but as soon as I try a GPU bake, it never progresses and unity can’t be closed

I had this problem on win 7 and when upgrading to the win 8.1 , it fixed

Interesting , I’ll wait until the next windows version and see if that resolves it

Thanks for your help :slight_smile:

Since nobody’s asked about the thing that affects the performance the most I will:

How big is the stuff you’re lightmapping? PLM is more affected by just how big it is in 3D space. Larger objects especially larger planes or a terrain, will require vastly more conservative profiles than a profile for an indoor section.

This is where your performance is likely dying, so I’ll just ask what exactly are you throwing at it? :slight_smile:

1 Like

I tried baking a very simple scene (just a small model of a gun) which worked perfectly fine when I used progressive CPU , but as soon as I tried the progressive GPU bake , it stops working

Not sure if this is related but unity also doesn’t detect the GPU until the bake has started - I have never had this problem with other software

PinheadRatthew, I am having the same problem myself now. Did you manage to fix your issue? If so then how?

I am using unity version 2021.3.4

Beyond what is normal. (normal is likely pinheads case)

Normal being your level is set up for baking as effectively as you can at that stage
This is related to Hippocoder’s previous comment about the compositions of your objects because of PLM performance and essential knowledge to have when it comes to baking light data.

There are times, with updates, multiple projects, cache data and general looping bugs that can cause the GPU/CPUs to just cycle this bake,

in cases of 0% progression on a bake, this can be related to your GI cache data. (Possibly Extreme gamers case)
GI cache can be deleted if it’s been messed up in some way previously.

A word of warning is that GI cache is shared between projects of the same editor version
clear it only if you know it’s okay to do so.

This brings us to the looping bug: if a 2020.3 project GI bake crashed at some point, it is possible that the cache could affect all 2020.3 projects.

To clear your editor version GI Cache

  • Open a project in the version you want
  • Edit
  • Preferences
  • GI Cache
  • Clean Cache
  • Restart project
  • Bake again
3 Likes

What are the ramifications of cleaning the cache

The main one is that GI cache is shared across all projects within the ~same editor version, or globally on a computer if you do the same lighting processes.

So you could unintentionally clear cache from another project, that you might also be working on or doing progressive bakes with.

by default, the cache is stored globally like this, but you can set it to keep it in the lighting asset itself, which would be project/scene based instead.

Here is a rule of thumb for lightmap baking

  1. Don’t try to lightmap anything bigger than 200 x 200m scene - just never works
  2. Assign at least two weeks to optimize the scene for lightmap baking (for a dense 200 x 200m scene)
  3. Only lightmap big objects, and leave small objects for light probes
  4. Expect it to fail and be ready to iterate
  5. Higher quality options are not really viable because not only do they take long, but fail 99% of the time. Only raise quality when your scene is fully ready.
  6. Don’t dream about test lightmapping on a WIP scene. It is a massive waste of time.
  7. Lightmap will easily get corrupt. Just be ready mentally.
  8. There will always be artifacts. Design your scene around it to hide it.
5 Likes

I just cleared the cache, still have the same problem.
the loading either stays at 0 and gets stuck, or shoots to a random number and gets stuck there

Thank you so much! This ended up fixing it becuase my GI Cache was at 9.39GB Out of 10GB

1 Like

Another thing to Add is if your Elighten ever gets stuck clear your Global Illumination Cache (GI Cache) And run the bake again