r.ShaderPrint.Zoom.Factor

r.ShaderPrint.Zoom.Factor

#Overview

name: r.ShaderPrint.Zoom.Factor

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.ShaderPrint.Zoom.Factor is to control the zoom factor for magnification around the mouse cursor in the shader print functionality of Unreal Engine 5’s rendering system.

This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the ShaderPrint namespace. It is part of the shader debugging and visualization tools that help developers inspect shader outputs.

The value of this variable is set as a console variable using TAutoConsoleVariable. It is initialized with a default value of 8 and can be changed at runtime through the console or programmatically.

The associated variable CVarDrawZoomFactor interacts directly with r.ShaderPrint.Zoom.Factor. They share the same value and purpose.

Developers must be aware that this variable affects the rendering performance and visual output when shader printing is enabled. It should be used judiciously, primarily for debugging and development purposes.

Best practices when using this variable include:

  1. Use it only when necessary for shader debugging.
  2. Be mindful of performance impacts when setting high zoom factors.
  3. Reset to default values after debugging to avoid unintended effects in the final product.

Regarding the associated variable CVarDrawZoomFactor:

The purpose of CVarDrawZoomFactor is identical to r.ShaderPrint.Zoom.Factor, as it is the actual console variable implementation.

It is used in the InternalDrawZoom function within the ShaderPrint namespace, where its value is retrieved on the render thread and clamped between 1 and 10 before being applied to the shader zoom parameters.

The value is set through the console variable system and can be modified at runtime.

It interacts with other variables in the shader zoom functionality, such as CVarDrawZoomPixel and CVarDrawZoomCorner, to define the behavior of the zoom feature.

Developers should be aware that changes to this variable will immediately affect the zoom behavior in the shader print output.

Best practices include using this variable in conjunction with other shader print settings for comprehensive shader debugging, and ensuring it’s properly reset after use to maintain expected rendering behavior.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:96

Scope (from outer to inner):

file
namespace    ShaderPrint

Source code excerpt:


	static TAutoConsoleVariable<int32> CVarDrawZoomFactor(
		TEXT("r.ShaderPrint.Zoom.Factor"),
		8,
		TEXT("Zoom factor for magnification around the mouse cursor.\n"),
		ECVF_Cheat | ECVF_RenderThreadSafe);

	static TAutoConsoleVariable<int32> CVarDrawZoomCorner(
		TEXT("r.ShaderPrint.Zoom.Corner"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:95

Scope (from outer to inner):

file
namespace    ShaderPrint

Source code excerpt:

		ECVF_Cheat | ECVF_RenderThreadSafe);

	static TAutoConsoleVariable<int32> CVarDrawZoomFactor(
		TEXT("r.ShaderPrint.Zoom.Factor"),
		8,
		TEXT("Zoom factor for magnification around the mouse cursor.\n"),
		ECVF_Cheat | ECVF_RenderThreadSafe);

	static TAutoConsoleVariable<int32> CVarDrawZoomCorner(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShaderPrint.cpp:1191

Scope (from outer to inner):

file
namespace    ShaderPrint
function     static void InternalDrawZoom

Source code excerpt:

		FShaderZoomCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FShaderZoomCS::FParameters>();
		PassParameters->PixelExtent = FMath::Clamp(CVarDrawZoomPixel.GetValueOnRenderThread(), 2, 128);
		PassParameters->ZoomFactor  = FMath::Clamp(CVarDrawZoomFactor.GetValueOnRenderThread(), 1, 10);
		PassParameters->Resolution = OutputTexture.Texture->Desc.Extent;
		PassParameters->Corner = FMath::Clamp(CVarDrawZoomCorner.GetValueOnRenderThread(), 0, 3);
		PassParameters->Common = ShaderPrintData.UniformBuffer;
		PassParameters->InTexture = OutputTexture.Texture;
		PassParameters->OutTexture = GraphBuilder.CreateUAV(OutZoomTexture);