RealDocs

UKismetRenderingLibrary::ReadRenderTargetPixel

function Engine Blueprint Since 4.0
#include "Kismet/KismetRenderingLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Reads a single pixel from a render target using integer pixel coordinates, returning it as an 8-bit sRGB FColor.

Caveats & Gotchas

  • The header itself calls this an "incredibly inefficient and slow operation" — it stalls waiting on the GPU to flush and reads back a value; never call it in a per-frame loop.
  • LDR render targets are assumed to already be in sRGB space, while HDR targets are assumed linear and converted — mixing this up with the wrong render target format gives visibly wrong colors.
  • Reading a single pixel still requires the engine to read back at least a region of the target internally; if you need many pixels, use ReadRenderTarget once instead of calling this in a loop.

Signature

static FColor ReadRenderTargetPixel(UObject* WorldContextObject, UTextureRenderTarget2D* TextureRenderTarget, int32 X, int32 Y);

Parameters

Name Type Description Default
WorldContextObject UObject* Object used to resolve the current world.
TextureRenderTarget UTextureRenderTarget2D* The render target to sample from.
X int32 Integer pixel X coordinate to read.
Y int32 Integer pixel Y coordinate to read.

Return Type

FColor

Example

Sample a single pixel for debugging C++
FColor Sample = UKismetRenderingLibrary::ReadRenderTargetPixel(this, HeightmapRT, 128, 128);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.