UE 4.24 freezes while baking on CPU

I have a project that I spent about a month on texturing and lighting, optimizing, and removing artefacts. And when it came time to bake on Production, it just freezes while the swarm agent keeps on running. I tried it 2-3 times but everytime, Unreal freezes after some time. Sometimes it’s at 6 percent. Some times 22 and some times 13.
So I tried to bake at high settings but same issue.

Anyone knows what is causing it?

I have a ryzen 7 1700, 16 gigs 3000 DDR4 and a GTX 960 2 gigs with a Crucial MX250 SSD.
Running windows 10 and UE 4.24

Have you checked how much RAM it’s using when it tries to build?

Yeah it goes to like 8-8.6 gigs usage and still has some room.
CPU remains at 99-100 % usage.
When Unreal becomes unresponsive, the CPU still keeps on working at 99-100 % and the RAM at 8-8.6 gigs. Swarmagent keeps on progressing.

This problem had also occurred in my office 2-3 times. And to check if it becomes responsive, we left the PC as it is. After the bake was complete, Unreal was still unresponsive. And this system is a i7 8700K with 64 gigs of RAM and a 2080 Super.

Any idea darthviper107?

First clean your swarm agent cache. Then try to build on a lower setting like preview. Does that work? You haven’t mention if it works on preview settings. If it does go to the Build menu > Lighting Info > Static mesh lighting info and see if one of the meshes uses too much memory or needs too much time to be rendered. This info is only available if you can build lighting. If you made any changes in the lightmass settings and you cannot build on preview then delete your config folder and reset all lightmass world settings to default (yellow arrow) as a test. Make a backup copy of your config folder so you can recover your settings.

Are you using foliage? if you use foliage you could very easily get an insane amount of lightmaps if your meshes have a relative large light map size. You can set the lightmap size inside the foliage menu to a lower value. Let’s say you have grass and each of the grass has a 64 lightmap size but you painted 10.000 grass meshes… you get the picture. You can also disable static lighting for foliage so it won’t use any lightmaps.

Are you using sub levels? you could try to build the levels one by one to find the offending asset.

Thanks for the reply.
I have tried clearing out swarm cache. In,fact I do it every time I bake but it didn’t help.
The scene gets baked at Preview and also Medium settings. Only High and Production have this issue.
No, I don’t have sub levels. There is only one level.
No, there is no foliage in the scene. I do have a tree in the library but it is not added in the scene.

As far as I know lighting builds with higher settings use more memory. At least the build data size is increasing. That makes it likely that you are running out of memory. Have you checked the static mesh lighting info as I described? This should show you how you can reduce your memory impact. Look at the assets with the highest memory use first or the ones you use multiple times with higher memory use.

I tried that and could only see two textures at 4096 res. I lowered those to 2k to save some memory s those textures were used on 5-6 landscape meshes
It is now able to bake sometimes and sometimes it still freezes. So the issue still remains but at least I was able to bake at High quality last nght. Thanks

Great! - You can sort the list per column. Find the items that take the most time to build and the ones that take up the largest light map memory. I can’t check the exact wording at the moment.

Is the scene’s landscape using LODs? what are the ray trace settings, if any? is CSM enabled in the directional light?

Thanks, but I couldn’t find the column for “time taken to build lightmap”. Anyways, it worked

Nope. No LOD on the landscape, and no raytracing as well.
Don’t know about the CSM though. Could you please tell me how CSM could be making this baking problem?

Once you built the lighting go to the Build menu and select Lighting Info > Lighting Static Mesh Info. The list will be empty initially. From the drop down menu top left choose “Lighting Build Info”. This will open the list seen in the image. Then click on the column named Lighting Time to sort the list.

Quite strange. It isn’t working for me. “Lighting Build Info” is empty. I clicked the refresh button but still empty.

It

You have to look at the list straight away. It’s a temporary list created after you build lighting in the current editor window. It doesn’t get stored anywhere else. So as soon as you switch project or open another level or close and reopen the editor the list will be gone.

Oh. Thanks. I will keep it in mind next time I bake on the preview