r.NormalMapsForStaticLighting
r.NormalMapsForStaticLighting
#Overview
name: r.NormalMapsForStaticLighting
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to allow any static lighting to use normal maps for lighting computations.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.NormalMapsForStaticLighting is to control whether normal maps are used in static lighting computations. This setting variable is primarily used in the rendering system, specifically for static lighting calculations.
The Unreal Engine subsystems that rely on this setting variable are the rendering system and the lightmass system. It is referenced in the Engine and UnrealEd modules.
The value of this variable is set through the Console Variable system. It can be modified via the console, ini files, or through the URendererSettings class in the Engine’s configuration.
This variable interacts with the bUseNormalMapsForStaticLighting property in the URendererSettings class. It also affects the behavior of the FLightmassExporter class when generating material data and writing scene settings for lightmass calculations.
Developers must be aware that enabling this feature can increase the complexity and computation time of static lighting calculations. It may also affect the visual quality and accuracy of the lighting results.
Best practices when using this variable include:
- Consider the performance impact of enabling normal maps for static lighting, especially for large or complex scenes.
- Test the lighting results with and without this feature enabled to determine if the visual improvement justifies the increased computation time.
- Use this setting in conjunction with other lighting and material settings to achieve the desired visual result.
- Be consistent in its usage across a project to ensure uniform lighting quality.
- Document the chosen setting for this variable in the project’s technical specifications or art guidelines to maintain consistency across the development team.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3757
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarNormalMaps(
TEXT("r.NormalMapsForStaticLighting"),
0,
TEXT("Whether to allow any static lighting to use normal maps for lighting computations."),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarNumBufferedOcclusionQueries(
TEXT("r.NumBufferedOcclusionQueries"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:586
Scope (from outer to inner):
file
class class URendererSettings : public UDeveloperSettings
Source code excerpt:
UPROPERTY(config, EditAnywhere, Category=MiscLighting, meta=(
ConsoleVariable="r.NormalMapsForStaticLighting",
ToolTip="Whether to allow any static lighting to use normal maps for lighting computations."))
uint32 bUseNormalMapsForStaticLighting:1;
UPROPERTY(config, EditAnywhere, Category=ForwardRenderer, meta=(
ConsoleVariable="r.ForwardShading",
DisplayName = "Forward Shading",
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:1394
Scope (from outer to inner):
file
function void FLightmassExporter::BuildMaterialMap
Source code excerpt:
if( ErrorCode == NSwarm::SWARM_ERROR_FILE_FOUND_NOT )
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.NormalMapsForStaticLighting"));
const bool bUseNormalMapsForLighting = CVar->GetValueOnGameThread() != 0;
// Only generate normal maps if we'll actually need them for lighting
MaterialRenderer.BeginGenerateMaterialData(Material, bUseNormalMapsForLighting, NewChannelName, MaterialExportData);
}
else
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:2225
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
Scene.MaterialSettings.EnvironmentColor = FLinearColor(LevelSettings.EnvironmentColor) * LevelSettings.EnvironmentIntensity;
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.NormalMapsForStaticLighting"));
Scene.MaterialSettings.bUseNormalMapsForLighting = CVar->GetValueOnGameThread() != 0;
}
{
VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.MeshAreaLights"), TEXT("bVisualizeMeshAreaLightPrimitives"), bConfigBool, GLightmassIni));
Scene.MeshAreaLightSettings.bVisualizeMeshAreaLightPrimitives = bConfigBool;
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.MeshAreaLights"), TEXT("EmissiveIntensityThreshold"), Scene.MeshAreaLightSettings.EmissiveIntensityThreshold, GLightmassIni));