r.RayTracing.Geometry.NiagaraRibbons

r.RayTracing.Geometry.NiagaraRibbons

#Overview

name: r.RayTracing.Geometry.NiagaraRibbons

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).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RayTracing.Geometry.NiagaraRibbons is to control the inclusion of Niagara ribbons in ray tracing effects within Unreal Engine 5. This setting variable is primarily related to the ray tracing and Niagara particle systems.

This setting variable is used in the Niagara plugin, specifically within the ribbon renderer component. It directly affects the ray tracing functionality for Niagara ribbon particles.

The value of this variable is set through a console command, as it’s defined as a TAutoConsoleVariable. The default value is set to 0, but the comment suggests that the intended default behavior is 1 (Niagara ribbons enabled in ray tracing).

The associated variable CVarRayTracingNiagaraRibbons interacts directly with this setting. They share the same value and purpose.

Developers must be aware that this variable controls whether Niagara ribbons are included in ray tracing calculations. Setting it to 0 will exclude Niagara ribbons from ray tracing effects, which may improve performance but reduce visual fidelity for these particle effects.

Best practices when using this variable include:

  1. Consider the performance impact of including Niagara ribbons in ray tracing, especially for scenes with many ribbon particles.
  2. Use this setting to fine-tune the balance between visual quality and performance in ray-traced scenes.
  3. Test the visual impact of enabling/disabling this feature in different scenarios to determine the optimal setting for your project.

Regarding the associated variable CVarRayTracingNiagaraRibbons:

This is the actual console variable that controls the behavior described above. It’s used in the GetDynamicRayTracingInstances function of the FNiagaraRendererRibbons class to determine whether to proceed with generating ray tracing instances for Niagara ribbons.

The value of CVarRayTracingNiagaraRibbons is checked on the render thread, indicating that it can be changed at runtime without requiring a full engine restart.

Developers should be aware that changing this variable will have an immediate effect on the rendering of Niagara ribbons in ray-traced scenes. It’s a useful tool for performance optimization and visual debugging.

When working with this variable, consider creating a user-facing graphics option that toggles this setting, allowing end-users to optimize performance based on their hardware capabilities.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:138, section: [/Script/Engine.RendererSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererRibbons.cpp:167

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRayTracingNiagaraRibbons(
	TEXT("r.RayTracing.Geometry.NiagaraRibbons"),
	0,
	TEXT("Include Niagara ribbons in ray tracing effects (default = 1 (Niagara ribbons enabled in ray tracing))"));

// max absolute error 9.0x10^-3
// Eberly's polynomial degree 1 - respect bounds
// input [-1, 1] and output [0, PI]

#Associated Variable and Callsites

This variable is associated with another variable named CVarRayTracingNiagaraRibbons. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererRibbons.cpp:166

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarRayTracingNiagaraRibbons(
	TEXT("r.RayTracing.Geometry.NiagaraRibbons"),
	0,
	TEXT("Include Niagara ribbons in ray tracing effects (default = 1 (Niagara ribbons enabled in ray tracing))"));

// max absolute error 9.0x10^-3
// Eberly's polynomial degree 1 - respect bounds

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererRibbons.cpp:1051

Scope (from outer to inner):

file
function     void FNiagaraRendererRibbons::GetDynamicRayTracingInstances

Source code excerpt:

void FNiagaraRendererRibbons::GetDynamicRayTracingInstances(FRayTracingMaterialGatheringContext& Context, TArray<FRayTracingInstance>& OutRayTracingInstances, const FNiagaraSceneProxy* SceneProxy)
{
	if (!CVarRayTracingNiagaraRibbons.GetValueOnRenderThread())
	{
		return;
	}
	
	SCOPE_CYCLE_COUNTER(STAT_NiagaraRenderRibbons);
	check(SceneProxy);