r.Shadow.TranslucentPerObject.ProjectEnabled
r.Shadow.TranslucentPerObject.ProjectEnabled
#Overview
name: r.Shadow.TranslucentPerObject.ProjectEnabled
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable/Disable translucency shadows on a per-project basis. Turning off can significantly reduce the number of permutations if your project has many translucent materials.\n
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.TranslucentPerObject.ProjectEnabled is to control the enabling or disabling of translucency shadows on a per-project basis in Unreal Engine 5. This setting is primarily related to the rendering system, specifically for shadow rendering of translucent objects.
This setting variable is utilized by the rendering subsystem of Unreal Engine 5, particularly in the RenderCore and Engine modules. It affects how shadows are cast by translucent objects in the game world.
The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef in the RenderUtils.cpp file. It can be modified in the project’s configuration files or through the console during runtime.
The associated variable GAllowTranslucencyShadowsInProject directly interacts with r.Shadow.TranslucentPerObject.ProjectEnabled. They share the same value and are used interchangeably in the code.
Developers must be aware that:
- This setting significantly impacts performance and the number of shader permutations, especially in projects with many translucent materials.
- When disabled (set to 0), it prevents the use of translucency shadows for all objects in the project.
- Changing this setting may require recompilation of shaders.
Best practices when using this variable include:
- Consider the performance impact carefully before enabling it for projects with many translucent materials.
- If translucency shadows are not needed in your project, keep it disabled to reduce shader permutations and improve performance.
- When enabled, use it judiciously and optimize translucent materials to minimize the performance impact.
Regarding the associated variable GAllowTranslucencyShadowsInProject:
- Its purpose is to provide a C++ accessible equivalent to the console variable r.Shadow.TranslucentPerObject.ProjectEnabled.
- It is used in the RenderCore module to determine if translucency shadows are allowed for the current project.
- The value is set through the console variable system and can be accessed in C++ code.
- Developers should use this variable when they need to check the state of translucency shadows in C++ code, particularly in rendering-related functions.
- Best practice is to use this variable for conditional logic in rendering code that deals with translucent shadow casting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:35
Scope: file
Source code excerpt:
int32 GAllowTranslucencyShadowsInProject = 0;
FAutoConsoleVariableRef CVarAllowTranslucencyShadowsInProject(
TEXT("r.Shadow.TranslucentPerObject.ProjectEnabled"),
GAllowTranslucencyShadowsInProject,
TEXT("Enable/Disable translucency shadows on a per-project basis. Turning off can significantly reduce the number of permutations if your project has many translucent materials.\n"),
ECVF_ReadOnly | ECVF_RenderThreadSafe
);
int32 GRayTracingEnableInGame = 1;
#Loc: <Workspace>/Engine/Source/Runtime/Core/Public/Misc/MapErrors.h:149
Scope: file
Source code excerpt:
static CORE_API FLazyName StaticComponentHasInvalidLightmapSettings;
/** Component is a using CastVolumetricTranslucentShadow but this feature is disabled for the project! Turn on r.Shadow.TranslucentPerObject.ProjectEnabled in a project ini if required. */
static CORE_API FLazyName PrimitiveComponentHasInvalidTranslucentShadowSetting;
/** bUseFauxOrthoViewPos has been deprecated. Property will be lost on re-save. */
static CORE_API FLazyName UseFauxOrthoViewPosDeprecation_Warning;
/** Navigation */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/PrimitiveComponent.cpp:1324
Scope (from outer to inner):
file
function void UPrimitiveComponent::CheckForErrors
Source code excerpt:
}
static const auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.TranslucentPerObject.ProjectEnabled"));
if (bCastVolumetricTranslucentShadow && CastShadow && bCastDynamicShadow && CVar && CVar->GetInt() == 0)
{
FMessageLog("MapCheck").Warning()
->AddToken(FUObjectToken::Create(Owner))
->AddToken(FTextToken::Create(LOCTEXT( "MapCheck_Message_NoTranslucentShadowSupport", "Component is a using CastVolumetricTranslucentShadow but this feature is disabled for the project! Turn on r.Shadow.TranslucentPerObject.ProjectEnabled in a project ini if required." )))
->AddToken(FMapErrorToken::Create(FMapErrors::PrimitiveComponentHasInvalidTranslucentShadowSetting));
}
}
void UPrimitiveComponent::GetActorDescProperties(FPropertyPairsMap& PropertyPairsMap) const
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:3943
Scope (from outer to inner):
file
function void UParticleSystemComponent::CheckForErrors
Source code excerpt:
}
static const auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.TranslucentPerObject.ProjectEnabled"));
if (bCastVolumetricTranslucentShadow && CastShadow && bCastDynamicShadow && CVar && CVar->GetInt() == 0)
{
FMessageLog("MapCheck").Warning()
->AddToken(FUObjectToken::Create(this))
->AddToken(FTextToken::Create(LOCTEXT("MapCheck_Message_NoTranslucentShadowSupport", "Component is a using CastVolumetricTranslucentShadow but this feature is disabled for the project! Turn on r.Shadow.TranslucentPerObject.ProjectEnabled in a project ini if required.")))
->AddToken(FMapErrorToken::Create(FMapErrors::PrimitiveComponentHasInvalidTranslucentShadowSetting));
}
}
#endif
void UParticleSystemComponent::PostLoad()
#Associated Variable and Callsites
This variable is associated with another variable named GAllowTranslucencyShadowsInProject
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:33
Scope: file
Source code excerpt:
);
int32 GAllowTranslucencyShadowsInProject = 0;
FAutoConsoleVariableRef CVarAllowTranslucencyShadowsInProject(
TEXT("r.Shadow.TranslucentPerObject.ProjectEnabled"),
GAllowTranslucencyShadowsInProject,
TEXT("Enable/Disable translucency shadows on a per-project basis. Turning off can significantly reduce the number of permutations if your project has many translucent materials.\n"),
ECVF_ReadOnly | ECVF_RenderThreadSafe
);
int32 GRayTracingEnableInGame = 1;
FAutoConsoleVariableRef CVarRayTracingEnableInGame(
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1551
Scope (from outer to inner):
file
function bool AllowTranslucencyPerObjectShadows
Source code excerpt:
RENDERCORE_API bool AllowTranslucencyPerObjectShadows(const FStaticShaderPlatform Platform)
{
return IsFeatureLevelSupported(Platform, ERHIFeatureLevel::SM5) && GAllowTranslucencyShadowsInProject != 0;
}
bool PlatformRequires128bitRT(EPixelFormat PixelFormat)
{
switch (PixelFormat)
{