UMaterialExpression

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

UObjectBase

UObjectBaseUtility

UObject

UMaterialExpression

UMaterialExpressionAbs

UMaterialExpressionActorPositionWS

UMaterialExpressionAdd

UMaterialExpressionAppendVector

UMaterialExpressionArccosine

UMaterialExpressionArccosineFast

UMaterialExpressionArcsine

UMaterialExpressionArcsineFast

UMaterialExpressionArctangent

UMaterialExpressionArctangent2

UMaterialExpressionArctangent2Fast

UMaterialExpressionArctangentFast

UMaterialExpressionAtmosphericFogColor

UMaterialExpressionAtmosphericLightColor

UMaterialExpressionAtmosphericLightVector

UMaterialExpressionBinaryOp

UMaterialExpressionLess

UMaterialExpressionBlackBody

UMaterialExpressionBlendMaterialAttributes

UMaterialExpressionBreakMaterialAttributes

UMaterialExpressionBumpOffset

UMaterialExpressionCameraPositionWS

UMaterialExpressionCameraVectorWS

UMaterialExpressionCeil

UMaterialExpressionClamp

UMaterialExpressionCloudSampleAttribute

UMaterialExpressionCollectionParameter

UMaterialExpressionComment

UMaterialExpressionComponentMask

UMaterialExpressionComposite

UMaterialExpressionConstant

UMaterialExpressionConstant2Vector

UMaterialExpressionConstant3Vector

UMaterialExpressionConstant4Vector

UMaterialExpressionConstantBiasScale

UMaterialExpressionCosine

UMaterialExpressionCrossProduct

UMaterialExpressionCustom

UMaterialExpressionCustomOutput

UMaterialExpressionAbsorptionMediumMaterialOutput

UMaterialExpressionBentNormalCustomOutput

UMaterialExpressionClearCoatNormalCustomOutput

UMaterialExpressionLandscapeGrassOutput

UMaterialExpressionLandscapePhysicalMaterialOutput

UMaterialExpressionRuntimeVirtualTextureOutput

UMaterialExpressionSingleLayerWaterMaterialOutput

UMaterialExpressionTangentOutput

UMaterialExpressionThinTranslucentMaterialOutput

UMaterialExpressionVertexInterpolator

UMaterialExpressionVolumetricAdvancedMaterialOutput

UMaterialExpressionDBufferTexture

UMaterialExpressionDDX

UMaterialExpressionDDY

UMaterialExpressionDecalDerivative

UMaterialExpressionDecalLifetimeOpacity

UMaterialExpressionDecalMipmapLevel

UMaterialExpressionDeltaTime

UMaterialExpressionDepthFade

UMaterialExpressionDepthOfFieldFunction

UMaterialExpressionDeriveNormalZ

UMaterialExpressionDesaturation

UMaterialExpressionDistance

UMaterialExpressionDistanceCullFade

UMaterialExpressionDistanceFieldGradient

UMaterialExpressionDistanceFieldsRenderingSwitch

UMaterialExpressionDistanceToNearestSurface

UMaterialExpressionDivide

UMaterialExpressionDotProduct

UMaterialExpressionDynamicParameter

UMaterialExpressionExecBegin

UMaterialExpressionExecEnd

UMaterialExpressionEyeAdaptation

UMaterialExpressionEyeAdaptationInverse

UMaterialExpressionFeatureLevelSwitch

UMaterialExpressionFloor

UMaterialExpressionFmod

UMaterialExpressionFontSample

UMaterialExpressionFontSampleParameter

UMaterialExpressionForLoop

UMaterialExpressionFrac

UMaterialExpressionFresnel

UMaterialExpressionFunctionInput

UMaterialExpressionFunctionOutput

UMaterialExpressionMaterialLayerOutput

UMaterialExpressionGenericConstant

UMaterialExpressionConstantDouble

UMaterialExpressionGetLocal

UMaterialExpressionGetMaterialAttributes

UMaterialExpressionGIReplace

UMaterialExpressionHairAttributes

UMaterialExpressionHairColor

UMaterialExpressionIf

UMaterialExpressionIfThenElse

UMaterialExpressionInverseLinearInterpolate

UMaterialExpressionLandscapeLayerBlend

UMaterialExpressionLandscapeLayerCoords

UMaterialExpressionLandscapeLayerSample

UMaterialExpressionLandscapeLayerSwitch

UMaterialExpressionLandscapeLayerWeight

UMaterialExpressionLandscapeVisibilityMask

UMaterialExpressionLightmapUVs

UMaterialExpressionLightmassReplace

UMaterialExpressionLightVector

UMaterialExpressionLinearInterpolate

UMaterialExpressionLogarithm10

UMaterialExpressionLogarithm2

UMaterialExpressionMakeMaterialAttributes

UMaterialExpressionMapARPassthroughCameraUV

UMaterialExpressionMaterialAttributeLayers

UMaterialExpressionMaterialFunctionCall

UMaterialExpressionMaterialProxyReplace

UMaterialExpressionMax

UMaterialExpressionMin

UMaterialExpressionMultiply

UMaterialExpressionNoise

UMaterialExpressionNormalize

UMaterialExpressionObjectBounds

UMaterialExpressionObjectOrientation

UMaterialExpressionObjectPositionWS

UMaterialExpressionObjectRadius

UMaterialExpressionOneMinus

UMaterialExpressionPanner

UMaterialExpressionParameter

UMaterialExpressionDoubleVectorParameter

UMaterialExpressionScalarParameter

UMaterialExpressionCurveAtlasRowParameter

UMaterialExpressionStaticBoolParameter

UMaterialExpressionStaticSwitchParameter

UMaterialExpressionStaticComponentMaskParameter

UMaterialExpressionVectorParameter

UMaterialExpressionChannelMaskParameter

UMaterialExpressionParticleColor

UMaterialExpressionParticleDirection

UMaterialExpressionParticleMacroUV

UMaterialExpressionParticleMotionBlurFade

UMaterialExpressionParticlePositionWS

UMaterialExpressionParticleRadius

UMaterialExpressionParticleRandom

UMaterialExpressionParticleRelativeTime

UMaterialExpressionParticleSize

UMaterialExpressionParticleSpeed

UMaterialExpressionParticleSubUVProperties

UMaterialExpressionPathTracingQualitySwitch

UMaterialExpressionPerInstanceCustomData

UMaterialExpressionPerInstanceCustomData3Vector

UMaterialExpressionPerInstanceFadeAmount

UMaterialExpressionPerInstanceRandom

UMaterialExpressionPinBase

UMaterialExpressionPixelDepth

UMaterialExpressionPixelNormalWS

UMaterialExpressionPower

UMaterialExpressionPrecomputedAOMask

UMaterialExpressionPreSkinnedLocalBounds

UMaterialExpressionPreSkinnedNormal

UMaterialExpressionPreSkinnedPosition

UMaterialExpressionPreviousFrameSwitch

UMaterialExpressionQualitySwitch

UMaterialExpressionRayTracingQualitySwitch

UMaterialExpressionReflectionCapturePassSwitch

UMaterialExpressionReflectionVectorWS

UMaterialExpressionRerouteBase

UMaterialExpressionNamedRerouteBase

UMaterialExpressionNamedRerouteDeclaration

UMaterialExpressionNamedRerouteUsage

UMaterialExpressionReroute

UMaterialExpressionRotateAboutAxis

UMaterialExpressionRotator

UMaterialExpressionRound

UMaterialExpressionRuntimeVirtualTextureReplace

UMaterialExpressionRuntimeVirtualTextureSample

UMaterialExpressionRuntimeVirtualTextureSampleParameter

UMaterialExpressionSamplePhysicsIntegerField

UMaterialExpressionSamplePhysicsScalarField

UMaterialExpressionSamplePhysicsVectorField

UMaterialExpressionSaturate

UMaterialExpressionSceneColor

UMaterialExpressionSceneDepth

UMaterialExpressionSceneDepthWithoutWater

UMaterialExpressionSceneTexelSize

UMaterialExpressionSceneTexture

UMaterialExpressionScreenPosition

UMaterialExpressionSetLocal

UMaterialExpressionSetMaterialAttributes

UMaterialExpressionShaderStageSwitch

UMaterialExpressionShadingModel

UMaterialExpressionShadingPathSwitch

UMaterialExpressionShadowReplace

UMaterialExpressionSign

UMaterialExpressionSine

UMaterialExpressionSkyAtmosphereAerialPerspective

UMaterialExpressionSkyAtmosphereDistantLightScatteredLuminance

UMaterialExpressionSkyAtmosphereLightDirection

UMaterialExpressionSkyAtmosphereLightDiskLuminance

UMaterialExpressionSkyAtmosphereLightIlluminance

UMaterialExpressionSkyAtmosphereViewLuminance

UMaterialExpressionSkyLightEnvMapSample

UMaterialExpressionSmoothStep

UMaterialExpressionSobol

UMaterialExpressionSpeedTree

UMaterialExpressionSphereMask

UMaterialExpressionSphericalParticleOpacity

UMaterialExpressionSquareRoot

UMaterialExpressionStaticBool

UMaterialExpressionStaticSwitch

UMaterialExpressionStep

UMaterialExpressionStrataBSDF

UMaterialExpressionStrataAdd

UMaterialExpressionStrataHairBSDF

UMaterialExpressionStrataHorizontalMixing

UMaterialExpressionStrataLegacyConversion

UMaterialExpressionStrataSingleLayerWaterBSDF

UMaterialExpressionStrataSlabBSDF

UMaterialExpressionStrataTransmittanceToMFP

UMaterialExpressionStrataUnlitBSDF

UMaterialExpressionStrataVerticalLayering

UMaterialExpressionStrataVolumetricFogCloudBSDF

UMaterialExpressionStrataWeight

UMaterialExpressionSubtract

UMaterialExpressionTangent

UMaterialExpressionTemporalSobol

UMaterialExpressionTextureBase

UMaterialExpressionTextureObject

UMaterialExpressionTextureSample

UMaterialExpressionParticleSubUV

UMaterialExpressionTextureSampleParameter

UMaterialExpressionTextureObjectParameter

UMaterialExpressionTextureSampleParameter2D

PAPER2UMaterialExpressionSpriteTextureSampler

UMaterialExpressionAntialiasedTextureMask

UMaterialExpressionTextureSampleParameterSubUV

UMaterialExpressionTextureSampleParameter2DArray

UMaterialExpressionTextureSampleParameterCube

UMaterialExpressionTextureSampleParameterCubeArray

UMaterialExpressionTextureSampleParameterVolume

UMaterialExpressionTextureCoordinate

UMaterialExpressionTextureProperty

UMaterialExpressionTime

UMaterialExpressionTransform

UMaterialExpressionTransformPosition

UMaterialExpressionTruncate

UMaterialExpressionTwoSidedSign

UMaterialExpressionVectorNoise

UMaterialExpressionVertexColor

UMaterialExpressionVertexNormalWS

UMaterialExpressionVertexTangentWS

UMaterialExpressionViewProperty

UMaterialExpressionViewSize

UMaterialExpressionVirtualTextureFeatureSwitch

UMaterialExpressionVolumetricAdvancedMaterialInput

UMaterialExpressionWhileLoop

UMaterialExpressionWorldPosition

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Materials/MaterialExpression.h

Include

#include "Materials/MaterialExpression.h"

Syntax

class UMaterialExpression : public UObject

Variables

Name Description

Public variable

uint32: 1

 

bCollapsed

If true, show a collapsed version of the node

Public variable

uint32: 1

 

bCommentBubbleVisible

If true, the comment bubble will be visible in the graph editor

Public variable

uint32: 1

 

bHidePreviewWindow

If true, do not render the preview window for the expression

Public variable

uint8: 1

 

bIsParameterExpression

Indicates that this is a 'parameter' type of expression and should always be loaded (ie not cooked away) because we might want the default parameter.

Public variable

uint32: 1

 

bNeedToUpdatePreview

If true, we should update the preview next render. This is set when changing bRealtimePreview.

Public variable

uint32: 1

 

bRealtimePreview

Set to true by RecursiveUpdateRealtimePreview() if the expression's preview needs to be updated in realtime in the material editor.

Public variable

uint32: 1

 

bShaderInputData

Whether the node represents an input to the shader or not. Used to color the node's background.

Public variable

uint32: 1

 

bShowInputs

Whether to draw the expression's inputs.

Public variable

uint32: 1

 

bShowMaskColorsOnPin

If true, changes the pin color to match the output mask

Public variable

uint32: 1

 

bShowOutputNameOnPin

If true, use the output name as the label for the pin

Public variable

uint32: 1

 

bShowOutputs

Whether to draw the expression's outputs.

Public variable

FString

 

Desc

A description that level designers can add (shows in the material editor UI).

Public variable

TObjectPtr< cla...

 

Function

The material function that this expression is being used with, if any.

Public variable

TObjectPtr< UEd...

 

GraphNode

Expression's Graph representation

Public variable

FString

 

LastErrorText

Text of last error for this expression

Public variable

TObjectPtr< cla...

 

Material

The material that this expression is currently being compiled in.

Public variable

int32

 

MaterialExpressionEditorX

Public variable

int32

 

MaterialExpressionEditorY

Public variable

FGuid

 

MaterialExpressionGuid

GUID to uniquely identify this node, to help the tutorials out

Public variable

TArray< FText >

 

MenuCategories

Localized categories to sort this expression into...

Public variable

int32

 

NumExecutionInputs

Number of expressions connected to this expression's execution input

Public variable

TArray< FExpres...

 

Outputs

The expression's outputs, which are set in default properties by derived classes.

Public variable

TObjectPtr< UMa...

 

SubgraphExpression

If exists, expresssion containing this expression within its subgraph.

Constructors

Name Description

Public function

UMaterialExpression

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Virtual

bool

 

CanIgnoreOutputIndex()

If true, discards the output index when caching this expression which allows more cases to re-use the output instead of adding a separate instruction

Public function Virtual Const

bool

 

CanReferenceTexture()

Returns true if GetReferencedTexture() can ever return a valid pointer.

Public function Virtual Const

bool

 

CanRenameNode()

Can this node be renamed?

Public function Virtual Const

bool

 

CanUserDeleteExpression()

Public function Virtual

int32

 

Compile

(
    FMaterialCompiler* Compiler,
    int32 OutputIndex
)

Create the new shader code chunk needed for the Abs expression

Public function Virtual

int32

 

CompilePreview

(
    FMaterialCompiler* Compiler,
    int32 OutputIndex
)

Public function Virtual

int32

 

CompilerError

(
    FMaterialCompiler* Compiler,
    const TCHAR* pcMessage
)

Public function Virtual

void

 

ConnectExpression

(
    FExpressionInput* Input,
    int32 OutputIndex
)

Connects the specified input expression to the specified output of this expression.

Public function

void

 

ConnectToPreviewMaterial

(
    UMaterial* InMaterial,
    int32 OutputIndex
)

Connects the specified output to the passed material for previewing.

Public function

bool

 

ContainsInputLoop

(
    const bool bStopOnFunctionCall
)

Checks whether any inputs to this expression create a loop

Protected function

bool

 

ContainsInputLoopInternal

(
    TArray< class FMaterialExpressionKe...,
    TSet< class FMaterialExpressionKey ...,
    const bool bStopOnFunctionCall
)

Checks whether any inputs to this expression create a loop by recursively calling itself and keeping a list of inputs as expression keys.

Public function Static

void

 

CopyMaterialExpressions

(
    const TArray< class UMaterialExpres...,
    const TArray< class UMaterialExpres...,
    UMaterial* Material,
    UMaterialFunction* Function,
    TArray< class UMaterialExpression&...,
    TArray< class UMaterialExpression&...
)

Copy the SrcExpressions into the specified material, preserving internal references.

Public function Virtual

void

 

GatherStrataMaterialInfo

(
    FStrataMaterialInfo& StrataMateria...,
    int32 OutputIndex
)

Recursively parse nodes outputing strata material in order to gather all the possible shading models used in a material graph output a Strata material.

Public function Virtual

EMaterialGen...

 

GenerateHLSLExpression

(
    FMaterialHLSLGenerator& Generator,
    UE::HLSLTree::FScope& Scope,
    int32 OutputIndex,
    UE::HLSLTree::FExpression*& Ou...
)

Public function Virtual

EMaterialGen...

 

GenerateHLSLStatements

(
    FMaterialHLSLGenerator& Generator,
    UE::HLSLTree::FScope& Scope
)

A given UMaterial implementation should implement at least one of these methods in order to generate HLSL code It's valid to implement more than one, if the expression can be used in multiple ways.

Public function Virtual

EMaterialGen...

 

GenerateHLSLTexture

(
    FMaterialHLSLGenerator& Generator,
    UE::HLSLTree::FScope& Scope,
    int32 OutputIndex,
    UE::HLSLTree::FTextureParameterDecl...
)

Public function

bool

 

GetAllInputExpressions

(
    TArray< UMaterialExpression* >...
)

Recursively gets a list of all expressions that are connected to this Checks for repeats so that it can't end up in an infinite loop

Public function Const

UObject *...

 

GetAssetOwner()

Public function Const

FString

 

GetAssetPathName()

Public function Virtual Const

void

 

GetCaption

(
    TArray< FString >& OutCaptions
)

Returns the text to display on the material expression (in the material editor).

Public function Virtual

void

 

GetConnectorToolTip

(
    int32 InputIndex,
    int32 OutputIndex,
    TArray< FString >& OutToolTip
)

Get a tooltip for the specified connector.

Public function Virtual Const

FText

 

GetCreationDescription()

Public function Virtual Const

FText

 

GetCreationName()

Public function Virtual Const

FString

 

GetDescription()

Get a single line description of the material expression (used for lists)

Public function Virtual Const

FString

 

GetEditableName()

Returns the current 'name' of the node (typically a parameter name).

Public function Virtual

void

 

GetExecOutputs

Public function Virtual

void

 

GetExpressionToolTip

(
    TArray< FString >& OutToolTip
)

Get a tooltip for the expression itself.

Public function Virtual Const

int32

 

GetHeight()

Public function Virtual

FExpressionI...

 

GetInput

(
    int32 InputIndex
)

Public function Virtual Const

FName

 

GetInputName

(
    int32 InputIndex
)

Public function Virtual

const TArray...

 

GetInputs()

Public function Virtual

uint32

 

GetInputType

(
    int32 InputIndex
)

Public function Virtual Const

FText

 

GetKeywords()

Returns the keywords that should be used when searching for this expression

Public function Virtual

int

 

GetLabelPadding()

Returns the amount of padding to use for the label.

Public function Virtual Const

void

 

GetLandscapeLayerNames

(
    TArray< FName >& OutLayers
)

Public function Virtual

FGuid &

 

GetMaterialExpressionId()

Return the material expression guid.

Public function Virtual

TArray< FExp...

 

GetOutputs()

Get the outputs supported by this expression.

Public function Virtual

uint32

 

GetOutputType

(
    int32 OutputIndex
)

Public function Virtual

FGuid &

 

GetParameterExpressionId()

Callback to access derived classes' parameter expression id.

Public function Virtual Const

FName

 

GetParameterName()

Public function Const

EMaterialPar...

 

GetParameterType()

Public function Virtual Const

bool

 

GetParameterValue

(
    FMaterialParameterMetadata& OutMet...
)

Public function Virtual Const

FText

 

GetPreviewOverlayText()

Public function Virtual Const

UObject *...

 

GetReferencedTexture()

Callback to get any texture reference this expression emits.

Public function Virtual Const

void

 

GetTexturesForceMaterialRecompile

(
    TArray< UTexture* >& Textures
)

Fill the array with all textures dependence that should trig a recompile of the material.

Public function Virtual Const

int32

 

GetWidth()

Get the width required by this expression (in the material editor).

Public function Virtual Const

bool

 

HasAParameterName()

Parameter Name functions, this is requires as multiple class have ParameterName but are not UMaterialExpressionParameter due to class hierarchy.

Public function Virtual Const

bool

 

HasClassAndNameCollision

(
    UMaterialExpression* OtherExpr...
)

Public function Virtual Const

bool

 

HasConnectedOutputs()

Public function Virtual

bool

 

HasExecInput()

Public function Static

void

 

InitializeNumExecutionInputs

Public function Virtual

bool

 

IsExpressionConnected

(
    FExpressionInput* Input,
    int32 OutputIndex
)

Check if input exppresion is directly connected to the material.

Public function Virtual Const

bool

 

IsInputConnectionRequired

(
    int32 InputIndex
)

Public function Virtual

bool

 

IsResultMaterialAttributes

(
    int32 OutputIndex
)

Marks certain expression types as outputting material attributes.

Public function Virtual

bool

 

IsResultStrataMaterial

(
    int32 OutputIndex
)

Marks certain expression types as outputting Strata material.

Public function Virtual

bool

 

MatchesSearchQuery

(
    const TCHAR* SearchQuery
)

MatchesSearchQuery: Check this expression to see if it matches the search query

Public function Virtual

bool

 

NeedsRealtimePreview()

Public function Virtual

void

 

PostCopyNode

(
    const TArray< UMaterialExpression&...
)

Called after a node copy, once the Material and Function properties are set correctly and that all new expressions are added to Material->Expressions

Public function Virtual

void

 

SetEditableName

(
    const FString& NewName
)

Sets the current 'name' of the node (typically a parameter name) Only valid to call on a node that previously returned CanRenameNode() = true.

Public function Virtual

void

 

SetParameterName

(
    const FName& Name
)

Public function Virtual

bool

 

SetParameterValue

(
    const FName& Name,
    const FMaterialParameterMetadata& ...,
    EMaterialExpressionSetParameterValu...
)

Public function

void

 

UpdateMaterialExpressionGuid

(
    bool bForceGeneration,
    bool bAllowMarkingPackageDirty
)

Generates a GUID for this expression if one doesn't already exist.

Public function

void

 

UpdateParameterGuid

(
    bool bForceGeneration,
    bool bAllowMarkingPackageDirty
)

Generates a GUID for the parameter expression if one doesn't already exist and we are one.

Public function Virtual Const

bool

 

UsesLeftGutter()

Public function Virtual Const

bool

 

UsesRightGutter()

Public function Virtual

void

 

ValidateParameterName

(
    const bool bAllowDuplicateName
)

Public function

void

 

ValidateState()

Asserts if the expression is not contained by its Material or Function's expressions array.

Overridden from UObject

Name Description

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 Const

bool

 

HasNonEditorOnlyReferences()

Called during saving to determine if the object's references are used in game even when the object itself is never loaded outside the editor (because e.g. its references are followed during cooking)

Public function Virtual Const

bool

 

IsEditorOnly()

Called during saving to determine if the object is forced to be editor only or not

Public function Virtual

bool

 

Modify

(
    bool bAlwaysMarkDirty
)

That the object will be modified.

Public function Virtual

void

 

PostDuplicate

(
    bool bDuplicateForPIE
)

Called after duplication & serialization and before PostLoad.

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

 

Serialize

(
    FStructuredArchive::FRecord Record
)

Handles reading, writing, and reference collecting using FArchive.

Constants

Name

Description

CompileExecutionOutputIndex