UKismetRenderingLibrary::ReadRenderTargetRaw
#include "Kismet/KismetRenderingLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Reads the entire render target as raw, unconverted linear values in a single readback, filling OutLinearSamples with one entry per pixel.
Caveats & Gotchas
- • Incredibly inefficient and slow, but still far cheaper than reading a whole render target one pixel at a time via ReadRenderTargetRawPixel — prefer this for full-texture reads.
- • Returns false if the render target's resource is invalid or the readback fails; always check the return value before trusting OutLinearSamples.
- • For large render targets this allocates a large TArray and can cause a noticeable hitch since it forces a GPU-to-CPU sync.
Signature
static bool ReadRenderTargetRaw(UObject* WorldContextObject, UTextureRenderTarget2D* TextureRenderTarget, TArray<FLinearColor>& OutLinearSamples, 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. | — |
| OutLinearSamples | TArray<FLinearColor>& | Filled with one raw linear color per pixel, row-major. | — |
| bNormalize | bool | Whether to normalize 8-bit formats into the [0,1] range. | true |
Return Type
bool Example
Read an entire render target C++
TArray<FLinearColor> Samples;
if (UKismetRenderingLibrary::ReadRenderTargetRaw(this, HeightmapRT, Samples, false))
{
// Samples.Num() == Width * Height
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?