UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SubstrateMaterialShared.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "SubstrateDefinitions.h"
8
9#include "SubstrateMaterialShared.generated.h"
10
11// Structures in this files are only used a compilation result return by the compiler.
12// They are also used to present material information in the editor UI.
13
14
27
28UENUM()
30{
31 None = 0u,
32 SSS = 1u<<0u,
33 MFPPluggedIn = 1u<<1u,
34 EdgeColor = 1u<<2u,
35 Fuzz = 1u<<3u,
37 Anisotropy = 1u<<5u,
38 Glint = 1u<<6u,
39 SpecularProfile = 1u<<7u,
40 Eye = 1u<<8u,
43 Hair = 1u<<11u,
44
45 // Complexity masks
46 SingleMask =
48 | Fuzz
49 | SSS
52
56 | Eye
57 | Hair,
58
60 Glint
61};
64
65// This must map to the SUBSTRATE_TILE_TYPE defines.
80
82
84{
85 // InMaterialType should be one of these
86 // * SUBSTRATE_MATERIAL_TYPE_SIMPLE
87 // * SUBSTRATE_MATERIAL_TYPE_SINGLE
88 // * SUBSTRATE_MATERIAL_TYPE_COMPLEX
89 // * SUBSTRATE_MATERIAL_TYPE_COMPLEX_SPECIAL
92}
93
98
103
105{
107public:
109
110 // !!!!!!!!!!
111 // Not using LAYOUT_BITFIELD_EDITORONLY because it seems to cause issue with bit being shifted around when copy happens.
112 // So in the meantime we find it out, LAYOUT_FIELD_EDITORONLY using uint8 is used.
113 // !!!!!!!!!!
114
117
118 LAYOUT_FIELD_EDITORONLY(int32, Index); // Index into the array of operators
119 LAYOUT_FIELD_EDITORONLY(int32, ParentIndex); // Parent operator index
120 LAYOUT_FIELD_EDITORONLY(int32, LeftIndex); // Left child operator index
121 LAYOUT_FIELD_EDITORONLY(int32, RightIndex); // Right child operator index
122 LAYOUT_FIELD_EDITORONLY(int32, ThicknessIndex); // Thickness expression index
123
124 // Data used for BSDF type nodes only
125 LAYOUT_FIELD_EDITORONLY(int32, BSDFIndex); // Index in the array of BSDF if a BSDF operator
129 LAYOUT_FIELD_EDITORONLY(uint8, SubUsage); // Sometimes, Unlit or Weight operators are used to transport data for other meaning (e.g. Light Function or ConvertToDecal)
131
134
135 // Data derived after the tree has been built.
140
141 LAYOUT_FIELD_EDITORONLY(uint8, bUseParameterBlending); // True when part of a sub tree where parameter blending is in use
142 LAYOUT_FIELD_EDITORONLY(uint8, bRootOfParameterBlendingSubTree);// True when the root of a sub tree where parameter blending is in use. Only this node will register a BSDF
143 LAYOUT_FIELD_EDITORONLY(FGuid, MaterialExpressionGuid); // Material expression Guid for mapping between UMaterialExpression and FSubstrateOperator
144
146
148
149 bool IsDiscarded() const;
150
152 {
153 #if WITH_EDITOR
154 return EnumHasAnyFlags(BSDFFeatures, In);
155 #else
156 return false;
157 #endif
158 }
159};
160
161#define SUBSTRATE_COMPILATION_OUTPUT_MAX_OPERATOR 24
162
163
164#define SUBSTRATE_MATERIAL_TYPE_SINGLESLAB 0
165#define SUBSTRATE_MATERIAL_TYPE_MULTIPLESLABS 1
166#define SUBSTRATE_MATERIAL_TYPE_VOLUMETRICFOGCLOUD 2
167#define SUBSTRATE_MATERIAL_TYPE_UNLIT 3
168#define SUBSTRATE_MATERIAL_TYPE_HAIR 4
169#define SUBSTRATE_MATERIAL_TYPE_SINGLELAYERWATER 5
170#define SUBSTRATE_MATERIAL_TYPE_EYE 6
171#define SUBSTRATE_MATERIAL_TYPE_LIGHTFUNCTION 7
172#define SUBSTRATE_MATERIAL_TYPE_POSTPROCESS 8
173#define SUBSTRATE_MATERIAL_TYPE_UI 9
174#define SUBSTRATE_MATERIAL_TYPE_DECAL 10
175
234
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define checkSlow(expr)
Definition AssertionMacros.h:332
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
#define DECLARE_INTRINSIC_TYPE_LAYOUT(T)
Definition MemoryLayout.h:760
#define UENUM(...)
Definition ObjectMacros.h:749
FORCEINLINE bool UsesSubstrateTileType(uint8 InTypes, ESubstrateTileType In)
Definition SubstrateMaterialShared.h:99
#define SUBSTRATE_COMPILATION_OUTPUT_MAX_OPERATOR
Definition SubstrateMaterialShared.h:161
ESubstrateTileType
Definition SubstrateMaterialShared.h:67
@ EOpaqueRoughRefractionSSSWithout
Definition SubstrateMaterialShared.h:74
@ EDecalSimple
Definition SubstrateMaterialShared.h:75
@ ECount
Definition SubstrateMaterialShared.h:78
@ ESimple
Definition SubstrateMaterialShared.h:68
@ EOpaqueRoughRefraction
Definition SubstrateMaterialShared.h:73
@ EComplexSpecial
Definition SubstrateMaterialShared.h:71
@ EDecalComplex
Definition SubstrateMaterialShared.h:77
@ EComplex
Definition SubstrateMaterialShared.h:70
@ EDecalSingle
Definition SubstrateMaterialShared.h:76
@ ESingle
Definition SubstrateMaterialShared.h:69
FORCEINLINE uint32 GetSubstrateTileTypeAsUint8(ESubstrateTileType In)
Definition SubstrateMaterialShared.h:94
FORCEINLINE ESubstrateTileType GetSubstrateTileTypeFromMaterialType(uint32 InMaterialType)
Definition SubstrateMaterialShared.h:83
ESubstrateBsdfFeature
Definition SubstrateMaterialShared.h:30
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition MemoryImage.h:743
FString ToString(uint16 Value)
Definition PathFollowingComponent.cpp:82
Definition SpecularProfile.h:91
U16 Index
Definition radfft.cpp:71
Definition Guid.h:109
Definition SubstrateMaterialShared.h:177
LAYOUT_FIELD_EDITORONLY(uint8, SharedLocalBasesCount)
LAYOUT_FIELD_EDITORONLY(uint8, PlatformClosurePixel)
LAYOUT_FIELD(uint8, SubstrateClosureCount)
LAYOUT_FIELD_EDITORONLY(uint8, RequestedBytePerPixel)
LAYOUT_FIELD_EDITORONLY(int8, RootOperatorIndex)
LAYOUT_FIELD(ESubstrateBsdfFeature, SubstrateMaterialBsdfFeatures)
LAYOUT_FIELD_EDITORONLY(uint8, PlatformBytePerPixel)
LAYOUT_FIELD_EDITORONLY(uint8, bMaterialOutOfBudgetHasBeenSimplified, 1)
LAYOUT_FIELD(uint8, SubstrateMaterialType)
LAYOUT_FIELD_EDITORONLY(uint8, RequestedClosurePerPixel)
DECLARE_TYPE_LAYOUT(FSubstrateMaterialCompilationOutput, NonVirtual)
LAYOUT_FIELD(uint8, SubstrateUintPerPixel)
FSubstrateMaterialCompilationOutput()
Definition SubstrateMaterialShared.cpp:10
LAYOUT_FIELD_EDITORONLY(uint8, MaterialType)
LAYOUT_FIELD_EDITORONLY(FMemoryImageString, SubstrateMaterialDescription)
LAYOUT_FIELD_EDITORONLY(uint8, bMaterialUsesLegacyGBufferDataPassThrough, 1)
LAYOUT_ARRAY_EDITORONLY(FSubstrateOperator, Operators, SUBSTRATE_COMPILATION_OUTPUT_MAX_OPERATOR)
Definition SubstrateMaterialShared.h:105
FSubstrateOperator()
Definition SubstrateMaterialShared.cpp:40
LAYOUT_FIELD_EDITORONLY(uint8, SubUsage)
LAYOUT_FIELD_EDITORONLY(int32, OperatorType)
LAYOUT_FIELD_EDITORONLY(uint8, bNodeRequestParameterBlending)
LAYOUT_FIELD_EDITORONLY(int32, BSDFIndex)
LAYOUT_FIELD_EDITORONLY(int32, ParentIndex)
LAYOUT_FIELD_EDITORONLY(uint8, SubSurfaceType)
LAYOUT_FIELD_EDITORONLY(int32, LeftIndex)
LAYOUT_FIELD_EDITORONLY(FSubstrateRegisteredSharedLocalBasis, BSDFRegisteredSharedLocalBasis)
LAYOUT_FIELD_EDITORONLY(uint8, bIsBottom)
bool Has(ESubstrateBsdfFeature In) const
Definition SubstrateMaterialShared.h:151
LAYOUT_FIELD_EDITORONLY(ESubstrateBsdfFeature, BSDFFeatures)
LAYOUT_FIELD_EDITORONLY(int32, MaxDistanceFromLeaves)
DECLARE_TYPE_LAYOUT(FSubstrateOperator, NonVirtual)
LAYOUT_FIELD_EDITORONLY(int32, RightIndex)
void CopyFlagsForParameterBlending(FSubstrateOperator &A)
Definition SubstrateMaterialShared.cpp:79
LAYOUT_FIELD_EDITORONLY(FGuid, MaterialExpressionGuid)
LAYOUT_FIELD_EDITORONLY(int32, LayerDepth)
LAYOUT_FIELD_EDITORONLY(uint8, bRootOfParameterBlendingSubTree)
bool IsDiscarded() const
Definition SubstrateMaterialShared.cpp:87
LAYOUT_FIELD_EDITORONLY(int32, BSDFType)
LAYOUT_FIELD_EDITORONLY(uint8, bBSDFWritesAmbientOcclusion)
LAYOUT_FIELD_EDITORONLY(int32, ThicknessIndex)
LAYOUT_FIELD_EDITORONLY(int32, Index)
LAYOUT_FIELD_EDITORONLY(uint8, bIsTop)
LAYOUT_FIELD_EDITORONLY(uint8, bBSDFWritesEmissive)
void CombineFlagsForParameterBlending(FSubstrateOperator &A, FSubstrateOperator &B)
Definition SubstrateMaterialShared.cpp:71
LAYOUT_FIELD_EDITORONLY(uint8, bUseParameterBlending)
Definition SubstrateMaterialShared.h:16
FSubstrateRegisteredSharedLocalBasis()
Definition SubstrateMaterialShared.cpp:98
DECLARE_TYPE_LAYOUT(FSubstrateRegisteredSharedLocalBasis, NonVirtual)
LAYOUT_FIELD_EDITORONLY(uint64, TangentCodeChunkHash)
LAYOUT_FIELD_EDITORONLY(int32, NormalCodeChunk)
LAYOUT_FIELD_EDITORONLY(uint64, NormalCodeChunkHash)
LAYOUT_FIELD_EDITORONLY(int32, TangentCodeChunk)
LAYOUT_FIELD_EDITORONLY(uint8, GraphSharedLocalBasisIndex)