UTexture

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/Texture.h

Include

#include "Engine/Texture.h"

Syntax

class UTexture :
    public UStreamableRenderAsset,
    public IInterface_AssetUserData,
    public IInterface_AsyncCompilation

Variables

Name Description

Public variable

float

 

AdjustBrightness

Static texture brightness adjustment (scales HSV value.) (Non-destructive; Requires texture source art to be available.)

Public variable

float

 

AdjustBrightnessCurve

Static texture curve adjustment (raises HSV value to the specified power.) (Non-destructive; Requires texture source art to be available.)

Public variable

float

 

AdjustHue

Static texture hue adjustment (0 - 360) (offsets HSV hue by value in degrees.) (Non-destructive; Requires texture source art to be available.)

Public variable

float

 

AdjustMaxAlpha

Remaps the alpha to the specified min/max range, defines the new value of 1 (Non-destructive; Requires texture source art to be available.)

Public variable

float

 

AdjustMinAlpha

Remaps the alpha to the specified min/max range, defines the new value of 0 (Non-destructive; Requires texture source art to be available.)

Public variable

float

 

AdjustRGBCurve

Static texture RGB curve adjustment (raises linear-space RGB color to the specified power.) (Non-destructive; Requires texture source art to be available.)

Public variable

float

 

AdjustSaturation

Static texture saturation adjustment (scales HSV saturation.) (Non-destructive; Requires texture source art to be available.)

Public variable

float

 

AdjustVibrance

Static texture "vibrance" adjustment (0 - 1) (HSV saturation algorithm adjustment.) (Non-destructive; Requires texture source art to be available.)

Public variable

FVector4

 

AlphaCoverageThresholds

Alpha values per channel to compare to when preserving alpha coverage.

Public variable

TObjectPtr< cla...

 

AssetImportData

Protected variable

TArray< TObject...

 

AssetUserData

Array of user data stored with the asset

Public variable

bool

 

bChromaKeyTexture

Whether to chroma key the image, replacing any pixels that match ChromaKeyColor with transparent black

Public variable

uint8: 1

 

bCustomPropertiesImported

Indicates ImportCustomProperties has been called (set in ImportCustomProperties, unset in the subsequent PostEditChange)

Public variable

uint32: 1

 

bDitherMipMapAlpha

When true, the alpha channel of mip-maps and the base image are dithered for smooth LOD transitions.

Public variable

uint32: 1

 

bFlipGreenChannel

When true the texture's green channel will be inverted. This is useful for some normal maps.

Public variable

uint8: 1

 

bIsImporting

Indicates we're currently importing the object (set in PostEditImport, unset in the subsequent PostEditChange)

Public variable

uint8: 1

 

bNoTiling

If true, the RHI texture will be created using TexCreate_NoTiling

Public variable

uint8: 1

 

bNotOfflineProcessed

If true, the RHI texture will be created without TexCreate_OfflineProcessed.

Public variable

uint32: 1

 

bPreserveBorder

When true the texture's border will be preserved during mipmap generation.

Public variable

uint8: 1

 

bUseLegacyGamma

A flag for using the simplified legacy gamma space e.g pow(color,1/2.2) for converting from FColor to FLinearColor, if we're doing sRGB.

Public variable

FColor

 

ChromaKeyColor

The color that will be replaced with transparent black if chroma keying is enabled

Public variable

float

 

ChromaKeyThreshold

The threshold that components have to match for the texel to be considered equal to the ChromaKeyColor when chroma keying (<=, set to 0 to require a perfect exact match)

Public variable

float

 

CompositePower

Default 1, high values result in a stronger effect e.g 1, 2, 4, 8 this is no slider because the texture update would not be fast enough

Public variable

TObjectPtr< cla...

 

CompositeTexture

Can be defined to modify the roughness based on the normal map variation (mostly from mip maps).

Public variable

TEnumAsByte< en...

 

CompositeTextureMode

Defines how the CompositeTexture is applied, e.g. CTM_RoughnessFromNormalAlpha

Public variable

uint32: 1

 

CompressionNoAlpha

If enabled, the texture's alpha channel will be discarded during compression

Public variable

uint32: 1

 

CompressionNone

If true, force the texture to be uncompressed no matter the format.

Public variable

TEnumAsByte< en...

 

CompressionQuality

The compression quality for generated ASTC textures (i.e. mobile platform textures).

Public variable

TEnumAsByte< en...

 

CompressionSettings

Compression settings to use when building the texture.

Public variable

uint8: 1

 

CompressionYCoCg

If true the texture stores YCoCg.

Public variable

uint32: 1

 

DeferCompression

If enabled, defer compression of the texture until save or manually compressed in the texture editor.

Public variable

FPerPlatformFlo...

 

Downscale

Downscale source texture, applied only to textures without mips 0.0 - use scale value from texture group 1.0 - do not scale texture

Public variable

ETextureDownsca...

 

DownscaleOptions

Texture downscaling options

Public variable

TEnumAsByte< en...

 

Filter

The texture filtering mode to use when sampling this texture.

Public variable

TArray< FTextur...

 

LayerFormatSettings

Array of settings used to control the format of given layer If this array doesn't include an entry for a given layer, values from UTexture will be used

Public variable

int32

 

LevelIndex

Level scope index of this texture.

Public variable

int32

 

LODBias

A bias to the index of the top mip level to use.

Public variable

TEnumAsByte< en...

 

LODGroup

Texture group this texture belongs to

Public variable

TEnumAsByte< ET...

 

LossyCompressionAmount

How aggressively should any relevant lossy compression be applied.

Public variable

int32

 

MaxTextureSize

The maximum resolution for generated textures.

Public variable

TEnumAsByte< en...

 

MipGenSettings

Per asset specific setting to define the mip-map generation properties like sharpening and kernel size.

Public variable

ETextureMipLoad...

 

MipLoadOptions

The texture mip load options.

Public variable

FName

 

OodleTextureSdkVersion

Oodle Texture SDK Version to encode with.

Public variable

FColor

 

PaddingColor

The color used to pad the texture out if it is resized due to PowerOfTwoMode

Public variable

TEnumAsByte< en...

 

PowerOfTwoMode

How to pad the texture to a power of 2 size (if necessary)

Public variable

FRenderCommandF...

 

ReleaseFence

Release fence to know when resources have been freed on the rendering thread.

Public variable

FTextureSource

 

Source

Public variable

FTextureSourceC...

 

SourceColorSettings

Texture color management settings: source encoding and color space.

Public variable

uint8: 1

 

SRGB

This should be unchecked if using alpha channels individually as masks.

Public variable

TWeakPtr< class...

 

TextureEditorCustomEncoding

When we are open in an asset editor, we have a pointer to a custom encoding object which can optionally cause us to do something other than Fast/Final encode settings.

Public variable

FTextureReferen...

 

TextureReference

Stable RHI texture reference that refers to the current RHI texture.

Public variable

uint8: 1

 

VirtualTextureStreaming

Is this texture streamed in using VT

Constructors

Name Description

Public function

UTexture

(
    const FObjectInitializer& ObjectIn...
)

Destructors

Name Description

Public function Virtual

~UTexture()

Functions

Name Description

Public function

void

 

BeginCachePlatformData()

Begins caching platform data in the background.

Protected function

void

 

BeginFinalReleaseResource()

Public function

void

 

CachePlatformData

(
    bool bAsyncCache,
    bool bAllowAsyncBuild,
    bool bAllowAsyncLoading,
    ITextureCompressorModule* Comp...
)

Caches platform data for the texture.

Public function Virtual Const

uint32

 

CalcTextureMemorySizeEnum

(
    ETextureMipCount Enum
)

Calculates the size of this texture if it had MipCount miplevels streamed in.

Public function Static

void

 

CancelPendingTextureStreaming()

Cancels any pending texture streaming actions if possible.

Public function

void

 

CleanupCachedRunningPlatformData()

Public function Virtual

FTextureReso...

 

CreateResource()

Implemented by subclasses to create a new resource for the texture.

Public function

void

 

FinishCachePlatformData()

Blocks on async cache tasks and prepares platform data for use.

Public function

void

 

ForceRebuildPlatformData

(
    uint8 InEncodeSpeedOverride
)

Forces platform data to be rebuilt.

Public function Static

bool

 

ForceUpdateTextureStreaming()

Forces textures to recompute LOD settings and stream as needed.

Public function Virtual

float

 

GetAverageBrightness

(
    bool bIgnoreTrueBlack,
    bool bUseGrayscale
)

Gets the average brightness of the texture (in linear space)

Public function Const

int64

 

GetBuildRequiredMemory()

Get an estimate of the peak amount of memory required to build this texture.

Public function Virtual

TMap< FStrin...

 

GetCookedPlatformData()

Public function Const

void

 

GetDefaultFormatSettings

(
    FTextureFormatSettings& OutSetting...
)

Public function Virtual Const

FGuid

 

GetExternalTextureGuid()

Access the GUID which defines this texture's resources externally through FExternalTextureRegistry

Public function Const

void

 

GetLayerFormatSettings

(
    int32 LayerIndex,
    FTextureFormatSettings& OutSetting...
)

Gets settings used to choose format for the given layer

Public function Const

const FGuid ...

 

GetLightingGuid()

Returns a unique identifier for this texture. Used by the lighting build and texture streamer.

Public function Virtual Const

EMaterialVal...

 

GetMaterialType()

Public function Virtual Const

uint32

 

GetMaximumDimension()

Return maximum dimension for this texture type.

Public function Static

TextureMipGe...

 

GetMipGenSettingsFromString

(
    const TCHAR* InStr,
    bool bTextureGroup
)

Public function Static

const TCHAR ...

 

GetMipGenSettingsString

(
    TextureMipGenSettings InEnum
)

Public function Static

UEnum *

 

GetPixelFormatEnum()

Retrieves the pixel format enum for enum <-> string conversions.

Public function Const

const FTextu...

 

GetResource()

Get the const texture's resource, can be NULL

Public function

FTextureReso...

 

GetResource()

Get the texture's resource, can be NULL

Protected function Const

FStreamableR...

 

GetResourcePostInitState

(
    const FTexturePlatformData* Pl...,
    bool bAllowStreaming,
    int32 MinRequestMipCount,
    int32 MaxMipCount,
    bool bSkipCanBeLoaded
)

Calculates the render resource initial state, expected to be used in InitResource() for derived classes implementing streaming.

Public function Virtual

FTexturePlat...

 

GetRunningPlatformData()

Textures that use the derived data cache must override this function and provide a pointer to the linked list of platform data.

Public function Static

int32

 

GetStaticMinTextureResidentMipCount()

Returns the minimum number of mips that must be resident in memory (cannot be streamed).

Protected function Virtual Const

bool

 

GetStreamableRenderResourceState

(
    FTexturePlatformData* InPlatfo...,
    FStreamableRenderResourceState& Ou...
)

Public function Virtual Const

uint32

 

GetSurfaceArraySize()

Public function Virtual Const

float

 

GetSurfaceDepth()

Public function Virtual Const

float

 

GetSurfaceHeight()

Public function Virtual Const

float

 

GetSurfaceWidth()

Public function Virtual Const

TextureAddre...

 

GetTextureAddressX()

Public function Virtual Const

TextureAddre...

 

GetTextureAddressY()

Public function Virtual Const

TextureAddre...

 

GetTextureAddressZ()

Public function Static

const TCHAR ...

 

GetTextureGroupString

(
    TextureGroup InGroup
)

Public function Virtual Const

void

 

GetVirtualTextureBuildSettings

(
    FVirtualTextureBuildSettings& OutS...
)

Returns the virtual texture build settings.

Public function Const

bool

 

HasHDRSource

(
    int32 LayerIndex
)

Checks whether this texture has a high dynamic range (HDR) source.

Public function Const

bool

 

IsAsyncCacheComplete()

Returns true if all async caching has completed.

Public function Const

bool

 

IsCandidateForTextureStreaming

(
    const ITargetPlatform* InTarge...
)

Called by ULevel::MarkNoStreamableTexturesPrimitiveComponents when cooking level.

Public function Virtual Const

bool

 

IsCurrentlyVirtualTextured()

Returns if the texture is actually being rendered using virtual texturing right now.

Public function Virtual Const

bool

 

IsDefaultTexture()

Returns true if the current texture is a default placeholder because compilation is still ongoing.

Public function Const

bool

 

IsNormalMap()

Public function Const

bool

 

IsUncompressed()

Public function

void

 

MarkPlatformDataTransient()

Marks platform data as transient.

Protected function

void

 

NotifyMaterials

(
    const ENotifyMaterialsEffectOnShade...
)

Notify any loaded material instances that the texture has changed.

Public function

void

 

ReleaseResource()

Resets the resource for the texture.

Public function

void

 

SerializeCookedPlatformData

(
    FArchive& Ar
)

Serializes cooked platform data.

Public function

void

 

SetDeterministicLightingGuid()

Generates a deterministic GUID for the texture based on the full name of the object.

Public function

void

 

SetLayerFormatSettings

(
    int32 LayerIndex,
    const FTextureFormatSettings& InSe...
)

Public function

void

 

SetLightingGuid()

Assigns a new GUID to a texture.

Public function

void

 

SetLightingGuid

(
    const FGuid& Guid
)

Public function Static

void

 

SetMinTextureResidentMipCount

(
    int32 InMinTextureResidentMipCount
)

Sets the minimum number of mips that must be resident in memory (cannot be streamed).

Public function

void

 

SetResource

(
    FTextureResource* Resource
)

Set texture's resource, can be NULL

Protected function

bool

 

TryCancelCachePlatformData()

Try to cancel any async tasks on PlatformData.

Public function

void

 

UpdateCachedLODBias()

Cache the combined LOD bias based on texture LOD group and LOD bias.

Public function Virtual

void

 

UpdateResource()

Creates a new resource for the texture, and updates any cached references to the resource.

Overridden from UStreamableRenderAsset

Name Description

Public function Virtual Const

bool

 

DoesMipDataExist

(
    const int32 MipIndex
)

Public function Virtual Const

float

 

GetLastRenderTimeForStreaming()

Get the per-asset last render time.

Public function Virtual Const

int32

 

GetLODGroupForStreaming()

Get an integer representation of the LOD group

Public function Virtual Const

FIoFilenameH...

 

GetMipIoFilenameHash

(
    const int32 MipIndex
)

Public function Virtual Const

EStreamableR...

 

GetRenderAssetType()

Public function Virtual Const

bool

 

HasPendingLODTransition()

Public function Virtual Const

bool

 

HasPendingRenderResourceInitialization()

Also returns false if the render resource is non existent, to prevent stalling on an event that will never complete.

Public function Virtual

void

 

InvalidateLastRenderTimeForStreaming()

Invalidates per-asset last render time.

Public function Virtual Const

bool

 

ShouldMipLevelsBeForcedResident()

Returns whether miplevels should be forced resident.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginCacheForCookedPlatformData

(
    const ITargetPlatform* TargetP...
)

Begins caching platform data in the background for the platform requested

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual Const

bool

 

CanEditChange

(
    const FProperty* InProperty
)

Called by the editor to query whether a property of this object is allowed to be modified.

Public function Virtual

void

 

ClearAllCachedCookedPlatformData()

Clear all cached cooked platform data

Public function Virtual

void

 

ClearCachedCookedPlatformData

(
    const ITargetPlatform* TargetP...
)

Clears cached cooked platform data for specific platform

Public function Virtual

void

 

ExportCustomProperties

(
    FOutputDevice& Out,
    uint32 Indent
)

Exports the property values for the specified object as text to the output device.

Public function Virtual

void

 

FinishDestroy()

Called to finish destroying the object.

Public function Virtual Const

void

 

GetAssetRegistryTags

(
    TArray< FAssetRegistryTag >& OutTa...
)

Gathers a list of asset registry searchable tags which are name/value pairs with some type information This only needs to be implemented for asset objects

Public function Virtual

void

 

ImportCustomProperties

(
    const TCHAR* SourceText,
    FFeedbackContext* Warn
)

Exports the property values for the specified object as text to the output device.

Public function Virtual

bool

 

IsCachedCookedPlatformDataLoaded

(
    const ITargetPlatform* TargetP...
)

Have we finished loading all the cooked platform data for the target platforms requested in BeginCacheForCookedPlatformData

Public function Virtual Const

bool

 

IsPostLoadThreadSafe()

Called during async load to determine if PostLoad can be called on the loading thread.

Public function Virtual

bool

 

IsReadyForFinishDestroy()

Called to check if the object is ready for FinishDestroy.

Public function Virtual

bool

 

Modify

(
    bool bAlwaysMarkDirty
)

That the object will be modified.

Public function Virtual

void

 

PostCDOContruct()

Called after the C++ constructor has run on the Class Default Object (CDO) for a class.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostEditImport()

Called after importing property values for this object (paste, duplicate or .t3d import) Allow the object to perform any cleanup for properties which shouldn't be duplicated or are unsupported by the script serialization

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

PreSave

(
    FObjectPreSaveContext SaveContext
)

Presave function.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Overridden from IInterface_AssetUserData

Name Description

Public function Virtual

void

 

AddAssetUserData

(
    UAssetUserData* InUserData
)

Public function Virtual Const

const TArray...

 

GetAssetUserDataArray()

Public function Virtual

UAssetUserDa...

 

GetAssetUserDataOfClass

(
    TSubclassOf< UAssetUserData > InUse...
)

Public function Virtual

void

 

RemoveUserDataOfClass

(
    TSubclassOf< UAssetUserData > InUse...
)

Overridden from IInterface_AsyncCompilation

Name Description

Public function Virtual Const

bool

 

IsCompiling()

Returns whether or not the asset is currently being compiled

Enums

Typedefs

Name

Description

FOnTextureSaved

Delegate type for texture save events ( Params: UTexture* TextureToSave )

Constants

Name

Description

GMinTextureResidentMipCount

The minimum number of mips that must be resident in memory (cannot be streamed).

PreSaveEvent

Triggered before a texture is being saved

Deprecated Variables

Name Description

Public variable

FString

 

SourceFilePath_DEPRECATED

Deprecated Functions

Name Description

Public function Virtual

void

 

PreSave

(
    const ITargetPlatform* TargetP...
)

Use version that takes FObjectPreSaveContext instead.