PredefinedSurfaceShaders
PredefinedSurfaceShaders
#Overview
name: PredefinedSurfaceShaders
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PredefinedSurfaceShaders is to store a mapping between predefined MaterialX surface shaders and their corresponding asset paths in Unreal Engine 5. This variable is part of the MaterialX pipeline settings, which is used for importing and processing MaterialX files in Unreal Engine.
This setting variable is primarily used by the Interchange system, specifically within the MaterialX pipeline. It’s referenced in the Interchange Editor plugin and the Interchange Runtime module.
The value of this variable is set in the UMaterialXPipelineSettings class, which inherits from UDeveloperSettings. It’s defined as a TMap that associates EInterchangeMaterialXShaders enum values with FSoftObjectPath objects.
PredefinedSurfaceShaders interacts with other similar variables like PredefinedBSDF, PredefinedEDF, and PredefinedVDF, which together form a set of predefined shader mappings for different MaterialX shader types.
Developers should be aware that:
- This variable is used to map MaterialX shader types to corresponding Unreal Engine assets.
- It’s part of the configuration for the MaterialX import pipeline.
- The variable is used in the process of loading required packages for the MaterialX pipeline.
Best practices when using this variable include:
- Ensure that the mapped asset paths are valid and point to appropriate shader assets.
- Keep the predefined shader mappings up-to-date with any changes in the MaterialX standard or Unreal Engine’s shader system.
- When customizing the MaterialX import process, consider how changes to this variable might affect the overall pipeline.
- Use the provided customization functions (like CustomizeDetails) when modifying these settings in the editor.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Plugins/Interchange/Runtime/Config/BaseInterchange.ini:61, section: [/Script/InterchangePipelines.MaterialXPipelineSettings]
- INI Section:
/Script/InterchangePipelines.MaterialXPipelineSettings
- Raw value:
((OpenPBRSurface, "/Interchange/Functions/MX_OpenPBR_Opaque.MX_OpenPBR_Opaque"),(OpenPBRSurfaceTransmission, "/Interchange/Functions/MX_OpenPBR_Translucent.MX_OpenPBR_Translucent"),(StandardSurface, "/Interchange/Functions/MX_StandardSurface.MX_StandardSurface"),(StandardSurfaceTransmission, "/Interchange/Functions/MX_TransmissionSurface.MX_TransmissionSurface"),(SurfaceUnlit, "/Interchange/Functions/MX_SurfaceUnlit.MX_SurfaceUnlit"),(UsdPreviewSurface, "/Interchange/Functions/MX_UsdPreviewSurface.MX_UsdPreviewSurface"),(Surface, "/Interchange/Functions/MX_Surface.MX_Surface"))
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Interchange/Editor/Source/Pipelines/Private/InterchangeMaterialXPipelineCustomizations.cpp:123
Scope (from outer to inner):
file
function void FInterchangeMaterialXPipelineSettingsCustomization::CustomizeDetails
Source code excerpt:
};
Customize(GET_MEMBER_NAME_CHECKED(UMaterialXPipelineSettings, PredefinedSurfaceShaders),
TEXT("MaterialXPredefined | Surface Shaders"),
NSLOCTEXT("InterchangeMaterialXPipelineSettingsCustomization", "MaterialXPredefined | SurfaceShaders", "Surface Shaders"),
UE::Interchange::MaterialX::IndexSurfaceShaders);
Customize(GET_MEMBER_NAME_CHECKED(UMaterialXPipelineSettings, PredefinedBSDF),
TEXT("MaterialXPredefined | BSDF"),
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:661
Scope (from outer to inner):
file
function UInterchangeMaterialXPipeline::UInterchangeMaterialXPipeline
Source code excerpt:
for (const TPair<EInterchangeMaterialXShaders, FSoftObjectPath>& Entry : MaterialXSettings->PredefinedSurfaceShaders)
{
PathToEnumMapping.FindOrAdd(Entry.Value.GetAssetPathString(), EInterchangeMaterialXSettings{ TInPlaceType<EInterchangeMaterialXShaders>{}, Entry.Key });
}
for(const TPair<EInterchangeMaterialXBSDF, FSoftObjectPath>& Entry : MaterialXSettings->PredefinedBSDF)
{
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:792
Scope (from outer to inner):
file
function bool UMaterialXPipelineSettings::AreRequiredPackagesLoaded
Source code excerpt:
};
return ArePackagesLoaded(PredefinedSurfaceShaders) && ArePackagesLoaded(PredefinedBSDF) && ArePackagesLoaded(PredefinedEDF) && ArePackagesLoaded(PredefinedVDF);
}
#if WITH_EDITOR
void UMaterialXPipelineSettings::InitPredefinedAssets()
{
if(bIsSubstrateEnabled)
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:836
Scope (from outer to inner):
file
function void UMaterialXPipelineSettings::InitPredefinedAssets
Source code excerpt:
if(ShadersSettings.IsType<EInterchangeMaterialXShaders>())
{
PredefinedSurfaceShaders.Add(ShadersSettings.Get<EInterchangeMaterialXShaders>(), FSoftObjectPath{ Mapping.Get<2>() });
}
else if(ShadersSettings.IsType<EInterchangeMaterialXBSDF>())
{
PredefinedBSDF.Add(ShadersSettings.Get<EInterchangeMaterialXBSDF>(), FSoftObjectPath{ Mapping.Get<2>() });
}
else if(ShadersSettings.IsType<EInterchangeMaterialXEDF>())
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:870
Scope (from outer to inner):
file
function FString UMaterialXPipelineSettings::GetAssetPathString
Source code excerpt:
if(EnumValue.IsType<EInterchangeMaterialXShaders>())
{
return FindAssetPathString(PredefinedSurfaceShaders, EnumValue.Get<EInterchangeMaterialXShaders>());
}
else if(EnumValue.IsType<EInterchangeMaterialXBSDF>())
{
return FindAssetPathString(PredefinedBSDF, EnumValue.Get<EInterchangeMaterialXBSDF>());
}
else if(EnumValue.IsType<EInterchangeMaterialXEDF>())
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Public/InterchangeMaterialXPipeline.h:46
Scope (from outer to inner):
file
class class UMaterialXPipelineSettings : public UDeveloperSettings
Source code excerpt:
UPROPERTY(EditAnywhere, config, Category = "MaterialXPredefined | Surface Shaders", meta = (DisplayName = "MaterialX Predefined Surface Shaders"))
TMap<EInterchangeMaterialXShaders, FSoftObjectPath> PredefinedSurfaceShaders;
UPROPERTY(EditAnywhere, config, Category = "MaterialXPredefined | BSDF", meta = (DisplayName = "MaterialX Predefined BSDF"))
TMap<EInterchangeMaterialXBSDF, FSoftObjectPath> PredefinedBSDF;
UPROPERTY(EditAnywhere, config, Category = "MaterialXPredefined | EDF", meta = (DisplayName = "MaterialX Predefined EDF"))
TMap<EInterchangeMaterialXEDF, FSoftObjectPath> PredefinedEDF;