Lighting Bake Crash When Encoding Textures

Hi!

I get a crash right after the lightmaps have been baked and it says “Encoding Textures”.

I tried deleting my DerivedDataCache folder as well as the Intermediate folder without success.

I’m not running any C++ code.

The callstack looks like this:

Access violation - code c0000005 (first/second chance not available)
UE4Editor_Engine!FTextureCacheDerivedDataWorker::BuildTexture() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\engine\private\texturederiveddata.cpp:772]
UE4Editor_Engine!FTextureCacheDerivedDataWorker::DoWork() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\engine\private\texturederiveddata.cpp:918]
UE4Editor_Engine!FAsyncTask::DoWork() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\public\async\asyncwork.h:264]
UE4Editor_Engine!FAsyncTask::DoThreadedWork() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\public\async\asyncwork.h:288]
UE4Editor_Core!FQueuedThread::Run() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\private\hal\threadingbase.cpp:442]
UE4Editor_Core!FRunnableThreadWin::Run() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:76]

Does the crash occur in a new default level in your project or does this only occur in certain maps?

If so I would try making a new map and slowly migrate assets over while occasionally testing if the crash happens after baking. This may either fix the issue OR help you discover what in your map is causing the crash.


If the crash happens on a new default map try to see if the crash occurs in a new blank project. (it shouldn’t but if it does that would suggest an issue on your end and I would need your DxDiag)


If the crash is specific to your project and doesn’t happen on fresh blank projects try removing the config folder from your project. (don’t delete as this stores all of your project settings and inputs this is just a test and you should put it back later) If you notice the crashes stop happening after removing this folder then I you need to investigate what project settings/changes you made to cause this to occur.

1 Like

Thank you for your answer!

I’ve managed to narrow it down to the landscape. If I remove it then it doesn’t crash anymore.
It’s just frustrating since it worked before, on even higher resolutions. It actually succeeds approx. 1 in 10 times, so it’s a bit random too.

The only change I can remember doing is updating from 4.14 to 4.15.

The callstack mentions Derived Data Cache. Does that give any clues?

I managed to fix the crash by disabling Cast Static Shadows on my directional light. Now I just need to figure out what to do to be able to turn it on again.

It sounds like you may have a corrupted asset. The derived data cache is created on startup or when assets are loaded (if there isn’t one present) and stores the assets in a format that is used by the engine and its target platforms. If the source asset is bad deleting the DDC wont help unfortunately.

If you still have a copy of your project in 4.14 you can try migrating just that map (with the lanscape) to 4.15 again. If the issue persists this could be a bug and it would be good to get a copy of just the landscape so that I may reproduce the issue on my end.

Unfortunately, you may need to recreate your landscape in your 4.15 project.

[Update] I actually have found a common crash issue that is related to your problem and it may be a legitimate issue that a lot of people are having.

If possible getting a test project that reliably gets the crash after upgrading to 4.15 would really help us in reproducing the issue and then being able to fix it. Here is the ticket that I think is related to you: Unreal Engine Issues and Bug Tracker (UE-42168)

I haven’t been able to create a test scene to reproduce the issue. As a matter of fact it now works to bake the lighting with Cast Static Shadows enabled again after massaging the terrain a bit.

Yes, it seems like that ticket is the same issue I was having.
for looking into it!

Glad to hear that your issue resolved itself for now. If you ever start to have issues again feel free to upload a sample that reproduces the issue and we can continue our investigation. For now I am marking this as resolved. All you need to do is comment and I will get this back in my queue.

!

I want to know, is this issue have been fixed?

I have been tried that reducing the Landscape “Static Lighting Resolution” from 1 to 0.5(actually is 0.496296, I don’t know why this number came, maybe it related to my landscape), and the crash has been disappeared.

And I think if the landscape’s sections is too large(my landscape have the 4096 sections), the crash almost always happen.

A bug was never entered since I didn’t reproduce this issue internally so there was nothing to fix. You can try editing the terrain slightly like the OP did to resolve the issue.

You are probably crashing due to running out of memory, changing the static lighting resolution is an acceptable way to handle this however, usually increasing the value helps not decreasing it.