ShowFlag.PhysicalMaterialMasks
ShowFlag.PhysicalMaterialMasks
#Overview
name: ShowFlag.PhysicalMaterialMasks
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.PhysicalMaterialMasks is to control the visibility of physical material masks in the Unreal Engine 5 rendering system. This setting is primarily used for debugging and visualization purposes in the editor.
ShowFlag.PhysicalMaterialMasks is primarily used in the Engine and Editor subsystems, specifically in the StaticMeshEditor and rendering components. It’s also referenced in the CableComponent plugin.
The value of this variable is typically set through the engine show flags system, which allows toggling various rendering features on and off. It can be controlled via the editor UI or programmatically.
This variable interacts closely with EngineShowFlags.PhysicalMaterialMasks, which is the actual boolean flag that controls the visibility. They share the same value and are often used interchangeably in the code.
Developers should be aware that this flag is primarily intended for editor and debugging use. It’s not available in shipping builds, as indicated by the SHOWFLAG_FIXED_IN_SHIPPING macro.
Best practices when using this variable include:
- Only enable it when specifically debugging or visualizing physical material masks.
- Be aware that enabling this flag may impact rendering performance.
- Use it in conjunction with other related show flags (like VertexColors) for comprehensive debugging.
Regarding the associated variable PhysicalMaterialMasks:
The purpose of PhysicalMaterialMasks is to represent the actual physical material masks data used in the rendering and physics systems. It’s used to define surface properties for complex materials in static meshes and other renderable objects.
This variable is used across multiple engine subsystems, including the physics engine, rendering system, and editor tools.
The values for PhysicalMaterialMasks are typically set when defining materials for objects, either through the editor or programmatically.
It interacts with various other systems, including the physics simulation (for surface properties) and the rendering system (for visualization).
Developers should be aware that PhysicalMaterialMasks can significantly impact both visual fidelity and physics simulation accuracy. They should be used judiciously and optimized for performance.
Best practices for using PhysicalMaterialMasks include:
- Carefully plan and design your physical materials to balance realism and performance.
- Use the visualization tools (enabled by ShowFlag.PhysicalMaterialMasks) to debug and refine your material setups.
- Consider the performance implications, especially for complex scenes or mobile platforms.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:105
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VertexColors, SFG_Advanced, NSLOCTEXT("UnrealEd", "VertexColorsSF", "Vertex Colors"))
/** Show Physical Material Masks */
SHOWFLAG_FIXED_IN_SHIPPING(0, PhysicalMaterialMasks, SFG_Advanced, NSLOCTEXT("UnrealEd", "PhysicalMaterialMasksSF", "Physical Material Masks"))
/** Render Post process (screen space) distortion/refraction */
SHOWFLAG_FIXED_IN_SHIPPING(1, Refraction, SFG_Developer, NSLOCTEXT("UnrealEd", "RefractionSF", "Refraction"))
/** Usually set in game or when previewing cinematics but not in editor, used for motion blur or any kind of rendering features that rely on the former frame */
SHOWFLAG_ALWAYS_ACCESSIBLE(CameraInterpolation, SFG_Hidden, NSLOCTEXT("UnrealEd", "CameraInterpolationSF", "Camera Interpolation"))
/** Post processing color fringe (chromatic aberration) */
SHOWFLAG_FIXED_IN_SHIPPING(1, SceneColorFringe, SFG_PostProcess, NSLOCTEXT("UnrealEd", "SceneColorFringeSF", "Scene Color Fringe"))
#Associated Variable and Callsites
This variable is associated with another variable named PhysicalMaterialMasks
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/CableComponent/Source/CableComponent/Private/CableComponent.cpp:426
Scope (from outer to inner):
file
function class FCableSceneProxy final : public FPrimitiveSceneProxy { public: SIZE_T GetTypeHash
class class FCableSceneProxy final : public FPrimitiveSceneProxy
function virtual FPrimitiveViewRelevance GetViewRelevance
Source code excerpt:
#if WITH_EDITOR
(IsSelected() && View->Family->EngineShowFlags.VertexColors) ||
(IsSelected() && View->Family->EngineShowFlags.PhysicalMaterialMasks) ||
#endif
// Force down dynamic rendering path if invalid lightmap settings, so we can apply an error material in DrawRichMesh
(bAllowStaticLighting && HasStaticLighting() && !HasValidSettingsForStaticLighting()) ||
HasViewDependentDPG()
)
{
#Loc: <Workspace>/Engine/Source/Editor/StaticMeshEditor/Private/SStaticMeshEditorViewport.cpp:344
Scope (from outer to inner):
file
function void SStaticMeshEditorViewport::UpdatePreviewMesh
Source code excerpt:
EditorViewportClient->SetPreviewMesh(InStaticMesh, PreviewMeshComponent, bResetCamera);
if (EditorViewportClient->EngineShowFlags.PhysicalMaterialMasks)
{
//Reapply the physical material masks mode on the newly set static mesh.
SetViewModePhysicalMaterialMasksImplementation(true);
}
else if (EditorViewportClient->EngineShowFlags.VertexColors)
{
#Loc: <Workspace>/Engine/Source/Editor/StaticMeshEditor/Private/SStaticMeshEditorViewport.cpp:434
Scope (from outer to inner):
file
function void SStaticMeshEditorViewport::SetViewModePhysicalMaterialMasks
Source code excerpt:
void SStaticMeshEditorViewport::SetViewModePhysicalMaterialMasks()
{
SetViewModePhysicalMaterialMasksImplementation(!EditorViewportClient->EngineShowFlags.PhysicalMaterialMasks);
if (FEngineAnalytics::IsAvailable())
{
FEngineAnalytics::GetProvider().RecordEvent(TEXT("Editor.Usage.StaticMesh.Toolbar"), FAnalyticsEventAttribute(TEXT("PhysicalMaterialMasks"), static_cast<int>(EditorViewportClient->EngineShowFlags.PhysicalMaterialMasks)));
}
}
void SStaticMeshEditorViewport::SetViewModePhysicalMaterialMasksImplementation(bool bValue)
{
SetViewModePhysicalMaterialMasksSubImplementation(bValue);
#Loc: <Workspace>/Engine/Source/Editor/StaticMeshEditor/Private/SStaticMeshEditorViewport.cpp:464
Scope (from outer to inner):
file
function bool SStaticMeshEditorViewport::IsInViewModePhysicalMaterialMasksChecked
Source code excerpt:
bool SStaticMeshEditorViewport::IsInViewModePhysicalMaterialMasksChecked() const
{
return EditorViewportClient->EngineShowFlags.PhysicalMaterialMasks;
}
void SStaticMeshEditorViewport::ForceLODLevel(int32 InForcedLOD)
{
PreviewMeshComponent->ForcedLodModel = InForcedLOD;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Editor.cpp:989
Scope (from outer to inner):
file
function FReimportManager::FReimportManager
Source code excerpt:
UReimportFbxSceneFactory::StaticClass();
// Create reimport handler for PhysicalMaterialMasks
UPhysicalMaterialMaskFactory::StaticClass();
UInterchangeManager& InterchangeManager = UInterchangeManager::GetInterchangeManager();
InterchangePostReimportedDelegateHandle = InterchangeManager.OnAssetPostReimport.AddRaw(this, &FReimportManager::OnInterchangePostReimported);
InterchangeManager.OnPreDestroyInterchangeManager.AddLambda([InterchangePostReimportedDelegateHandleClosure = InterchangePostReimportedDelegateHandle]()
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/PhysicsEngine/BodyInstance.h:764
Scope: file
Source code excerpt:
ENGINE_API TArray<UPhysicalMaterial*> GetComplexPhysicalMaterials() const;
/** Get the complex PhysicalMaterials and PhysicalMaterialMasks array for this body */
ENGINE_API TArray<UPhysicalMaterial*> GetComplexPhysicalMaterials(TArray<FPhysicalMaterialMaskParams>& OutPhysMaterialMasks) const;
/** Get the complex PhysicalMaterials for this body */
ENGINE_API void GetComplexPhysicalMaterials(TArray<UPhysicalMaterial*> &OutPhysMaterials) const;
/** Get the complex PhysicalMaterials and PhysicalMaterialMasks for this body */
ENGINE_API void GetComplexPhysicalMaterials(TArray<UPhysicalMaterial*> &OutPhysMaterials, TArray<FPhysicalMaterialMaskParams>& OutPhysMaterialMasks) const;
/** Find the correct PhysicalMaterial and PhysicalMaterialMasks for complex geometry on a given body and owner. This is really for internal use during serialization */
static ENGINE_API void GetComplexPhysicalMaterials(const FBodyInstance* BodyInstance, TWeakObjectPtr<UPrimitiveComponent> Owner, TArray<UPhysicalMaterial*>& OutPhysMaterials, TArray<FPhysicalMaterialMaskParams>* OutPhysMaterialMasks = nullptr);
/** Returns the slope override struct for this instance. If we don't have our own custom setting, it will return the setting from the body setup. */
ENGINE_API const struct FWalkableSlopeOverride& GetWalkableSlopeOverride() const;
/** Sets a custom slope override struct for this instance. Implicitly sets bOverrideWalkableSlopeOnInstance to true. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshRender.cpp:1563
Scope: file
Source code excerpt:
#if WITH_EDITOR
if (bProxyIsSelected && EngineShowFlags.PhysicalMaterialMasks && AllowDebugViewmodes())
{
// Override the mesh's material with our material that draws the physical material masks
UMaterial* PhysMatMaskVisualizationMaterial = GEngine->PhysicalMaterialMaskMaterial;
check(PhysMatMaskVisualizationMaterial);
FMaterialRenderProxy* PhysMatMaskVisualizationMaterialInstance = nullptr;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshRender.cpp:2082
Scope (from outer to inner):
file
function FPrimitiveViewRelevance FStaticMeshSceneProxy::GetViewRelevance
Source code excerpt:
#if WITH_EDITOR
(IsSelected() && View->Family->EngineShowFlags.VertexColors) ||
(IsSelected() && View->Family->EngineShowFlags.PhysicalMaterialMasks) ||
#endif
#if STATICMESH_ENABLE_DEBUG_RENDERING
bDrawMeshCollisionIfComplex ||
bDrawMeshCollisionIfSimple ||
#endif
// Force down dynamic rendering path if invalid lightmap settings, so we can apply an error material in DrawRichMesh
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:105
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VertexColors, SFG_Advanced, NSLOCTEXT("UnrealEd", "VertexColorsSF", "Vertex Colors"))
/** Show Physical Material Masks */
SHOWFLAG_FIXED_IN_SHIPPING(0, PhysicalMaterialMasks, SFG_Advanced, NSLOCTEXT("UnrealEd", "PhysicalMaterialMasksSF", "Physical Material Masks"))
/** Render Post process (screen space) distortion/refraction */
SHOWFLAG_FIXED_IN_SHIPPING(1, Refraction, SFG_Developer, NSLOCTEXT("UnrealEd", "RefractionSF", "Refraction"))
/** Usually set in game or when previewing cinematics but not in editor, used for motion blur or any kind of rendering features that rely on the former frame */
SHOWFLAG_ALWAYS_ACCESSIBLE(CameraInterpolation, SFG_Hidden, NSLOCTEXT("UnrealEd", "CameraInterpolationSF", "Camera Interpolation"))
/** Post processing color fringe (chromatic aberration) */
SHOWFLAG_FIXED_IN_SHIPPING(1, SceneColorFringe, SFG_PostProcess, NSLOCTEXT("UnrealEd", "SceneColorFringeSF", "Scene Color Fringe"))