r.Nanite.AllowTessellation

r.Nanite.AllowTessellation

#Overview

name: r.Nanite.AllowTessellation

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Nanite.AllowTessellation is to enable support for experimental runtime tessellation within the Nanite system in Unreal Engine 5. This variable is primarily related to the rendering system, specifically the Nanite geometry virtualization technology.

Based on the callsites, this setting variable is primarily used in the Nanite rendering subsystem, which is part of Unreal Engine’s core rendering capabilities. It’s referenced in the Engine and RenderCore modules.

The value of this variable is set as a console variable with a default value of 0 (off by default). It can be modified at runtime through the console or configuration files.

This variable interacts with other Nanite-related variables, such as r.Nanite.AllowSplineMeshes and r.Nanite.AllowComputeMaterials, as seen in the shader key string generation.

Developers must be aware that this feature is described as “highly experimental” in the comments. This suggests that it may not be stable or fully functional, and could potentially cause issues or unexpected behavior in the rendering pipeline.

Best practices when using this variable include:

  1. Only enable it for testing or development purposes, not in production builds.
  2. Monitor performance and visual quality closely when enabled, as it may impact both.
  3. Be prepared to handle potential instabilities or rendering artifacts.
  4. Use in conjunction with other Nanite settings to ensure compatibility and optimal performance.
  5. Keep up-to-date with Unreal Engine documentation and release notes for any changes or improvements to this experimental feature.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Rendering/NaniteResources.cpp:82

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNaniteAllowTessellation(
	TEXT("r.Nanite.AllowTessellation"),
	0, // Off by default
	TEXT("Whether to enable support for (highly experimental) Nanite runtime tessellation"),
	ECVF_RenderThreadSafe | ECVF_ReadOnly);

static TAutoConsoleVariable<int32> CVarNaniteAllowSplineMeshes(
	TEXT("r.Nanite.AllowSplineMeshes"),

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1308

Scope (from outer to inner):

file
function     bool NaniteTessellationSupported

Source code excerpt:

bool NaniteTessellationSupported()
{
	static const auto AllowTessellation = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Nanite.AllowTessellation"));
	static const bool bAllowTessellation = (AllowTessellation && AllowTessellation->GetValueOnAnyThread() != 0);
	return bAllowTessellation;
}

bool NaniteSplineMeshesSupported()
{

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:2368

Scope (from outer to inner):

file
function     void ShaderMapAppendKeyString

Source code excerpt:

	if (UseNanite(Platform))
	{
		static const auto CVarAllowTess = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Nanite.AllowTessellation"));
		static const auto CVarAllowCSMat = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Nanite.AllowComputeMaterials"));
		static const auto CVarAllowPSMat = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Nanite.AllowLegacyMaterials"));

		KeyString.Appendf(
			TEXT("_Nanite-Tess%dCSMat%dPSMat%d"),
			CVarAllowTess ? CVarAllowTess->GetInt() : 0,