Have you ever worked something out? Because I have the same problem, ReadPixels() is just crazy slow makes up for 80% of all the time my entire function uses. There must be some way to get to the raw data quickly?
I tried using ReadPixelsPtr() instead and then copy the array around, but that is just as slow.
Nope. No further. Unfortunately, the support for this engine is not very good so despite my best efforts, I had to give up in the end. Let me know if you figure something out!
I know this question is getting quite old, but I showed up when I was looking for a solution to the same problem.
I think found a way around this by modifying ReadPixels so it does not block the game thread. I’ve added a description to the wiki (https://wiki.unrealengine.com/Render_Target_Lookup) in case anyone is interested.
I have not found a faster solution than ReadPixels, but, as I explained in my own post here, you can speed ReadPixels up a lot by disabling HDR on the render target and setting the render target’s resolution to match the active camera’s resolution. Otherwise, the renderer has to re-allocate resources every time it reads from the render target.
Hey, being way late to the party I just wanted to post this, where I basically brought together everything I learned following the discussion here and on other forums, for my own projects, as I think that it may help others who want to do something similar and may or may not have less experience with UE4. This was the case for me when I read through the discussion here.
In the repository I explain a way to capture images from SceneCapture2D components to disk from scratch, giving above 30 fps even for complex scenes (dependent on your hardware).
I initially framed this towards generating data for machine learning, but of course it is usable for any application.
I have 31 2D scene capture components running. Getting the resource from the rendering thread boost my framerate from 11.3 to 11.7 and reduce RAM usage from 9.2 to 8.1.