r.MeshReductionModule
r.MeshReductionModule
#Overview
name: r.MeshReductionModule
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Name of what mesh reduction module to choose. If blank it chooses any that exist.\n
It is referenced in 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.MeshReductionModule is to specify the mesh reduction plugin to use when simplifying mesh geometry in Unreal Engine 5. This setting is crucial for the engine’s mesh simplification and Level of Detail (LOD) generation system.
Unreal Engine subsystems that rely on this setting variable include:
- Mesh Simplification System
- MeshReductionInterface module
- MeshUtilities module
The value of this variable is set in multiple ways:
- Through the engine configuration file (GEngineIni)
- Via the UMeshSimplificationSettings class, which is a UDeveloperSettings subclass
- Through a console variable (CVarMeshReductionModule)
The associated variable MeshReductionModuleName interacts closely with r.MeshReductionModule. They share the same value and are used interchangeably in different parts of the engine.
Developers should be aware of the following when using this variable:
- Changing this variable requires a restart of the engine (ConfigRestartRequired=true)
- The specified module must exist, or the engine will log a warning
- This setting affects both static and skeletal mesh reduction
Best practices when using this variable include:
- Ensure the specified reduction module is compatible with your project’s requirements
- Be cautious when changing this setting, as it can significantly impact performance and visual quality
- Test thoroughly after changing the reduction module to ensure desired results
Regarding the associated variable MeshReductionModuleName:
- It is a FName property in the UMeshSimplificationSettings class
- It is exposed in the editor UI for easy configuration
- It is used to store and retrieve the mesh reduction module name throughout the engine
- When setting this variable, it also updates the console variable r.MeshReductionModule
Developers should use the UMeshSimplificationSettings class to interact with this setting in C++ code, rather than directly manipulating the console variable. This ensures proper synchronization between the different representations of the setting.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3394, section: [/Script/Engine.MeshSimplificationSettings]
- INI Section:
/Script/Engine.MeshSimplificationSettings
- Raw value:
"QuadricMeshReduction"
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/MeshSimplificationSettings.h:20
Scope (from outer to inner):
file
class class UMeshSimplificationSettings : public UDeveloperSettings
Source code excerpt:
public:
/** Mesh reduction plugin to use when simplifying mesh geometry */
UPROPERTY(config, EditAnywhere, Category=General, meta=(ConsoleVariable="r.MeshReductionModule", DisplayName="Mesh Reduction Plugin", ConfigRestartRequired=true))
FName MeshReductionModuleName;
UPROPERTY(config, EditAnywhere, Category=General, meta=(DisplayName="Mesh Reduction Backward Compatible", ConfigRestartRequired = true))
bool bMeshReductionBackwardCompatible;
ENGINE_API virtual void PostInitProperties() override;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/MeshSimplificationSettings.cpp:12
Scope: file
Source code excerpt:
static FAutoConsoleVariable CVarMeshReductionModule(
TEXT("r.MeshReductionModule"),
TEXT("QuadricMeshReduction"),
TEXT("Name of what mesh reduction module to choose. If blank it chooses any that exist.\n"),
ECVF_ReadOnly);
UMeshSimplificationSettings::UMeshSimplificationSettings(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
#Loc: <Workspace>/Engine/Source/Developer/MeshReductionInterface/Private/MeshReductionManagerModule.cpp:37
Scope (from outer to inner):
file
function void FMeshReductionManagerModule::StartupModule
Source code excerpt:
{
FString MeshReductionModuleName;
if (GConfig->GetString(TEXT("/Script/Engine.MeshSimplificationSettings"), TEXT("r.MeshReductionModule"), MeshReductionModuleName, GEngineIni))
{
MeshSimplificationSettings_CDO->SetMeshReductionModuleName(*MeshReductionModuleName);
}
FString SkeletalMeshReductionModuleName;
if (GConfig->GetString(TEXT("/Script/Engine.SkeletalMeshSimplificationSettings"), TEXT("r.SkeletalMeshReductionModule"), SkeletalMeshReductionModuleName, GEngineIni))
{
#Associated Variable and Callsites
This variable is associated with another variable named MeshReductionModuleName
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Developer/MeshReductionInterface/Private/MeshReductionManagerModule.cpp:36
Scope (from outer to inner):
file
function void FMeshReductionManagerModule::StartupModule
Source code excerpt:
// Update module names from config entries
{
FString MeshReductionModuleName;
if (GConfig->GetString(TEXT("/Script/Engine.MeshSimplificationSettings"), TEXT("r.MeshReductionModule"), MeshReductionModuleName, GEngineIni))
{
MeshSimplificationSettings_CDO->SetMeshReductionModuleName(*MeshReductionModuleName);
}
FString SkeletalMeshReductionModuleName;
if (GConfig->GetString(TEXT("/Script/Engine.SkeletalMeshSimplificationSettings"), TEXT("r.SkeletalMeshReductionModule"), SkeletalMeshReductionModuleName, GEngineIni))
{
SkeletalMeshSimplificationSettings_CDO->SetSkeletalMeshReductionModuleName(*SkeletalMeshReductionModuleName);
}
#Loc: <Workspace>/Engine/Source/Developer/MeshReductionInterface/Private/MeshReductionManagerModule.cpp:54
Scope (from outer to inner):
file
function void FMeshReductionManagerModule::StartupModule
Source code excerpt:
// Get configured module names.
FName MeshReductionModuleName = MeshSimplificationSettings_CDO->MeshReductionModuleName;
if (!FModuleManager::Get().ModuleExists(*MeshReductionModuleName.ToString()))
{
UE_LOG(LogMeshReduction, Display, TEXT("Mesh reduction module (r.MeshReductionModule) set to \"%s\" which doesn't exist."), *MeshReductionModuleName.ToString());
}
FName SkeletalMeshReductionModuleName = SkeletalMeshSimplificationSettings_CDO->SkeletalMeshReductionModuleName;
if (!FModuleManager::Get().ModuleExists(*SkeletalMeshReductionModuleName.ToString()))
{
UE_LOG(LogMeshReduction, Display, TEXT("Skeletal mesh reduction module (r.SkeletalMeshReductionModule) set to \"%s\" which doesn't exist."), *SkeletalMeshReductionModuleName.ToString());
#Loc: <Workspace>/Engine/Source/Developer/MeshReductionInterface/Private/MeshReductionManagerModule.cpp:97
Scope (from outer to inner):
file
function void FMeshReductionManagerModule::StartupModule
Source code excerpt:
// Is this a requested module?
const FName ModuleName(Module->GetName());
const bool bIsRequestedMeshReductionModule = ModuleName == MeshReductionModuleName;
const bool bIsRequestedSkeletalMeshReductionModule = ModuleName == SkeletalMeshReductionModuleName;
const bool bIsRequestedProxyLODReductionModule = ModuleName == HLODMeshReductionModuleName;
// Look for MeshReduction interface
IMeshReduction* StaticMeshReductionInterface = Module->GetStaticMeshReductionInterface();
#Loc: <Workspace>/Engine/Source/Developer/MeshUtilities/Private/MeshUtilities.cpp:5264
Scope (from outer to inner):
file
class class FMeshSimplifcationSettingsCustomization : public IDetailCustomization
function virtual void CustomizeDetails
Source code excerpt:
virtual void CustomizeDetails( IDetailLayoutBuilder& DetailBuilder ) override
{
MeshReductionModuleProperty = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UMeshSimplificationSettings, MeshReductionModuleName));
IDetailCategoryBuilder& Category = DetailBuilder.EditCategory(TEXT("General"));
IDetailPropertyRow& PropertyRow = Category.AddProperty(MeshReductionModuleProperty);
FDetailWidgetRow& WidgetRow = PropertyRow.CustomWidget();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/MeshSimplificationSettings.h:21
Scope (from outer to inner):
file
class class UMeshSimplificationSettings : public UDeveloperSettings
Source code excerpt:
/** Mesh reduction plugin to use when simplifying mesh geometry */
UPROPERTY(config, EditAnywhere, Category=General, meta=(ConsoleVariable="r.MeshReductionModule", DisplayName="Mesh Reduction Plugin", ConfigRestartRequired=true))
FName MeshReductionModuleName;
UPROPERTY(config, EditAnywhere, Category=General, meta=(DisplayName="Mesh Reduction Backward Compatible", ConfigRestartRequired = true))
bool bMeshReductionBackwardCompatible;
ENGINE_API virtual void PostInitProperties() override;
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/MeshSimplificationSettings.cpp:36
Scope (from outer to inner):
file
function void UMeshSimplificationSettings::SetMeshReductionModuleName
Source code excerpt:
void UMeshSimplificationSettings::SetMeshReductionModuleName(FName InMeshReductionModuleName)
{
MeshReductionModuleName = InMeshReductionModuleName;
CVarMeshReductionModule->Set(*MeshReductionModuleName.ToString());
}
void UMeshSimplificationSettings::PostInitProperties()
{
Super::PostInitProperties();