bSupportsPathTracing

bSupportsPathTracing

#Overview

name: bSupportsPathTracing

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bSupportsPathTracing is to indicate whether the current platform supports path tracing, which is an advanced rendering technique used for realistic lighting and reflections in computer graphics.

This setting variable is primarily used in the Unreal Engine’s rendering system, specifically within the MovieRenderPipeline plugin and the RHI (Rendering Hardware Interface) module.

The value of this variable is set in multiple places:

  1. In the MovieRenderPipeline plugin, it’s determined by checking if ray tracing is enabled and if the “r.PathTracing” console variable is set to a non-zero value.
  2. In the RHI module, it’s parsed from a data-driven shader platform info configuration.

This variable interacts with other ray tracing related variables, such as bSupportsRayTracing and bSupportsHighEndRayTracingEffects. It’s often used in conjunction with these variables to determine the full capabilities of the rendering system.

Developers must be aware that:

  1. Path tracing requires hardware ray tracing support.
  2. The “r.PathTracing” console variable needs to be set for path tracing to be enabled.
  3. The project’s Rendering settings must have ‘Support Hardware Ray Tracing’ and ‘Path Tracing’ enabled for path tracing to work.

Best practices when using this variable include:

  1. Always check if path tracing is supported before attempting to use it in your rendering pipeline.
  2. Provide fallback rendering methods for platforms or configurations where path tracing is not supported.
  3. Use the CheckIfPathTracerIsSupported() function (as seen in the MoviePipelineDeferredPasses.cpp) to validate path tracing support and provide appropriate warnings or errors to the user.
  4. Consider the performance implications of path tracing, as it can be computationally expensive.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:47, section: [ShaderPlatform PCD3D_SM5]

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:98, section: [ShaderPlatform PCD3D_SM6]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineRenderPasses/Private/Graph/Nodes/MovieGraphPathTracerPassNode.cpp:60

Scope (from outer to inner):

file
function     void UMovieGraphPathTracerRenderPassNode::SetupImpl

Source code excerpt:

	}

	bool bSupportsPathTracing = false;
	if (IsRayTracingEnabled())
	{
		if (const IConsoleVariable* PathTracingCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PathTracing")))
		{
			bSupportsPathTracing = PathTracingCVar->GetInt() != 0;
		}
	}

	// Warn if the path tracer is being used, but it's not enabled in the Rendering settings. The path tracer won't work otherwise.
	if (!bSupportsPathTracing)
	{
		// TODO: Ideally this is called in a general-purpose validation step instead, but that framework does not exist yet.
		UE_LOG(LogMovieRenderPipeline, Warning, TEXT("An active Path Traced Renderer node was found, but path tracing support is not enabled. To get "
													 "renders with path tracing, enable 'Support Hardware Ray Tracing' and 'Path Tracing' in the "
													 "project's Rendering settings."));
	}

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineRenderPasses/Private/MoviePipelineDeferredPasses.cpp:1052

Scope (from outer to inner):

file
function     bool UMoviePipelineDeferredPassBase::CheckIfPathTracerIsSupported

Source code excerpt:

bool UMoviePipelineDeferredPassBase::CheckIfPathTracerIsSupported() const
{
	bool bSupportsPathTracing = false;
	if (IsRayTracingEnabled())
	{
		IConsoleVariable* PathTracingCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PathTracing"));
		if (PathTracingCVar)
		{
			bSupportsPathTracing = PathTracingCVar->GetInt() != 0;
		}
	}
	return bSupportsPathTracing;
}

void UMoviePipelineDeferredPassBase::PathTracerValidationImpl()
{
	const bool bSupportsPathTracing = CheckIfPathTracerIsSupported();

	if (!bSupportsPathTracing)
	{
		const FText ValidationWarning = NSLOCTEXT("MovieRenderPipeline", "PathTracerValidation_Unsupported", "Path Tracing is currently not enabled for this project and this render pass will not work.");
		ValidationResults.Add(ValidationWarning);
		ValidationState = EMoviePipelineValidationState::Warnings;
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/DataDrivenShaderPlatformInfo.cpp:226

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo

Source code excerpt:

	GET_SECTION_BOOL_HELPER(bSupportsRayTracingTraversalStatistics);
	GET_SECTION_BOOL_HELPER(bSupportsRayTracingIndirectInstanceData);
	GET_SECTION_BOOL_HELPER(bSupportsPathTracing);
	GET_SECTION_BOOL_HELPER(bSupportsHighEndRayTracingEffects);
	GET_SECTION_BOOL_HELPER(bSupportsByteBufferComputeShaders);
	GET_SECTION_BOOL_HELPER(bSupportsGPUScene);
	GET_SECTION_BOOL_HELPER(bSupportsPrimitiveShaders);
	GET_SECTION_BOOL_HELPER(bSupportsUInt64ImageAtomics);
	GET_SECTION_BOOL_HELPER(bRequiresVendorExtensionsForAtomics);

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:51

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo

Source code excerpt:

	uint32 bSupportsRayTracingIndirectInstanceData : 1; // Whether instance transforms can be copied from the GPU to the TLAS instances buffer
	uint32 bSupportsHighEndRayTracingEffects : 1; // Whether fully-featured RT effects can be used on the platform (with translucent shadow, etc.)
	uint32 bSupportsPathTracing : 1; // Whether real-time path tracer is supported on this platform (avoids compiling unnecessary shaders)
	uint32 bSupportsGPUScene : 1;
	uint32 bSupportsByteBufferComputeShaders : 1;
	uint32 bSupportsPrimitiveShaders : 1;
	uint32 bSupportsUInt64ImageAtomics : 1;
	uint32 bRequiresVendorExtensionsForAtomics : 1;
	uint32 bSupportsNanite : 1;

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:383

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo
function     static const bool GetSupportsPathTracing

Source code excerpt:

	{
		check(IsValid(Platform));
		return Infos[Platform].bSupportsRayTracing && Infos[Platform].bSupportsPathTracing;
	}

	static FORCEINLINE_DEBUGGABLE const bool GetSupportsHighEndRayTracingEffects(const FStaticShaderPlatform Platform)
	{
		check(IsValid(Platform));
		return Infos[Platform].bSupportsRayTracing && Infos[Platform].bSupportsHighEndRayTracingEffects;