UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FRenderTarget Class Referenceabstract

#include <UnrealClient.h>

+ Inheritance diagram for FRenderTarget:

Public Member Functions

ENGINE_API FRenderTarget ()
 
virtual ENGINE_API ~FRenderTarget ()
 
virtual ENGINE_API const FTextureRHIRefGetRenderTargetTexture () const
 
virtual ENGINE_API FUnorderedAccessViewRHIRef GetRenderTargetUAV () const
 
virtual ENGINE_API FRDGTextureRef GetRenderTargetTexture (FRDGBuilder &GraphBuilder) const
 
virtual ENGINE_API const FTextureRHIRefGetShaderResourceTexture () const
 
virtual FIntPoint GetSizeXY () const =0
 
virtual ENGINE_API float GetDisplayGamma () const
 
virtual EDisplayColorGamut GetDisplayColorGamut () const
 
virtual EDisplayOutputFormat GetDisplayOutputFormat () const
 
virtual bool GetSceneHDREnabled () const
 
virtual void ProcessToggleFreezeCommand ()
 
virtual bool HasToggleFreezeCommand ()
 
virtual ENGINE_API bool ReadPixels (TArray< FColor > &OutImageData, FReadSurfaceDataFlags InFlags=FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX), FIntRect InSrcRect=FIntRect(0, 0, 0, 0))
 
ENGINE_API bool ReadPixelsPtr (FColor *OutImageBytes, FReadSurfaceDataFlags InFlags=FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX), FIntRect InSrcRect=FIntRect(0, 0, 0, 0))
 
ENGINE_API bool ReadFloat16Pixels (TArray< FFloat16Color > &OutImageData, ECubeFace CubeFace)
 
virtual ENGINE_API bool ReadFloat16Pixels (TArray< FFloat16Color > &OutImageData, FReadSurfaceDataFlags InFlags=FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX), FIntRect InSrcRect=FIntRect(0, 0, 0, 0))
 
virtual ENGINE_API bool ReadLinearColorPixels (TArray< FLinearColor > &OutImageData, FReadSurfaceDataFlags InFlags=FReadSurfaceDataFlags(RCM_MinMax, CubeFace_MAX), FIntRect InSrcRect=FIntRect(0, 0, 0, 0))
 
ENGINE_API bool ReadLinearColorPixelsPtr (FLinearColor *OutImageBytes, FReadSurfaceDataFlags InFlags=FReadSurfaceDataFlags(RCM_MinMax, CubeFace_MAX), FIntRect InSrcRect=FIntRect(0, 0, 0, 0))
 
virtual FRHIGPUMask GetGPUMask (FRHICommandListImmediate &RHICmdList) const
 

Static Public Member Functions

static float GetEngineDisplayGamma ()
 

Protected Attributes

FTextureRHIRef RenderTargetTextureRHI
 

Detailed Description

A render target.

Constructor & Destructor Documentation

◆ FRenderTarget()

FRenderTarget::FRenderTarget ( )
default

Default constructor

◆ ~FRenderTarget()

FRenderTarget::~FRenderTarget ( )
virtualdefault

Destructor

Member Function Documentation

◆ GetDisplayColorGamut()

virtual EDisplayColorGamut FRenderTarget::GetDisplayColorGamut ( ) const
inlinevirtual

Reimplemented in FDummyViewport, and FSceneViewport.

◆ GetDisplayGamma()

◆ GetDisplayOutputFormat()

virtual EDisplayOutputFormat FRenderTarget::GetDisplayOutputFormat ( ) const
inlinevirtual

Reimplemented in FDummyViewport, and FSceneViewport.

◆ GetEngineDisplayGamma()

float FRenderTarget::GetEngineDisplayGamma ( )
static

◆ GetGPUMask()

virtual FRHIGPUMask FRenderTarget::GetGPUMask ( FRHICommandListImmediate RHICmdList) const
inlinevirtual

Returns the GPU nodes on which to render this render target.

Reimplemented in FTextureRenderTargetResource, FPlanarReflectionRenderTarget, and FViewport.

◆ GetRenderTargetTexture() [1/2]

const FTextureRHIRef & FRenderTarget::GetRenderTargetTexture ( ) const
virtual

Accessor for the surface RHI when setting this render target

Returns
render target surface RHI resource

Reimplemented in FSceneViewport, FSlateCanvasRenderTarget, and FRDGCanvasRenderTarget.

◆ GetRenderTargetTexture() [2/2]

FRDGTextureRef FRenderTarget::GetRenderTargetTexture ( FRDGBuilder GraphBuilder) const
virtual

Returns a valid RDG texture for this render target.

Reimplemented in FSlateCanvasRenderTarget, and FRDGCanvasRenderTarget.

◆ GetRenderTargetUAV()

FUnorderedAccessViewRHIRef FRenderTarget::GetRenderTargetUAV ( ) const
virtual

◆ GetSceneHDREnabled()

virtual bool FRenderTarget::GetSceneHDREnabled ( ) const
inlinevirtual

Reimplemented in FDummyViewport, and FSceneViewport.

◆ GetShaderResourceTexture()

const FTextureRHIRef & FRenderTarget::GetShaderResourceTexture ( ) const
virtual

Accessor for the surface RHI to use when reading the reading target (may differ from GetRenderTargetTexture() for some implementations like cubemaps)

Returns
surface RHI resource

Reimplemented in FTextureRenderTargetResource.

◆ GetSizeXY()

◆ HasToggleFreezeCommand()

virtual bool FRenderTarget::HasToggleFreezeCommand ( )
inlinevirtual

Returns if there is a command to toggle freezerendering

Reimplemented in FViewport.

◆ ProcessToggleFreezeCommand()

virtual void FRenderTarget::ProcessToggleFreezeCommand ( )
inlinevirtual

Handles freezing/unfreezing of rendering

Reimplemented in FViewport.

◆ ReadFloat16Pixels() [1/2]

PRAGMA_DISABLE_DEPRECATION_WARNINGS bool FRenderTarget::ReadFloat16Pixels ( TArray< FFloat16Color > &  OutImageData,
ECubeFace  CubeFace 
)

Reads the render target's displayed pixels into the given color buffer.

Parameters
OutImageData- RGBA16F values will be stored in this buffer
CubeFace- optional cube face for when reading from a cube render target
Returns
True if the read succeeded.

◆ ReadFloat16Pixels() [2/2]

PRAGMA_ENABLE_DEPRECATION_WARNINGS bool FRenderTarget::ReadFloat16Pixels ( TArray< FFloat16Color > &  OutImageData,
FReadSurfaceDataFlags  InFlags = FReadSurfaceDataFlags(RCM_UNormCubeFace_MAX),
FIntRect  InSrcRect = FIntRect(0, 0, 0, 0) 
)
virtual

Reads the render target's displayed pixels into the given color buffer.

Parameters
OutImageData- RGBA16F values will be stored in this buffer
InFlags- Additional information about how to to read the surface data (cube face, slice index, etc.)
InSrcRect- InSrcRect not specified means the whole rect
Returns
True if the read succeeded.

The default value for InFlags specifies RCM_UNorm which will cause values to be scaled into [0,1] ; use RCM_MinMax to retrieve values without change.

Unlike other RenderTarget Read functions, this only works if surface is PF_FloatRGBA exactly ; it does not convert. Prefer using FImageUtils::GetRenderTargetImage rather than calling this directly.

Reimplemented in FTextureRenderTargetVolumeResource.

◆ ReadLinearColorPixels()

bool FRenderTarget::ReadLinearColorPixels ( TArray< FLinearColor > &  OutImageData,
FReadSurfaceDataFlags  InFlags = FReadSurfaceDataFlags(RCM_MinMaxCubeFace_MAX),
FIntRect  InSrcRect = FIntRect(0, 0, 0, 0) 
)
virtual

Reads the render target's displayed pixels into the given color buffer.

Parameters
OutImageData- Linear color array to store the value
InFlags- Additional information about how to to read the surface data (cube face, slice index, etc.)
InSrcRect- InSrcRect not specified means the whole rect
Returns
True if the read succeeded.

The default value for InFlags specifies RCM_UNorm which will cause values to be scaled into [0,1] ; use RCM_MinMax to retrieve values without change.

This will convert whatever the pixel format is to FLinearColor (if supported). Prefer using FImageUtils::GetRenderTargetImage rather than calling this directly.

Reimplemented in FTextureRenderTargetVolumeResource.

◆ ReadLinearColorPixelsPtr()

bool FRenderTarget::ReadLinearColorPixelsPtr ( FLinearColor OutImageBytes,
FReadSurfaceDataFlags  InFlags = FReadSurfaceDataFlags(RCM_MinMaxCubeFace_MAX),
FIntRect  InSrcRect = FIntRect(0, 0, 0, 0) 
)

Reads the render target's displayed pixels into the given color buffer.

Parameters
OutImageBytes- Linear color array will be stored in this buffer. Buffer must be preallocated with the correct size!
InFlags- Additional information about how to to read the surface data (cube face, slice index, etc.)
InSrcRect- InSrcRect not specified means the whole rect
Returns
True if the read succeeded.

Ptr variant of this API just does an extra memcpy; prefer the TArray variant. Prefer using FImageUtils::GetRenderTargetImage rather than calling this directly.

◆ ReadPixels()

bool FRenderTarget::ReadPixels ( TArray< FColor > &  OutImageData,
FReadSurfaceDataFlags  InFlags = FReadSurfaceDataFlags(RCM_UNormCubeFace_MAX),
FIntRect  InSrcRect = FIntRect(0, 0, 0, 0) 
)
virtual

Reads the render target's displayed pixels into a preallocated color buffer.

Parameters
OutImageData- RGBA8 values will be stored in this buffer
InFlags- Additional information about how to to read the surface data (cube face, slice index, etc.)
InSrcRect- InSrcRect not specified means the whole rect
Returns
True if the read succeeded.

This will convert whatever the pixel format is to FColor Prefer using FImageUtils::GetRenderTargetImage rather than calling this directly.

The default value for InFlags specifies RCM_UNorm which will cause values to be scaled into [0,1] ; use RCM_MinMax to retrieve values without change.

If the RenderTarget surface is float linear, it will converted to SRGB FColor, if InFlags.bLinearToGamma is set (which is on by default). If the RenderTarget surface is U8, then the SRGB/not state is unchanged, the U8 values are retrieved unchanged in either Linear or SRGB. Gamma is handled correctly automatically by FImageUtils::GetRenderTargetImage

Reimplemented in FTextureRenderTargetCubeResource, FTextureRenderTarget2DArrayResource, and FTextureRenderTargetVolumeResource.

◆ ReadPixelsPtr()

bool FRenderTarget::ReadPixelsPtr ( FColor OutImageBytes,
FReadSurfaceDataFlags  InFlags = FReadSurfaceDataFlags(RCM_UNormCubeFace_MAX),
FIntRect  InSrcRect = FIntRect(0, 0, 0, 0) 
)

Reads the render target's displayed pixels into a preallocated color buffer.

Parameters
OutImageBytes- RGBA8 values will be stored in this buffer. Buffer must be preallocated with the correct size!
InFlags- Additional information about how to to read the surface data (cube face, slice index, etc.)
InSrcRect- InSrcRect not specified means the whole rect
Returns
True if the read succeeded.

Ptr variant of this API just does an extra memcpy; prefer the TArray variant. Prefer using FImageUtils::GetRenderTargetImage rather than calling this directly.

Member Data Documentation

◆ RenderTargetTextureRHI

FTextureRHIRef FRenderTarget::RenderTargetTextureRHI
protected

The documentation for this class was generated from the following files: