# How do I get a TArray of grayscale pixels from a Render Target

**URL:** <https://forums.unrealengine.com/t/how-do-i-get-a-tarray-of-grayscale-pixels-from-a-render-target/397439>\
**Category:** Rendering\
**Tags:** unreal-engine, memory, Rendering, CPP, question\
**Created:** [July 14, 2017, 9:41pm UTC](https://forums.unrealengine.com/t/how-do-i-get-a-tarray-of-grayscale-pixels-from-a-render-target/397439 "2017-07-14T21:41:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_6b572aea](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6b572aea](https://forums.unrealengine.com/u/anonymous_user_6b572aea)\
**Post date:** [July 14, 2017, 9:41pm UTC](https://forums.unrealengine.com/t/how-do-i-get-a-tarray-of-grayscale-pixels-from-a-render-target/397439/1 "2017-07-14T21:41:54Z")

</div>

I have a USceneCaptureComponent2d attached to an actor that I am programatically controlling which is set to NOT capture every frame and NOT capture on movement. I have a non-scene component that holds a pointer to this USceneCaptureComponent. Periodically I would like my component to call CaptureScene(), and then read the resultant pixel data from the TextureRenderTarget2D. Ideally, the pixel data would be formatted as a TArray(uint8) of grayscale values. Currently, I have the capture component set to full desaturation and am using a threaded FRHI ReadSurfaceData request to get the data out as a TArray(FColor) and then converting manually to to a byte array of grayscale values by doing GrayArray.Add(pixel.R) for every pixel in the FColor array. This is obviously very slow and doesn’t scale well for my application. Is there a way to get a grayscale byte array directly from a render target so I can do things like memcopys on the buffer to copy the data around efficiently?

---

<div class="post-metadata">

**Author:** ![dev\_simulatie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dev\_simulatie](https://forums.unrealengine.com/u/dev_simulatie)\
**Post date:** [August 22, 2023, 8:16am UTC](https://forums.unrealengine.com/t/how-do-i-get-a-tarray-of-grayscale-pixels-from-a-render-target/397439/2 "2023-08-22T08:16:53Z")

</div>

I have the same issue…  
Could someone please help us?

I have to get a byte array from a render target in C++, so that I can send the “picture” to other device using a sort of TCP protocol

---

<div class="post-metadata">

**Author:** ![ShadowBr0kerz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shadowbr0kerz/32/1201558_2.png) [@ShadowBr0kerz](https://forums.unrealengine.com/u/ShadowBr0kerz)\
**Post date:** [October 19, 2026, 8:34am UTC](https://forums.unrealengine.com/t/how-do-i-get-a-tarray-of-grayscale-pixels-from-a-render-target/397439/3 "2026-10-19T08:34:40Z")

</div>

unresolved for six years and still accurate: the built in ReadRenderTargetPixel family is a game-thread stall, it flushes the rhi command queue and waits for the readback before returning, so calling it per capture hitches. the non-blocking route is to copy the texture into a staging resource on the render thread and read it back through a fence, which is engine c++ territory, blueprints cant reach those APIs.

greyscale is the easy part once the samples are back: convert from the RGBA or float values yourself, Y = .299R + .587G + .114B, then push the bytes down your tcp path.

Async Render Target Reader, a render target readback plugin for Unreal Engine 5, does the staging copy for you: Read Render Target Pixels Async hands the pixels plus image size back in an On Success event and the game thread never waits for the gpu: [Async Render Target Reader — Non-Blocking GPU Pixel Readback for Blueprints | Fab](https://www.fab.com/listings/1861543a-feda-4961-8b6c-6b50c6daaeef)
