r.PathTracing.FilterWidth

r.PathTracing.FilterWidth

#Overview

name: r.PathTracing.FilterWidth

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.PathTracing.FilterWidth is to control the anti-aliasing filter width in the path tracing rendering system of Unreal Engine 5. This setting variable is specifically used for adjusting the quality of anti-aliasing in path-traced renders.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the path tracing component. This can be seen from the file location “Engine/Source/Runtime/Renderer/Private/PathTracing.cpp”.

The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 3.0, which corresponds to a Gaussian filter with a standard deviation of 1/2 pixel. Users can modify this value at runtime through console commands or project settings.

This variable interacts directly with an associated C++ variable named CVarPathTracingFilterWidth. They share the same value, and CVarPathTracingFilterWidth is used to access and modify the r.PathTracing.FilterWidth setting within the C++ code.

Developers must be aware that changing this value affects the anti-aliasing quality in path-traced renders. A higher value will result in more blurring, potentially reducing aliasing but also potentially reducing image sharpness. A lower value will produce sharper images but may introduce more aliasing artifacts.

Best practices when using this variable include:

  1. Experiment with different values to find the right balance between anti-aliasing and image sharpness for your specific scene.
  2. Be mindful of performance implications; higher filter widths may require more computational resources.
  3. Consider the target output resolution when adjusting this value, as the optimal setting may vary depending on the final image size.

Regarding the associated variable CVarPathTracingFilterWidth:

The purpose of CVarPathTracingFilterWidth is to provide a C++ interface for accessing and modifying the r.PathTracing.FilterWidth setting within the engine’s code.

This variable is used within the Renderer module, specifically in the path tracing component.

The value of CVarPathTracingFilterWidth is set when r.PathTracing.FilterWidth is modified, either through console commands or project settings.

CVarPathTracingFilterWidth interacts directly with r.PathTracing.FilterWidth, serving as its C++ representation.

Developers should be aware that modifying CVarPathTracingFilterWidth directly in C++ code will affect the r.PathTracing.FilterWidth setting.

Best practices for using CVarPathTracingFilterWidth include:

  1. Use GetValueOnRenderThread() when accessing the value to ensure thread-safety.
  2. Avoid frequently changing this value during runtime, as it may impact performance.
  3. Consider caching the value if it’s accessed frequently in performance-critical code sections.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:91

Scope: file

Source code excerpt:


TAutoConsoleVariable<float> CVarPathTracingFilterWidth(
	TEXT("r.PathTracing.FilterWidth"),
	3.0,
	TEXT("Sets the anti-aliasing filter width (default = 3.0 which corresponds to a gaussian with standard deviation of a 1/2 pixel)"),
	ECVF_RenderThreadSafe
);

TAutoConsoleVariable<int32> CVarPathTracingMISMode(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:90

Scope: file

Source code excerpt:

);

TAutoConsoleVariable<float> CVarPathTracingFilterWidth(
	TEXT("r.PathTracing.FilterWidth"),
	3.0,
	TEXT("Sets the anti-aliasing filter width (default = 3.0 which corresponds to a gaussian with standard deviation of a 1/2 pixel)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:639

Scope (from outer to inner):

file
function     static void PreparePathTracingData

Source code excerpt:

	PathTracingData.VisualizeLightGrid = CVarPathTracingLightGridVisualize.GetValueOnRenderThread();
	PathTracingData.VisualizeDecalGrid = CVarPathTracingDecalGridVisualize.GetValueOnRenderThread();
	PathTracingData.FilterWidth = CVarPathTracingFilterWidth.GetValueOnRenderThread();
	PathTracingData.CameraFocusDistance = 0;
	PathTracingData.CameraLensRadius = FVector2f::ZeroVector;
	if (ShowFlags.DepthOfField &&
		PPV.PathTracingEnableReferenceDOF &&
		PPV.DepthOfFieldFocalDistance > 0 &&
		PPV.DepthOfFieldFstop > 0)