fx.Niagara.AsyncGpuTrace.GlobalSdfEnabled

fx.Niagara.AsyncGpuTrace.GlobalSdfEnabled

#Overview

name: fx.Niagara.AsyncGpuTrace.GlobalSdfEnabled

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 fx.Niagara.AsyncGpuTrace.GlobalSdfEnabled is to control the support for AsyncGpuTrace against Global SDF (Signed Distance Field) in Niagara, Unreal Engine’s visual effects system.

This setting variable is primarily used by the Niagara plugin, specifically within the AsyncGpuTrace functionality. It’s part of the FX (effects) system and interacts with the rendering subsystem, particularly the distance field rendering features.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) but can be changed at runtime through the console or configuration files.

This variable interacts with other related variables, such as:

  1. fx.Niagara.AsyncGpuTrace.HWRayTraceEnabled
  2. r.Raytracing.Enable
  3. r.GenerateMeshDistanceFields
  4. r.DistanceFields.SupportEvenIfHardwareRayTracingSupported

Developers must be aware that:

  1. Disabling this variable will prevent AsyncGpuTrace from being supported against Global SDF.
  2. It’s part of a larger system involving ray tracing and distance field rendering, and its effectiveness depends on other settings and project configurations.
  3. Changing this setting may affect performance and visual output of Niagara effects that rely on AsyncGpuTrace.

Best practices when using this variable include:

  1. Ensure it aligns with your project’s overall rendering strategy and performance goals.
  2. Consider it in conjunction with related settings, especially when troubleshooting AsyncGpuTrace issues.
  3. Be aware of its impact on different hardware configurations, as distance field rendering can be computationally expensive.
  4. Use it in combination with profiling tools to optimize performance for your specific use case.
  5. Document any changes to this setting in your project to maintain consistency across the development team.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraShader/Private/NiagaraAsyncGpuTraceProviderGsdf.cpp:16

Scope: file

Source code excerpt:

static int GNiagaraAsyncGpuTraceGsdfEnabled = 1;
static FAutoConsoleVariableRef CVarNiagaraAsyncGpuTraceGsdfEnabled(
	TEXT("fx.Niagara.AsyncGpuTrace.GlobalSdfEnabled"),
	GNiagaraAsyncGpuTraceGsdfEnabled,
	TEXT("If disabled AsyncGpuTrace will not be supported against Global SDF."),
	ECVF_Default
);

class FNiagaraRayMarchGlobalSdfCS : public FGlobalShader

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/DataInterface/NiagaraDataInterfaceAsyncGpuTrace.cpp:540

Scope (from outer to inner):

file
function     void UNiagaraDataInterfaceAsyncGpuTrace::GetFeedback

Source code excerpt:

	Super::GetFeedback(InAsset, InComponent, OutErrors, OutWarnings, OutInfo);
	IConsoleVariable* EnableRayTrace = IConsoleManager::Get().FindConsoleVariable(TEXT("fx.Niagara.AsyncGpuTrace.HWRayTraceEnabled"));
	IConsoleVariable* EnableDistanceField = IConsoleManager::Get().FindConsoleVariable(TEXT("fx.Niagara.AsyncGpuTrace.GlobalSdfEnabled"));
	if (TraceProvider == ENDICollisionQuery_AsyncGpuTraceProvider::HWRT && (EnableRayTrace == nullptr || !EnableRayTrace->GetBool() || !IsRayTracingEnabled()))
	{
		FText ErrorDescription = LOCTEXT("NiagaraAsyncGpuTraceNoHWRayTraceWarning", "Hardware raytracing is currently disabled");
		FText ErrorSummary = LOCTEXT("NiagaraAsyncGpuTraceNoHWRayTraceWarningSummary", "The data interface is configured to use hardware raytracing, which is currently disabled.\nThe data interface will NOT work with the current project settings.\n\nTo enable ray tracing support, all of the following must be true:\n* Default RHI is DirectX 12 in the project settings\n* Ray Tracing is enabled in the project settings\n* CVar fx.Niagara.AsyncGpuTrace.HWRayTraceEnabled is set to 1\n* CVar r.Raytracing.Enable is set to 1");
		OutWarnings.Emplace(ErrorDescription, ErrorSummary, FNiagaraDataInterfaceFix());
	}

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/DataInterface/NiagaraDataInterfaceAsyncGpuTrace.cpp:550

Scope (from outer to inner):

file
function     void UNiagaraDataInterfaceAsyncGpuTrace::GetFeedback

Source code excerpt:

	{
		FText ErrorDescription = LOCTEXT("NiagaraAsyncGpuTraceNoDFTraceWarning", "Distance field tracing is currently disabled");
		FText ErrorSummary = LOCTEXT("NiagaraAsyncGpuTraceNoDFWarningSummary", "The data interface is configured to use distance fielde tracing, which is currently disabled.\nThe data interface will NOT work with the current project settings.\n\nAside from project settings, check the following cvars:\n* fx.Niagara.AsyncGpuTrace.GlobalSdfEnabled\n* r.GenerateMeshDistanceFields\n* r.DistanceFields.SupportEvenIfHardwareRayTracingSupported (only if ray tracing is disabled)");
		OutWarnings.Emplace(ErrorDescription, ErrorSummary, FNiagaraDataInterfaceFix());
	}
}
#endif

#undef LOCTEXT_NAMESPACE