Resource->ReadPixels is very slow... faster way?
I have set up a 2DSceneCapture component and using c++, I access the render target and read the pixels, like so:
I notice that my
What I really want, is to access the camera view data, but as I can't find a way to do that, I resorted to the RenderTarget method as described here: https://wiki.unrealengine.com/Render_Target_Lookup
I've also read this post: https://answers.unrealengine.com/questions/25594/accessing-pixel-values-of-texture2d.html#answer-73443 but I have no idea how to get
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.
answered Jan 04 '17 at 12:40 PM
I also looking for a faster solution than ReadPixels, this is really important for many tasks.
answered Jan 12 '17 at 08:30 AM
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.
answered Jul 18 '17 at 07:59 PM
Hey Guys. I share my solution.
Did you guys set the "bGPUSharedFlag"?? This value is belonging to "UTextureRenderTarget2D" class.
In my case, when I set this value to "true", ReadPixels() was faster than before!
This is my code. I sincerely hope it helps.
answered Mar 03 '19 at 12:50 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here