HighResShot

HighResShot

#Overview

name: HighResShot

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of HighResShot is to enable high-resolution screenshot capture in Unreal Engine 5. This setting variable is primarily used for capturing high-quality images of the game or editor viewport at resolutions higher than the current display resolution.

HighResShot is utilized by multiple Unreal Engine subsystems, including:

  1. The Editor system (UnrealEd module)
  2. The Core system (for console command registration)
  3. The GameViewport system
  4. The Renderer module (for post-processing and buffer visualization)

The value of this variable is not directly set in the provided code snippets. Instead, it’s used as a console command that can be invoked with various parameters to control the screenshot capture process.

HighResShot interacts with other variables and systems, such as:

  1. GetHighResScreenshotConfig() for parsing command parameters
  2. TakeHighResScreenShots() for actually capturing the screenshots
  3. VisualizeBuffer system for dumping buffer visualization targets

Developers should be aware of the following when using HighResShot:

  1. It can be invoked from both the editor and in-game (Play-In-Editor mode)
  2. The command accepts various parameters to control resolution, capture region, mask settings, and HDR capture
  3. It can impact performance when capturing very high-resolution screenshots

Best practices for using HighResShot include:

  1. Use it judiciously, as high-resolution captures can be resource-intensive
  2. Familiarize yourself with the available parameters to fine-tune the capture process
  3. Be aware of the differences between editor and in-game usage
  4. When using it for automated testing, consider using r.ResetViewState to ensure deterministic rendering
  5. For developers working on rendering systems, be aware that HighResShot can interact with buffer visualization and dump processes

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdSrv.cpp:1190

Scope (from outer to inner):

file
function     bool UUnrealEdEngine::Exec

Source code excerpt:

		}
	}
	else if( FParse::Command(&Str, TEXT("HighResShot") ) )
	{
		// this is HighResShot from the Editor NOT in PIE
		// Editor PIE HighResShot is in GameViewportClient
		if (GetHighResScreenshotConfig().ParseConsoleCommand(Str, Ar))
		{
			TakeHighResScreenShots();
		}

		return true;

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3355

Scope (from outer to inner):

file
function     void CreateConsoleVariables

Source code excerpt:

	IConsoleManager::Get().RegisterConsoleCommand(TEXT("Vis"),	TEXT("short version of visualizetexture"), ECVF_Cheat);
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("VisRT"),	TEXT("GUI for visualizetexture"), ECVF_Cheat);
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("HighResShot"),	TEXT("High resolution screenshots ResolutionX(int32)xResolutionY(int32) Or Magnification(float) [CaptureRegionX(int32) CaptureRegionY(int32) CaptureRegionWidth(int32) CaptureRegionHeight(int32) MaskEnabled(int32) DumpBufferVisualizationTargets(int32) CaptureHDR(int32)]\nExample: HighResShot 500x500 50 50 120 500 1 1 1"), ECVF_Cheat);
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("DumpUnbuiltLightInteractions"),	TEXT("Logs all lights and primitives that have an unbuilt interaction."), ECVF_Cheat);
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("Stat MapBuildData"),	TEXT(""), ECVF_Cheat);
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("r.ResetViewState"), TEXT("Reset some state (e.g. TemporalAA index) to make rendering more deterministic (for automated screenshot verification)"), ECVF_Cheat);
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("r.RHI.Name"),		TEXT("Show current RHI's name"), ECVF_Cheat);
	IConsoleManager::Get().RegisterConsoleCommand(TEXT("r.ResetRenderTargetsExtent"), TEXT("To reset internal render target extents"), ECVF_Cheat);
#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp:3174

Scope: file

Source code excerpt:

		return HandleSetResCommand( Cmd, Ar );
	}
	else if( FParse::Command(&Cmd,TEXT("HighResShot")) )
	{
		return HandleHighresScreenshotCommand( Cmd, Ar );
	}
	else if( FParse::Command(&Cmd,TEXT("HighResShotUI")) )
	{
		return HandleHighresScreenshotUICommand( Cmd, Ar );

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessVisualizeBuffer.cpp:237

Scope (from outer to inner):

file
function     void AddDumpToFilePass
lambda-function

Source code excerpt:

		[&HighResScreenshotConfig, Input, Filename](FRHICommandListImmediate& RHICmdList)
	{
		// this is where HighResShot bDumpBufferVisualizationTargets are written to EXRs

		// @todo Oodle alternative : use the exact same pixelformat that this buffer would have in the renderer
		//	 use the DDS writer which can output arbitrary pixel formats
		//	 do no format conversions so we dump the exact same bits the game renderer would see

		TUniquePtr<FImagePixelData> PixelData = ReadbackPixelData(RHICmdList, Input.Texture->GetRHI(), Input.ViewRect);