ImgMedia.MipMapLevelPadding

ImgMedia.MipMapLevelPadding

#Overview

name: ImgMedia.MipMapLevelPadding

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 ImgMedia.MipMapLevelPadding is to provide additional padding to the estimated mipmap levels used by the loader in the ImgMedia plugin. This setting is part of the media handling system in Unreal Engine, specifically for image-based media.

This setting variable is primarily used in the ImgMedia plugin, which is part of Unreal Engine’s media framework. Based on the callsites, it’s utilized in the ImgMediaMipMapInfo.cpp file, which suggests it’s involved in managing mipmap information for image media assets.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0.0 and can be modified at runtime or through configuration files.

The associated variable CVarImgMediaMipLevelPadding interacts directly with ImgMedia.MipMapLevelPadding. They share the same value, with CVarImgMediaMipLevelPadding being the actual TAutoConsoleVariable that holds and provides access to the value.

Developers must be aware that this variable affects the calculation of visible tiles in both plane and sphere object scenarios. It’s used to add padding to the mipmap level calculations, which can impact performance and visual quality.

Best practices when using this variable include:

  1. Only modify it if you understand the implications on mipmap generation and memory usage.
  2. Monitor performance when adjusting this value, as it may affect loading times and memory consumption.
  3. Use it in conjunction with other ImgMedia settings for optimal results.

Regarding the associated variable CVarImgMediaMipLevelPadding:

The purpose of CVarImgMediaMipLevelPadding is to provide a configurable interface for the ImgMedia.MipMapLevelPadding setting. It allows runtime modification of the mipmap level padding value.

This console variable is used within the ImgMedia plugin, specifically in the mipmap calculation logic for image-based media assets.

The value is set when the console variable is created, with a default of 0.0. It can be modified through console commands or configuration files.

CVarImgMediaMipLevelPadding directly influences the ImgMedia.MipMapLevelPadding setting. When its value is accessed, it affects the mipmap level calculations in the CalculateVisibleTiles functions.

Developers should be aware that this is a float value and should ensure that only non-negative values are used, as evidenced by the FMath::Max function used when accessing its value.

Best practices for using CVarImgMediaMipLevelPadding include:

  1. Use the console or configuration files to adjust the value for testing purposes.
  2. Document any changes made to this variable in project settings or documentation.
  3. Consider the performance implications when modifying this value, especially for large image sequences.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Media/ImgMedia/Source/ImgMedia/Private/Assets/ImgMediaMipMapInfo.cpp:32

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarImgMediaMipLevelPadding(
	TEXT("ImgMedia.MipMapLevelPadding"),
	0.0,
	TEXT("Value padded onto the estimated (minimum and maximum) mipmap levels used by the loader.\n"),
	ECVF_Default);

FImgMediaTileSelection::FImgMediaTileSelection(int32 NumTilesX, int32 NumTilesY, bool bDefaultVisibility)
	: Tiles(bDefaultVisibility, NumTilesX * NumTilesY)

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Media/ImgMedia/Source/ImgMedia/Private/Assets/ImgMediaMipMapInfo.cpp:31

Scope: file

Source code excerpt:



static TAutoConsoleVariable<float> CVarImgMediaMipLevelPadding(
	TEXT("ImgMedia.MipMapLevelPadding"),
	0.0,
	TEXT("Value padded onto the estimated (minimum and maximum) mipmap levels used by the loader.\n"),
	ECVF_Default);

FImgMediaTileSelection::FImgMediaTileSelection(int32 NumTilesX, int32 NumTilesY, bool bDefaultVisibility)

#Loc: <Workspace>/Engine/Plugins/Media/ImgMedia/Source/ImgMedia/Private/Assets/ImgMediaMipMapInfo.cpp:406

Scope (from outer to inner):

file
namespace    anonymous
class        class FPlaneObjectInfo : public FImgMediaMipMapObjectInfo
function     void CalculateVisibleTiles

Source code excerpt:


			const float MipMapBias = ObjectInfo->MipMapLODBias;
			const float MipMapLevelPadding = FMath::Max(CVarImgMediaMipLevelPadding.GetValueOnAnyThread(), 0.0f);

			const FIntPoint& SequenceTileNum = InSequenceInfo.TilingDescription.TileNum;

			// To avoid calculating tile corner mip levels multiple times over, we cache them in this array.
			CornerMipLevelsCached.SetNum((SequenceTileNum.X + 1) * (SequenceTileNum.Y + 1));

#Loc: <Workspace>/Engine/Plugins/Media/ImgMedia/Source/ImgMedia/Private/Assets/ImgMediaMipMapInfo.cpp:650

Scope (from outer to inner):

file
namespace    anonymous
class        class FSphereObjectInfo : public FImgMediaMipMapObjectInfo
function     void CalculateVisibleTiles

Source code excerpt:

			const FVector2f MeshRange = FVector2f(ObjectInfo->MeshRange);
			const float MipMapBias = ObjectInfo->MipMapLODBias;
			const float MipMapLevelPadding = FMath::Max(CVarImgMediaMipLevelPadding.GetValueOnAnyThread(), 0.0f);
			const FTransform MeshTransform = Mesh->GetComponentTransform();
			const int32 MaxLevel = InSequenceInfo.NumMipLevels - 1;

			// Include all tiles containted in the visible UV region
			const FIntPoint& SequenceTileNum = InSequenceInfo.TilingDescription.TileNum;
			const FVector2f SequencePartialTileNum = InSequenceInfo.GetPartialTileNum();