r.RayTracing.Geometry.NiagaraMeshes
r.RayTracing.Geometry.NiagaraMeshes
#Overview
name: r.RayTracing.Geometry.NiagaraMeshes
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Include Niagara meshes in ray tracing effects (default = 1 (Niagara meshes enabled in ray tracing))
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Geometry.NiagaraMeshes is to control the inclusion of Niagara meshes in ray tracing effects within Unreal Engine 5. This setting variable is specifically related to the ray tracing system and its interaction with the Niagara visual effects system.
-
The Unreal Engine subsystem that relies on this setting variable is the ray tracing system, specifically within the Niagara plugin. This can be seen from the file path “Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererMeshes.cpp”.
-
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 1, which means Niagara meshes are enabled in ray tracing by default.
-
This variable interacts directly with its associated variable CVarRayTracingNiagaraMeshes. They share the same value and purpose.
-
Developers must be aware that this variable is only relevant when ray tracing is enabled (notice the #if RHI_RAYTRACING preprocessor directive). Also, changing this variable will affect the performance and visual quality of ray-traced scenes that include Niagara particle systems with mesh renderers.
-
Best practices when using this variable include:
- Only disable it if you’re experiencing performance issues related to ray tracing Niagara meshes.
- Be aware that disabling it may affect the visual quality of your ray-traced scenes.
- Test your scenes with both enabled and disabled states to understand the impact.
Regarding the associated variable CVarRayTracingNiagaraMeshes:
- Its purpose is identical to r.RayTracing.Geometry.NiagaraMeshes, serving as the actual console variable that controls the setting.
- It’s used directly in the code to check whether Niagara meshes should be included in ray tracing calculations.
- The value is retrieved on the render thread using GetValueOnRenderThread(), suggesting that it can be changed at runtime.
- Developers should be aware that changes to this variable will take effect on the render thread, which may not be immediate.
- Best practices include using this variable for runtime toggling of the feature if needed, and ensuring that any code that depends on this setting checks its value on the appropriate thread.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:137, section: [/Script/Engine.RendererSettings]
- INI Section:
/Script/Engine.RendererSettings
- Raw value:
0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererMeshes.cpp:53
Scope: file
Source code excerpt:
#if RHI_RAYTRACING
static TAutoConsoleVariable<int32> CVarRayTracingNiagaraMeshes(
TEXT("r.RayTracing.Geometry.NiagaraMeshes"),
1,
TEXT("Include Niagara meshes in ray tracing effects (default = 1 (Niagara meshes enabled in ray tracing))"));
#endif
struct FNiagaraDynamicDataMesh : public FNiagaraDynamicDataBase
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingNiagaraMeshes
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererMeshes.cpp:52
Scope: file
Source code excerpt:
#if RHI_RAYTRACING
static TAutoConsoleVariable<int32> CVarRayTracingNiagaraMeshes(
TEXT("r.RayTracing.Geometry.NiagaraMeshes"),
1,
TEXT("Include Niagara meshes in ray tracing effects (default = 1 (Niagara meshes enabled in ray tracing))"));
#endif
struct FNiagaraDynamicDataMesh : public FNiagaraDynamicDataBase
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererMeshes.cpp:1618
Scope (from outer to inner):
file
function void FNiagaraRendererMeshes::GetDynamicRayTracingInstances
Source code excerpt:
void FNiagaraRendererMeshes::GetDynamicRayTracingInstances(FRayTracingMaterialGatheringContext& Context, TArray<FRayTracingInstance>& OutRayTracingInstances, const FNiagaraSceneProxy* SceneProxy)
{
if (!CVarRayTracingNiagaraMeshes.GetValueOnRenderThread())
{
return;
}
check(SceneProxy);