TimmHess / UnrealImageCapture

A small tutorial repository on capturing images with semantic annotation from UnrealEngine to disk.
MIT License
225 stars 51 forks source link

The Sample project keep crashing in UE5 #19

Closed jonbakerfish closed 2 years ago

jonbakerfish commented 2 years ago

Hi, I downloaded your project, compiled it and tried to run it with UE5. But when I hit play, and press C the whole UE5 crush with the following errors:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000009800000052

ucrtbase
ucrtbase
ucrtbase
UnrealEditor_Core
UnrealEditor_ImageWrapper
UnrealEditor_ImageWrapper
UnrealEditor_CameraCaptureToDisk!ACameraCaptureManager::Tick() [D:\code\UnrealImageCapture\CaptureToDisk\Plugins\CameraCaptureToDisk\Source\CameraCaptureToDisk\Private\CameraCaptureManager.cpp:72]
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Core
UnrealEditor_Core
UnrealEditor_Core
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

Do you know why?

TimmHess commented 2 years ago

I assume this is the latest version of UE5? I only ever tested it in a preview version... Unfortunately, there is not much to the error message, so I will have to try it for myself :)

TimmHess commented 2 years ago

So, I started looking into the issue and the test project got quite messy over time.. sorry for that.. The main issue will be in the level blueprint where "CaptureFloatNonBlocking" is called, however, I am not sure what is up with float capture (depth) specifically. Quickfix is to not capture depth but change it to "CaptureNonBlocking" - this I tested and it works on my machine ;) Note though that you want to untick "UseFloat" in the "CameraCaptureManager_BP" and instead either tick "UsePNG" or tick nothing (which is JPEG).

On a second note, in UE5 the PNG imagewrapper by default adds a 0 alpha channel for .png files, which makes them appear entirely black in my file browser. If you load them with something like opencv you see that they do actually contain the correct pixel information. The quick-fix will be to manually set alpha to 255 - But I am undecied how I would want to include that.

I will try to find time soon to clean everything for UE5.

Hope this somewhat helps you. The good news is that the general pipeline of non-blocking image saving is not entirly deprecated in UE5 👍

jonbakerfish commented 2 years ago

@TimmHess Thanks for your help! This repo is great for UE beginners to understand how to capture images.