bRenderLightMapDensityGrayscale

bRenderLightMapDensityGrayscale

#Overview

name: bRenderLightMapDensityGrayscale

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 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bRenderLightMapDensityGrayscale is to control the rendering of lightmap density in grayscale mode. This setting is primarily used in the rendering system, specifically for visualizing lightmap density in the Unreal Engine editor.

This setting variable is primarily used by the Renderer module and the LevelEditor module in Unreal Engine. It’s part of the UEngine class, which is a core component of the engine.

The value of this variable is set in the UEngine class and can be toggled through the level editor actions. It’s defined as a UPROPERTY with the globalconfig specifier, which means it can be saved and loaded from configuration files.

bRenderLightMapDensityGrayscale interacts with other variables, notably:

  1. RenderLightMapDensityGrayscaleScale: Used when grayscale rendering is enabled.
  2. RenderLightMapDensityColorScale: Used when color rendering is enabled.

Developers should be aware that:

  1. Changing this variable affects the visualization of lightmap density in the editor.
  2. It’s a boolean value, so it’s either on (true) or off (false).
  3. When enabled, it uses the RenderLightMapDensityGrayscaleScale for scaling the grayscale representation.

Best practices when using this variable include:

  1. Use it in conjunction with the related scale variables to fine-tune the visualization.
  2. Remember to call SaveConfig() after changing the value to persist the change.
  3. Broadcast the RedrawAllViewports delegate to update the editor views after changing the value.
  4. Consider the performance impact when enabling this feature, especially in large scenes.

This variable provides a useful tool for developers to analyze and optimize lightmap usage in their scenes, helping to identify areas where lightmap resolution might need adjustment.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:293, section: [/Script/Engine.Engine]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/LevelEditorActions.cpp:1023

Scope (from outer to inner):

file
function     void FLevelEditorActionCallbacks::SetLightingDensityRenderGrayscale

Source code excerpt:

void FLevelEditorActionCallbacks::SetLightingDensityRenderGrayscale()
{
	GEngine->bRenderLightMapDensityGrayscale = !GEngine->bRenderLightMapDensityGrayscale;
	GEngine->SaveConfig();
	FEditorSupportDelegates::RedrawAllViewports.Broadcast();
}

bool FLevelEditorActionCallbacks::IsLightingDensityRenderGrayscaleChecked()
{
	return GEngine->bRenderLightMapDensityGrayscale;
}

void FLevelEditorActionCallbacks::SetLightingResolutionStaticMeshes( ECheckBoxState NewCheckedState )
{
	FLightmapResRatioAdjustSettings& Settings = FLightmapResRatioAdjustSettings::Get();
	Settings.bStaticMeshes = ( NewCheckedState == ECheckBoxState::Checked );

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:1272

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** If true, then render gray scale density. */
	UPROPERTY(globalconfig)
	uint32 bRenderLightMapDensityGrayscale:1;

	/** The scale factor when rendering gray scale density. */
	UPROPERTY(globalconfig)
	float RenderLightMapDensityGrayscaleScale;

	/** The scale factor when rendering color density. */

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightMapDensityRendering.h:145

Scope (from outer to inner):

file
class        class TLightMapDensityPS : public FMeshMaterialShader, public LightMapPolicyType::PixelParametersType
function     void GetShaderBindings

Source code excerpt:


		FVector4f OptionsParameter(
			GEngine->bRenderLightMapDensityGrayscale ? GEngine->RenderLightMapDensityGrayscaleScale : 0.0f,
			GEngine->bRenderLightMapDensityGrayscale ? 0.0f : GEngine->RenderLightMapDensityColorScale,
			(ShaderElementData.bTextureMapped == true) ? 1.0f : 0.0f,
			(ShaderElementData.bTextureMapped == false) ? 1.0f : 0.0f
			);
		ShaderBindings.Add(LightMapDensityDisplayOptions, OptionsParameter);
	}