UMaterialExpression

Windows
MacOS
Linux

Inheritance Hierarchy

UObjectBase

UObjectBaseUtility

UObject

UMaterialExpression

UMaterialExpressionAbs

UMaterialExpressionActorPositionWS

UMaterialExpressionAdd

UMaterialExpressionAppendVector

UMaterialExpressionArccosine

UMaterialExpressionArccosineFast

UMaterialExpressionArcsine

UMaterialExpressionArcsineFast

UMaterialExpressionArctangent

UMaterialExpressionArctangent2

UMaterialExpressionArctangent2Fast

UMaterialExpressionArctangentFast

UMaterialExpressionAtmosphericFogColor

UMaterialExpressionAtmosphericLightColor

UMaterialExpressionAtmosphericLightVector

UMaterialExpressionBlackBody

UMaterialExpressionBlendMaterialAttributes

UMaterialExpressionBreakMaterialAttributes

UMaterialExpressionBumpOffset

UMaterialExpressionCameraPositionWS

UMaterialExpressionCameraVectorWS

UMaterialExpressionCeil

UMaterialExpressionClamp

UMaterialExpressionCollectionParameter

UMaterialExpressionComment

UMaterialExpressionComponentMask

UMaterialExpressionConstant

UMaterialExpressionConstant2Vector

UMaterialExpressionConstant3Vector

UMaterialExpressionConstant4Vector

UMaterialExpressionConstantBiasScale

UMaterialExpressionCosine

UMaterialExpressionCrossProduct

UMaterialExpressionCustom

UMaterialExpressionCustomOutput

UMaterialExpressionBentNormalCustomOutput

UMaterialExpressionClearCoatNormalCustomOutput

UMaterialExpressionLandscapeGrassOutput

UMaterialExpressionRuntimeVirtualTextureOutput

UMaterialExpressionTangentOutput

UMaterialExpressionVertexInterpolator

UMaterialExpressionDDX

UMaterialExpressionDDY

UMaterialExpressionDecalDerivative

UMaterialExpressionDecalLifetimeOpacity

UMaterialExpressionDecalMipmapLevel

UMaterialExpressionDeltaTime

UMaterialExpressionDepthFade

UMaterialExpressionDepthOfFieldFunction

UMaterialExpressionDeriveNormalZ

UMaterialExpressionDesaturation

UMaterialExpressionDistance

UMaterialExpressionDistanceCullFade

UMaterialExpressionDistanceFieldGradient

UMaterialExpressionDistanceToNearestSurface

UMaterialExpressionDivide

UMaterialExpressionDotProduct

UMaterialExpressionDynamicParameter

UMaterialExpressionEyeAdaptation

UMaterialExpressionFeatureLevelSwitch

UMaterialExpressionFloor

UMaterialExpressionFmod

UMaterialExpressionFontSample

UMaterialExpressionFontSampleParameter

UMaterialExpressionFrac

UMaterialExpressionFresnel

UMaterialExpressionFunctionInput

UMaterialExpressionFunctionOutput

UMaterialExpressionMaterialLayerOutput

UMaterialExpressionGetMaterialAttributes

UMaterialExpressionGIReplace

UMaterialExpressionGoogleARCorePassthroughCamera

UMaterialExpressionIf

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

UMaterialExpressionScalarParameter

UMaterialExpressionCurveAtlasRowParameter

UMaterialExpressionStaticBoolParameter

UMaterialExpressionStaticSwitchParameter

UMaterialExpressionStaticComponentMaskParameter

UMaterialExpressionVectorParameter

UMaterialExpressionChannelMaskParameter

UMaterialExpressionParticleColor

UMaterialExpressionParticleDirection

UMaterialExpressionParticleMacroUV

UMaterialExpressionParticleMotionBlurFade

UMaterialExpressionParticlePositionWS

UMaterialExpressionParticleRadius

UMaterialExpressionParticleRandom

UMaterialExpressionParticleRelativeTime

UMaterialExpressionParticleSize

UMaterialExpressionParticleSpeed

UMaterialExpressionPerInstanceFadeAmount

UMaterialExpressionPerInstanceRandom

UMaterialExpressionPixelDepth

UMaterialExpressionPixelNormalWS

UMaterialExpressionPower

UMaterialExpressionPrecomputedAOMask

UMaterialExpressionPreSkinnedLocalBounds

UMaterialExpressionPreSkinnedNormal

UMaterialExpressionPreSkinnedPosition

UMaterialExpressionPreviousFrameSwitch

UMaterialExpressionQualitySwitch

UMaterialExpressionRayTracingQualitySwitch

UMaterialExpressionReflectionVectorWS

UMaterialExpressionReroute

UMaterialExpressionRotateAboutAxis

UMaterialExpressionRotator

UMaterialExpressionRound

UMaterialExpressionRuntimeVirtualTextureReplace

UMaterialExpressionRuntimeVirtualTextureSample

UMaterialExpressionSaturate

UMaterialExpressionSceneColor

UMaterialExpressionSceneDepth

UMaterialExpressionSceneTexelSize

UMaterialExpressionSceneTexture

UMaterialExpressionScreenPosition

UMaterialExpressionSetMaterialAttributes

UMaterialExpressionShadingModel

UMaterialExpressionShadingPathSwitch

UMaterialExpressionShadowReplace

UMaterialExpressionSign

UMaterialExpressionSine

UMaterialExpressionSobol

UMaterialExpressionSpeedTree

UMaterialExpressionSphereMask

UMaterialExpressionSphericalParticleOpacity

UMaterialExpressionSquareRoot

UMaterialExpressionStaticBool

UMaterialExpressionStaticSwitch

UMaterialExpressionSubtract

UMaterialExpressionTangent

UMaterialExpressionTemporalSobol

UMaterialExpressionTextureBase

UMaterialExpressionTextureObject

UMaterialExpressionTextureSample

UMaterialExpressionParticleSubUV

UMaterialExpressionTextureSampleParameter

UMaterialExpressionTextureObjectParameter

UMaterialExpressionTextureSampleParameter2D

PAPER2UMaterialExpressionSpriteTextureSampler

UMaterialExpressionAntialiasedTextureMask

UMaterialExpressionTextureSampleParameterSubUV

UMaterialExpressionTextureSampleParameterCube

UMaterialExpressionTextureSampleParameterVolume

UMaterialExpressionTextureCoordinate

UMaterialExpressionTextureProperty

UMaterialExpressionTime

UMaterialExpressionTransform

UMaterialExpressionTransformPosition

UMaterialExpressionTruncate

UMaterialExpressionTwoSidedSign

UMaterialExpressionVectorNoise

UMaterialExpressionVertexColor

UMaterialExpressionVertexNormalWS

UMaterialExpressionViewProperty

UMaterialExpressionViewSize

UMaterialExpressionVirtualTextureFeatureSwitch

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

uint32: 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

UMaterialFuncti...

 

Function

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

Public variable

UEdGraphNode &#...

 

GraphNode

Expression's Graph representation

Public variable

FString

 

LastErrorText

Text of last error for this expression

Public variable

UMaterial *

 

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

TArray< FExpres...

 

Outputs

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

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

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

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 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

 

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

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 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

 

IsInputConnectionRequired

(
    int32 InputIndex
)

Public function Virtual

bool

 

IsResultMaterialAttributes

(
    int32 OutputIndex
)

Marks certain expression types as outputting material attributes.

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

 

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

void

 

SetValueToMatchingExpression

(
    UMaterialExpression* OtherExpr...
)

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 UProperty* InProperty
)

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

Public function Virtual

bool

 

Modify

(
    bool bAlwaysMarkDirty
)

Note that the object will be modified.

Public function Virtual Const

bool

 

NeedsLoadForClient()

Called during saving to determine the load flags to save with the object.

Public function Virtual Const

bool

 

NeedsLoadForEditorGame()

Called during saving to include this object in client/servers running in editor builds, even if they wouldn't normally be.

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.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback