GlobalLambdaMultiplier
GlobalLambdaMultiplier
#Overview
name: GlobalLambdaMultiplier
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of GlobalLambdaMultiplier is to provide a global scaling factor for the lambda values used in Oodle Texture compression. It affects the tradeoff between size and quality in the Rate Distortion Optimization (RDO) process for texture compression.
This setting variable is primarily used by the Oodle Texture compression system, which is part of the TextureFormatOodle plugin in Unreal Engine 5. This plugin is responsible for compressing textures using the Oodle Texture compression algorithm.
The value of this variable is set in the engine configuration file (GEngineIni) under the [TextureFormatOodleSettings] section. It can also be overridden via the FormatConfigOverride in the build settings.
GlobalLambdaMultiplier interacts with the per-texture and per-LODGroup lambda settings. It scales all lambda values, including the global default and per-texture lambdas.
Developers should be aware that:
- The default value is 1.0, which means no scaling is applied.
- Values less than 1.0 will result in smaller file sizes but potentially lower quality.
- Values greater than 1.0 will result in larger file sizes but potentially higher quality.
- This variable affects all textures compressed with Oodle Texture.
Best practices when using this variable include:
- Leave it at 1.0 during most of the development process.
- Only adjust it near the end of development (close to shipping) to fine-tune the overall texture compression for the entire game.
- Use small adjustments (e.g., 0.9 or 1.1) to avoid dramatic changes in texture quality or file size.
- Always test the visual impact and performance implications when changing this value.
- Use in conjunction with per-texture and per-LODGroup settings for optimal results.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3451, section: [TextureFormatOodleSettings]
- INI Section:
TextureFormatOodleSettings
- Raw value:
1.000000
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Developer/TextureFormatOodle/Source/Private/TextureFormatOodle.cpp:81
Scope: file
Source code excerpt:
[TextureFormatOodleSettings]
bDebugColor=False
GlobalLambdaMultiplier=1.0
The sense of the bools is set so that all-false is default behavior.
bDebugColor :
Fills the encoded texture with a solid color depending on their BCN format.
This is a handy way to see that you are in fact getting Oodle Texture in your game.
It's also an easy way to spot textures that aren't BCN compressed, since they will not
be solid color. (for example I found that lots of the Unreal demo content uses "HDR"
which is an uncompressed format, instead of "HDRCompressed" (BC6)) The color indicates
the actual compressed format output (BC1-7).
GlobalLambdaMultiplier :
Takes all lambdas and scales them by this multiplier, so it affects the global default
and the per-texture lambdas.
It is recommended to leave this at 1.0 until you get near shipping your final game, at
which point you could tweak it to 0.9 or 1.1 to adjust your package size without having
to edit lots of per-texture lambdas.
Oodle Texture lambda
----------------------
The "lambda" parameter is the most important way of controlling Oodle Texture RDO.
"lambda" controls the tradeoff of size vs quality in the Rate Distortion Optimization.
Finding the right lambda settings will be a collaboration between artists and
programmers. Programmers and technical artists may wish to find a global lambda
that meets your goals. Individual texture artists may wish to tweak the lambda
per-texture when needed, but this should be rare - for the most part Oodle Texture
quality is very predictable and good on most textures.
Lambda first of all can be overridden per texture with the "LossyCompressionAmount"
setting. This is a slider in the GUI in the editor that goes from Lowest to Highest.
The default value is "Default" and we recommend leaving that there most of the time.
If the per-texture LossyCompressionAmount is "Default", that means "inherit from LODGroup".
The LODGroup gives you a logical group of textures where you can adjust the lambda on that
whole set of textures rather than per-texture.
For example here I have changed "World" LossyCompressionAmount to TLCA_High, and
"WorldNormalMap" to TLCA_Low :
[GlobalDefaults DeviceProfile]
@TextureLODGroups=Group
TextureLODGroups=(Group=TEXTUREGROUP_World,MinLODSize=1,MaxLODSize=8192,LODBias=0,MinMagFilter=aniso,MipFilter=point,MipGenSettings=TMGS_SimpleAverage,LossyCompressionAmount=TLCA_High)
+TextureLODGroups=(Group=TEXTUREGROUP_WorldNormalMap,MinLODSize=1,MaxLODSize=8192,LODBias=0,MinMagFilter=aniso,MipFilter=point,MipGenSettings=TMGS_SimpleAverage,LossyCompressionAmount=TLCA_Low)
+TextureLODGroups=(Group=TEXTUREGROUP_WorldSpecular,MinLODSize=1,MaxLODSize=8192,LODBias=0,MinMagFilter=aniso,MipFilter=point,MipGenSettings=TMGS_SimpleAverage)
If the LossyCompressionAmount is not set on the LODGroup (which is the default),
then it falls through to the global default, which is set in the texture compression
project settings.
At each stage, TLCA_Default means "inherit from parent".
TLCA_None means disable RDO entirely. We do not recommend this, use TLCA_Lowest
instead when you need very high quality.
Note that the Unreal Editor texture dialog shows live compression results.
When you're in the editor and you adjust the LossyCompressionAmount or import a
new texture, it shows the Oodle Texture encoded result in the texture preview.
*********/
DEFINE_LOG_CATEGORY_STATIC(LogTextureFormatOodle, Log, All);
LLM_DEFINE_TAG(OodleTexture);
/*****************
*
* Function pointer types for the Oodle Texture functions we need to import :
*
********************/
OODEFFUNC typedef OodleTex_Err (OOEXPLINK t_fp_OodleTex_EncodeBCN_RDO_Ex)(
OodleTex_BC to_bcn,void * to_bcn_blocks,OO_SINTa num_blocks,
const OodleTex_Surface * from_surfaces,OO_SINTa num_from_surfaces,OodleTex_PixelFormat from_format,
const OodleTex_Layout * layout,
int rdo_lagrange_lambda,
const OodleTex_RDO_Options * options,
int num_job_threads,void * jobify_user_ptr);
OODEFFUNC typedef void (OOEXPLINK t_fp_OodleTex_Plugins_SetAllocators)(
t_fp_OodleTex_Plugin_MallocAligned * fp_OodleMallocAligned,
t_fp_OodleTex_Plugin_Free * fp_OodleFree);
OODEFFUNC typedef void (OOEXPLINK t_fp_OodleTex_Plugins_SetJobSystemAndCount)(
t_fp_OodleTex_Plugin_RunJob * fp_RunJob,
t_fp_OodleTex_Plugin_WaitJob * fp_WaitJob,
int target_parallelism);
OODEFFUNC typedef t_fp_OodleTex_Plugin_Printf * (OOEXPLINK t_fp_OodleTex_Plugins_SetPrintf)(t_fp_OodleTex_Plugin_Printf * fp_rrRawPrintf);
OODEFFUNC typedef t_fp_OodleTex_Plugin_DisplayAssertion * (OOEXPLINK t_fp_OodleTex_Plugins_SetAssertion)(t_fp_OodleTex_Plugin_DisplayAssertion * fp_rrDisplayAssertion);
OODEFFUNC typedef const char * (OOEXPLINK t_fp_OodleTex_Err_GetName)(OodleTex_Err error);
OODEFFUNC typedef const char * (OOEXPLINK t_fp_OodleTex_PixelFormat_GetName)(OodleTex_PixelFormat pf);
OODEFFUNC typedef const char * (OOEXPLINK t_fp_OodleTex_BC_GetName)(OodleTex_BC bcn);
OODEFFUNC typedef const char * (OOEXPLINK t_fp_OodleTex_RDO_UniversalTiling_GetName)(OodleTex_RDO_UniversalTiling tiling);
OODEFFUNC typedef OO_S32 (OOEXPLINK t_fp_OodleTex_BC_BytesPerBlock)(OodleTex_BC bcn);
OODEFFUNC typedef OO_S32 (OOEXPLINK t_fp_OodleTex_PixelFormat_BytesPerPixel)(OodleTex_PixelFormat pf);
OODEFFUNC typedef OodleTex_Err (OOEXPLINK t_fp_OodleTex_LogVersion)(void);
/**
* DebugInfo passed to the Jobify callbacks for tracing
*/
struct FOodleJobDebugInfo
{
FStringView DebugTexturePathName;
int32 SizeX;
int32 SizeY;
OodleTex_BC OodleBCN;
int RDOLambda;
};
struct FOodleTextureVTable;
static void TFO_Plugins_Init();
static void TFO_Plugins_Install(const FOodleTextureVTable * VTable);
/**
*
#Loc: <Workspace>/Engine/Plugins/Developer/TextureFormatOodle/Source/Private/TextureFormatOodle.cpp:568
Scope (from outer to inner):
file
class class FTextureFormatOodleConfig
function FTextureFormatOodleConfig
Source code excerpt:
FTextureFormatOodleConfig() :
bDebugColor(false),
GlobalLambdaMultiplier(1.f)
{
}
const FLocalDebugConfig& GetLocalDebugConfig() const
{
return LocalDebugConfig;
#Loc: <Workspace>/Engine/Plugins/Developer/TextureFormatOodle/Source/Private/TextureFormatOodle.cpp:591
Scope (from outer to inner):
file
class class FTextureFormatOodleConfig
function void ImportFromConfigCache
Source code excerpt:
GConfig->GetString(IniSection, TEXT("DebugDumpFilter"), LocalDebugConfig.DebugDumpFilter, GEngineIni);
GConfig->GetInt(IniSection, TEXT("LogVerbosity"), LocalDebugConfig.LogVerbosity, GEngineIni);
GConfig->GetFloat(IniSection, TEXT("GlobalLambdaMultiplier"), GlobalLambdaMultiplier, GEngineIni);
FString CmdLineString;
if (FParse::Value(FCommandLine::Get(), TEXT("-OodleDebugDumpFilter="), CmdLineString) )
{
UE_LOG(LogTextureFormatOodle, Display, TEXT("Enabling debug dump from command line: -OodleDebugDumpFilter=%s"), *CmdLineString);
LocalDebugConfig.DebugDumpFilter = CmdLineString;
#Loc: <Workspace>/Engine/Plugins/Developer/TextureFormatOodle/Source/Private/TextureFormatOodle.cpp:607
Scope (from outer to inner):
file
class class FTextureFormatOodleConfig
function void ImportFromConfigCache
Source code excerpt:
// sanitize config values :
if ( GlobalLambdaMultiplier <= 0.f )
{
GlobalLambdaMultiplier = 1.f;
}
UE_LOG(LogTextureFormatOodle,VerboseIfNotEditor,
TEXT("Oodle Texture TFO init; latest sdk version = %s"),TEXT(OodleTextureVersion)
);
#ifdef DO_FORCE_UNIQUE_DDC_KEY_PER_BUILD
#Loc: <Workspace>/Engine/Plugins/Developer/TextureFormatOodle/Source/Private/TextureFormatOodle.cpp:636
Scope (from outer to inner):
file
class class FTextureFormatOodleConfig
function FCbObject ExportToCb
Source code excerpt:
Writer.AddBool("bDebugColor", bDebugColor);
}
if (GlobalLambdaMultiplier != 1.f)
{
Writer.AddFloat("GlobalLambdaMultipler", GlobalLambdaMultiplier);
}
Writer.EndObject();
return Writer.Save().AsObject();
}
#Loc: <Workspace>/Engine/Plugins/Developer/TextureFormatOodle/Source/Private/TextureFormatOodle.cpp:711
Scope (from outer to inner):
file
class class FTextureFormatOodleConfig
function void GetOodleCompressParameters
Source code excerpt:
bool bUseDebugColor = InBuildSettings.FormatConfigOverride.FindView("bDebugColor").AsBool(bDebugColor);
float UseGlobalLambdaMultiplier = InBuildSettings.FormatConfigOverride.FindView("GlobalLambdaMultipler").AsFloat(GlobalLambdaMultiplier);
//
// Convert general build settings in to oodle relevant values.
//
int RDOLambda = InBuildSettings.OodleRDO;
if (RDOLambda > 0 && UseGlobalLambdaMultiplier != 1.f)
#Loc: <Workspace>/Engine/Plugins/Developer/TextureFormatOodle/Source/Private/TextureFormatOodle.cpp:793
Scope (from outer to inner):
file
class class FTextureFormatOodleConfig
Source code excerpt:
// (multiplies the default and per-Texture overrides)
// is intended to let you do last minute whole-game adjustment
float GlobalLambdaMultiplier;
FLocalDebugConfig LocalDebugConfig;
};
class FTextureFormatOodle : public ITextureFormat
{
public: