UKismetRenderingLibrary::ReadRenderTargetRawPixelArea
#include "Kismet/KismetRenderingLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Reads a rectangular region of a render target as raw, unconverted linear values, returning one entry per pixel.
Caveats & Gotchas
- • Incredibly inefficient and slow — reads back the whole rectangle from GPU memory synchronously, stalling the render thread. Prefer this over calling ReadRenderTargetRawPixel per-pixel in a loop, but avoid both on large areas at runtime.
- • The returned array is ordered row-major starting at (MinX, MinY); the caller must know the rectangle dimensions to reshape it.
- • Out-of-bounds coordinates are not validated in Blueprint the way you might expect — ensure MinX/MinY/MaxX/MaxY stay within the render target's actual resolution.
Signature
static TArray<FLinearColor> ReadRenderTargetRawPixelArea(UObject* WorldContextObject, UTextureRenderTarget2D* TextureRenderTarget, int32 MinX, int32 MinY, int32 MaxX, int32 MaxY, bool bNormalize = true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | UObject* | World context used to resolve the current world. | — |
| TextureRenderTarget | UTextureRenderTarget2D* | The render target to read from. | — |
| MinX | int32 | Left edge of the rectangle, in pixels. | — |
| MinY | int32 | Top edge of the rectangle, in pixels. | — |
| MaxX | int32 | Right edge of the rectangle, in pixels. | — |
| MaxY | int32 | Bottom edge of the rectangle, in pixels. | — |
| bNormalize | bool | Whether to normalize 8-bit formats into the [0,1] range. | true |
Return Type
TArray<FLinearColor> Example
Read a region of raw pixels C++
TArray<FLinearColor> Region = UKismetRenderingLibrary::ReadRenderTargetRawPixelArea(this, HeightmapRT, 0, 0, 63, 63, false);
// Region.Num() == 64 * 64 See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?