PredefinedBSDF
PredefinedBSDF
#Overview
name: PredefinedBSDF
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 PredefinedBSDF is to store a mapping between Bidirectional Scattering Distribution Functions (BSDF) types and their corresponding asset paths in the MaterialX pipeline settings for Unreal Engine 5.
This setting variable is primarily used in the Interchange system, specifically within the MaterialX pipeline. It is part of the UMaterialXPipelineSettings class, which is derived from UDeveloperSettings. The Interchange system is responsible for importing and processing various asset types, including materials.
The value of this variable is set in the UMaterialXPipelineSettings::InitPredefinedAssets() function. It populates the PredefinedBSDF map with EInterchangeMaterialXBSDF enum values as keys and FSoftObjectPath objects as values.
PredefinedBSDF interacts with other similar variables such as PredefinedSurfaceShaders, PredefinedEDF, and PredefinedVDF. These variables collectively represent different aspects of material definitions in the MaterialX pipeline.
Developers must be aware that:
- This variable is part of the configuration settings for the MaterialX pipeline.
- It’s used to map BSDF types to specific asset paths.
- The variable is used in both editor and runtime contexts.
Best practices when using this variable include:
- Ensuring that all required packages are loaded before using the MaterialX pipeline (check AreRequiredPackagesLoaded() function).
- When customizing the MaterialX pipeline settings, use the appropriate Customize() function to modify this variable.
- Be cautious when modifying the predefined mappings, as they may affect the behavior of the MaterialX import process.
- When accessing asset paths, use the GetAssetPathString() function, which handles different predefined asset types, including BSDF.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Plugins/Interchange/Runtime/Config/BaseInterchange.ini:62, section: [/Script/InterchangePipelines.MaterialXPipelineSettings]
- INI Section:
/Script/InterchangePipelines.MaterialXPipelineSettings
- Raw value:
((OrenNayarDiffuse, "/Interchange/Functions/MX_OrenNayarBSDF.MX_OrenNayarBSDF"),(BurleyDiffuse,"/Interchange/Functions/MX_BurleyDiffuseBSDF.MX_BurleyDiffuseBSDF"),(Translucent,"/Interchange/Functions/MX_TranslucentBSDF.MX_TranslucentBSDF"),(Dielectric,"/Interchange/Functions/MX_DielectricBSDF.MX_DielectricBSDF"),(Conductor,"/Interchange/Functions/MX_ConductorBSDF.MX_ConductorBSDF"),(GeneralizedSchlick,"/Interchange/Functions/MX_GeneralizedSchlickBSDF.MX_GeneralizedSchlickBSDF"),(Subsurface,"/Interchange/Functions/MX_SubsurfaceBSDF.MX_SubsurfaceBSDF"),(Sheen,"/Interchange/Functions/MX_SheenBSDF.MX_SheenBSDF"),(ThinFilm,"/Interchange/Functions/MX_ThinFilmBSDF.MX_ThinFilmBSDF"))
- 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:128
Scope (from outer to inner):
file
function void FInterchangeMaterialXPipelineSettingsCustomization::CustomizeDetails
Source code excerpt:
UE::Interchange::MaterialX::IndexSurfaceShaders);
Customize(GET_MEMBER_NAME_CHECKED(UMaterialXPipelineSettings, PredefinedBSDF),
TEXT("MaterialXPredefined | BSDF"),
NSLOCTEXT("InterchangeMaterialXPipelineSettingsCustomization", "MaterialXPredefined | BSDF", "Bidirectional Scattering Distribution Functions"),
UE::Interchange::MaterialX::IndexBSDF);
Customize(GET_MEMBER_NAME_CHECKED(UMaterialXPipelineSettings, PredefinedEDF),
TEXT("MaterialXPredefined | EDF"),
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:666
Scope (from outer to inner):
file
function UInterchangeMaterialXPipeline::UInterchangeMaterialXPipeline
Source code excerpt:
}
for(const TPair<EInterchangeMaterialXBSDF, FSoftObjectPath>& Entry : MaterialXSettings->PredefinedBSDF)
{
PathToEnumMapping.FindOrAdd(Entry.Value.GetAssetPathString(), EInterchangeMaterialXSettings{ TInPlaceType<EInterchangeMaterialXBSDF>{}, Entry.Key });
}
for(const TPair<EInterchangeMaterialXEDF, FSoftObjectPath>& Entry : MaterialXSettings->PredefinedEDF)
{
#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:840
Scope (from outer to inner):
file
function void UMaterialXPipelineSettings::InitPredefinedAssets
Source code excerpt:
else if(ShadersSettings.IsType<EInterchangeMaterialXBSDF>())
{
PredefinedBSDF.Add(ShadersSettings.Get<EInterchangeMaterialXBSDF>(), FSoftObjectPath{ Mapping.Get<2>() });
}
else if(ShadersSettings.IsType<EInterchangeMaterialXEDF>())
{
PredefinedEDF.Add(ShadersSettings.Get<EInterchangeMaterialXEDF>(), FSoftObjectPath{ Mapping.Get<2>() });
}
else if(ShadersSettings.IsType<EInterchangeMaterialXVDF>())
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangeMaterialXPipeline.cpp:874
Scope (from outer to inner):
file
function FString UMaterialXPipelineSettings::GetAssetPathString
Source code excerpt:
else if(EnumValue.IsType<EInterchangeMaterialXBSDF>())
{
return FindAssetPathString(PredefinedBSDF, EnumValue.Get<EInterchangeMaterialXBSDF>());
}
else if(EnumValue.IsType<EInterchangeMaterialXEDF>())
{
return FindAssetPathString(PredefinedEDF, EnumValue.Get<EInterchangeMaterialXEDF>());
}
else if(EnumValue.IsType<EInterchangeMaterialXVDF>())
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Public/InterchangeMaterialXPipeline.h:49
Scope (from outer to inner):
file
class class UMaterialXPipelineSettings : public UDeveloperSettings
Source code excerpt:
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;
UPROPERTY(EditAnywhere, config, Category = "MaterialXPredefined | VDF", meta = (DisplayName = "MaterialX Predefined VDF"))
TMap<EInterchangeMaterialXVDF, FSoftObjectPath> PredefinedVDF;