r.Upscale.Panini.D

r.Upscale.Panini.D

#Overview

name: r.Upscale.Panini.D

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.Upscale.Panini.D is to apply and configure a Panini distortion to the rendered image in Unreal Engine 5. This setting is part of the rendering system, specifically the post-processing pipeline.

This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the post-processing upscale pass. It’s implemented in the PostProcessUpscale.cpp file, which suggests it’s part of the image upscaling process.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable, which means it can be adjusted at runtime through console commands or configuration files.

The associated variable CVarUpscalePaniniD directly interacts with r.Upscale.Panini.D. They share the same value and are used interchangeably in the code.

Developers should be aware of the following when using this variable:

  1. The value range is between 0 and 1, where 0 turns off the effect, and 1 enables full Panini cylindrical stereographic projection.
  2. Values between 0 and 1 allow for a gradual fade-in of the effect.
  3. Enabling this effect (values > 0) may require an extra post-processing pass if upsampling isn’t already in use.
  4. This effect is based on the research paper “Pannini: A New Projection for Rendering Wide Angle Perspective Images”.

Best practices when using this variable include:

  1. Use it judiciously, as it can affect performance by adding an extra post-processing pass.
  2. Consider the visual impact on your game’s aesthetics and ensure it aligns with your artistic vision.
  3. Test different values to find the right balance between the desired effect and performance impact.
  4. Be aware of how it interacts with other post-processing effects and screen percentage settings.

Regarding the associated variable CVarUpscalePaniniD: Its purpose is to provide programmatic access to the r.Upscale.Panini.D setting within the C++ code of the engine. It’s used in the FPaniniProjectionConfig constructor to retrieve the current value of the Panini distortion setting. This allows the engine to apply the correct amount of distortion during the rendering process.

Developers should note that CVarUpscalePaniniD.GetValueOnRenderThread() is used to access the value, ensuring thread-safe access in the render thread. When modifying or reading this value in custom code, always use the appropriate thread-safe methods provided by the TAutoConsoleVariable class.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp:16

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<float> CVarUpscalePaniniD(
	TEXT("r.Upscale.Panini.D"),
	0,
	TEXT("Allow and configure to apply a panini distortion to the rendered image. Values between 0 and 1 allow to fade the effect (lerp).\n")
	TEXT("Implementation from research paper \"Pannini: A New Projection for Rendering Wide Angle Perspective Images\"\n")
	TEXT(" 0: off (default)\n")
	TEXT(">0: enabled (requires an extra post processing pass if upsampling wasn't used - see r.ScreenPercentage)\n")
	TEXT(" 1: Panini cylindrical stereographic projection"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp:15

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<float> CVarUpscalePaniniD(
	TEXT("r.Upscale.Panini.D"),
	0,
	TEXT("Allow and configure to apply a panini distortion to the rendered image. Values between 0 and 1 allow to fade the effect (lerp).\n")
	TEXT("Implementation from research paper \"Pannini: A New Projection for Rendering Wide Angle Perspective Images\"\n")
	TEXT(" 0: off (default)\n")
	TEXT(">0: enabled (requires an extra post processing pass if upsampling wasn't used - see r.ScreenPercentage)\n")

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp:73

Scope (from outer to inner):

file
function     FPaniniProjectionConfig::FPaniniProjectionConfig

Source code excerpt:

	if (View.IsPerspectiveProjection() && !GEngine->StereoRenderingDevice.IsValid())
	{
		D = FMath::Max(CVarUpscalePaniniD.GetValueOnRenderThread(), 0.0f);
		S = CVarUpscalePaniniS.GetValueOnRenderThread();
		ScreenFit = FMath::Max(CVarUpscalePaniniScreenFit.GetValueOnRenderThread(), 0.0f);
	}
}

BEGIN_SHADER_PARAMETER_STRUCT(FPaniniProjectionParameters, )