r.MeshStreaming
r.MeshStreaming
#Overview
name: r.MeshStreaming
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:
Experimental - When non zero, enables mesh stremaing.\n
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.MeshStreaming is to enable or disable mesh streaming in Unreal Engine 5. Mesh streaming is a feature that allows LODs (Levels of Detail) of meshes to stream in based on what is visible on the screen.
This setting variable is primarily used in the rendering system, specifically for mesh LOD management. It affects both static meshes and skeletal meshes.
The Unreal Engine subsystems that rely on this setting variable are:
- The rendering system
- The content streaming system
- The mesh LOD management system
The value of this variable is set through the URendererSettings class, which is part of the Engine’s configuration system. It can be modified through project settings or via console commands.
The associated variable CVarMeshStreaming interacts directly with r.MeshStreaming. It’s a console variable that shares the same value and purpose.
Developers must be aware of the following when using this variable:
- It’s a binary setting (0 or non-zero)
- It affects both static and skeletal meshes
- It’s marked as experimental
- Changing this setting requires a restart of the engine (ConfigRestartRequired = true)
Best practices when using this variable include:
- Consider performance implications when enabling mesh streaming
- Test thoroughly in various scenarios to ensure it doesn’t negatively impact your specific use case
- Be aware that it may interact with other streaming and LOD-related settings
Regarding the associated variable CVarMeshStreaming:
- It’s a console variable that directly corresponds to r.MeshStreaming
- It’s defined as read-only and render thread safe
- It’s used in the content streaming system to determine if mesh streaming is enabled
- Developers can use this variable to check the current state of mesh streaming in code
When working with either r.MeshStreaming or CVarMeshStreaming, developers should consider the performance trade-offs and ensure that their content is properly set up to take advantage of mesh streaming when enabled.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:135, section: [/Script/Engine.RendererSettings]
- INI Section:
/Script/Engine.RendererSettings
- Raw value:
True
- 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/RendererSettings.h:993
Scope (from outer to inner):
file
class class URendererSettings : public UDeveloperSettings
Source code excerpt:
UPROPERTY(config, EditAnywhere, Category = "Mesh Streaming", meta = (
ConsoleVariable="r.MeshStreaming",DisplayName="Mesh Streaming",
ToolTip="When enabled mesh LODs will stream in based on what is visible on screen.",
ConfigRestartRequired = true))
uint32 bMeshStreaming : 1;
UPROPERTY(config, EditAnywhere, Category = "Heterogeneous Volumes", meta = (
ConsoleVariable = "r.HeterogeneousVolumes", DisplayName = "Heterogeneous Volumes (Experimental)",
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ContentStreaming.cpp:31
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMeshStreaming(
TEXT("r.MeshStreaming"),
0,
TEXT("Experimental - ")
TEXT("When non zero, enables mesh stremaing.\n"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static int32 GNaniteCoarseMeshStreamingEnabled = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SkeletalMesh.cpp:5590
Scope (from outer to inner):
file
function bool USkeletalMesh::GetEnableLODStreaming
Source code excerpt:
}
static auto* VarMeshStreaming = IConsoleManager::Get().FindConsoleVariable(TEXT("r.MeshStreaming"));
if (VarMeshStreaming && VarMeshStreaming->GetInt() == 0)
{
return false;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp:2542
Scope (from outer to inner):
file
function bool UStaticMesh::GetEnableLODStreaming
Source code excerpt:
}
static auto* VarMeshStreaming = IConsoleManager::Get().FindConsoleVariable(TEXT("r.MeshStreaming"));
const bool bMeshStreamingDisabled = VarMeshStreaming && VarMeshStreaming->GetInt() == 0;
static auto* VarNaniteCoarseMeshStreaming = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Nanite.CoarseMeshStreaming"));
const bool bNaniteCoareMeshStreamingDisabled = VarNaniteCoarseMeshStreaming && VarNaniteCoarseMeshStreaming->GetInt() == 0;
if (bMeshStreamingDisabled && bNaniteCoareMeshStreamingDisabled)
#Associated Variable and Callsites
This variable is associated with another variable named CVarMeshStreaming
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ContentStreaming.cpp:30
Scope: file
Source code excerpt:
-----------------------------------------------------------------------------*/
static TAutoConsoleVariable<int32> CVarMeshStreaming(
TEXT("r.MeshStreaming"),
0,
TEXT("Experimental - ")
TEXT("When non zero, enables mesh stremaing.\n"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ContentStreaming.cpp:1034
Scope (from outer to inner):
file
function bool FStreamingManagerCollection::IsRenderAssetStreamingEnabled
Source code excerpt:
case EStreamableRenderAssetType::StaticMesh:
case EStreamableRenderAssetType::SkeletalMesh:
return FPlatformProperties::SupportsMeshLODStreaming() && CVarMeshStreaming.GetValueOnAnyThread() != 0;
case EStreamableRenderAssetType::NaniteCoarseMesh:
return FPlatformProperties::SupportsMeshLODStreaming() && GNaniteCoarseMeshStreamingEnabled != 0;
default:
break;
}
}