SelectionHighlightIntensity

SelectionHighlightIntensity

#Overview

name: SelectionHighlightIntensity

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

#Summary

#Usage in the C++ source code

The purpose of SelectionHighlightIntensity is to control the intensity of the selection highlight overlay displayed when an object is selected in the Unreal Engine editor viewport.

This setting variable is primarily used by the Unreal Engine’s rendering system, specifically for editor and viewport functionality. Based on the callsites, it’s utilized in the following subsystems and modules:

  1. DisplayClusterLightCardEditorShaders plugin
  2. LandscapeEditor module
  3. UnrealEd module
  4. Engine core
  5. Renderer module

The value of this variable is set in multiple places:

  1. It’s initialized to 0.0f in the UEngine constructor (GameEngine.cpp).
  2. It’s set from the ULevelEditorViewportSettings in the UEditorEngine::InitEditor function (EditorEngine.cpp).
  3. It can be modified through the editor settings UI, as indicated by the UPROPERTY declaration in LevelEditorViewportSettings.h.

This variable interacts with other selection-related variables, such as:

  1. BSPSelectionHighlightIntensity (for BSP surface selection)
  2. SelectionHighlightIntensityBillboards (for billboard object selection)
  3. OutlineColor and SelectionOutlineColor (for setting the color of the selection outline)

Developers should be aware of the following when using this variable:

  1. It affects the visual feedback in the editor viewport, which is crucial for user experience.
  2. Changes to this value are applied in real-time, affecting the rendering of selected objects.
  3. It’s used in shader calculations, so extreme values might lead to unexpected visual results.

Best practices when using this variable include:

  1. Keep the value within a reasonable range (the UI suggests 0 to 1) to maintain clear visual feedback without overwhelming the scene.
  2. Consider user preferences and accessibility when setting default values.
  3. Allow users to adjust this value in the editor settings for personalized experiences.
  4. When programmatically modifying this value, ensure it’s done in a thread-safe manner, as it’s accessed during rendering.
  5. Be aware of its impact on performance, especially in scenes with many selected objects, as it affects per-object shader calculations.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:448, section: [/Script/UnrealEd.LevelEditorViewportSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayClusterLightCardEditorShaders/Private/DisplayClusterMeshProjectionRenderer.cpp:1487

Scope (from outer to inner):

file
function     void FDisplayClusterMeshProjectionRenderer::AddSelectionOutlineScreenPass

Source code excerpt:

	ScreenPassParameters->EditorPrimitivesStencil = GraphBuilder.CreateSRV(FRDGTextureSRVDesc::CreateWithPixelFormat(SelectionDepth, PF_X24_G8));
	ScreenPassParameters->OutlineColor = FVector3f(View->SelectionOutlineColor);
	ScreenPassParameters->SelectionHighlightIntensity = GEngine->SelectionHighlightIntensity;

	FGlobalShaderMap* GlobalShaderMap = GetGlobalShaderMap(View->FeatureLevel);

	TShaderMapRef<FScreenPassVS> ScreenPassVS(GlobalShaderMap);
	TShaderMapRef<FMeshProjectionSelectionOutlinePS> SelectionOutlinePS(GlobalShaderMap);
	if (!ScreenPassVS.IsValid() || !SelectionOutlinePS.IsValid())

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeRampTool.cpp:331

Scope (from outer to inner):

file
class        class FLandscapeToolRamp : public FLandscapeTool
function     virtual void Render

Source code excerpt:

			const FTransform LandscapeToWorld = LandscapeProxy->LandscapeActorToWorld();

			const FLinearColor SelectedSpriteColor = FLinearColor::White + (GEngine->GetSelectedMaterialColor() * GEngine->SelectionHighlightIntensity * 10);

			FVector WorldPoints[2];
			for (int32 i = 0; i < NumPoints; i++)
			{
				WorldPoints[i] = LandscapeToWorld.TransformPosition(Points[i]);
			}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorViewportSettings.h:525

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** Sets the intensity of the overlay displayed when an object is selected */
	UPROPERTY(EditAnywhere, config, Category=LookAndFeel, meta=(DisplayName = "Selection Highlight Intensity" ,ClampMin = "0", UIMin = "0", UIMax = "1"))
	float SelectionHighlightIntensity;

	/** Sets the intensity of the overlay displayed when an object is selected */
	UPROPERTY(EditAnywhere, config, Category=LookAndFeel, AdvancedDisplay, meta=(DisplayName = "BSP Surface Highlight Intensity" ,ClampMin = "0", UIMin = "0", UIMax = "1"))
	float BSPSelectionHighlightIntensity;

	/** Enables the editor perspective camera to be dropped at the last PlayInViewport cam position */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorEngine.cpp:862

Scope (from outer to inner):

file
function     void UEditorEngine::InitEditor

Source code excerpt:

	GEngine->SetSelectionOutlineColor(StyleSettings->SelectionColor);
	GEngine->SetSubduedSelectionOutlineColor(StyleSettings->GetSubduedSelectionColor());
	GEngine->SelectionHighlightIntensity = ViewportSettings->SelectionHighlightIntensity;
	GEngine->BSPSelectionHighlightIntensity = ViewportSettings->BSPSelectionHighlightIntensity;

	// Set navigation system property indicating whether navigation is supposed to rebuild automatically 
	FWorldContext &EditorContext = GetEditorWorldContext();
	FNavigationSystem::SetNavigationAutoUpdateEnabled(GetDefault<ULevelEditorMiscSettings>()->bNavigationAutoUpdate, EditorContext.World()->GetNavigationSystem());

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/SettingsClasses.cpp:989

Scope (from outer to inner):

file
function     void ULevelEditorViewportSettings::PostEditChangeProperty

Source code excerpt:

			: GetDefault<UEditorStyleSettings>()->SelectionColor);
	}
	else if (Name == GET_MEMBER_NAME_CHECKED(ULevelEditorViewportSettings, SelectionHighlightIntensity))
	{
		GEngine->SelectionHighlightIntensity = SelectionHighlightIntensity;
	}
	else if (Name == GET_MEMBER_NAME_CHECKED(ULevelEditorViewportSettings, BSPSelectionHighlightIntensity))
	{
		GEngine->BSPSelectionHighlightIntensity = BSPSelectionHighlightIntensity;
	}
	else if ((Name == FName(TEXT("UserDefinedPosGridSizes"))) || (Name == FName(TEXT("UserDefinedRotGridSizes"))) || (Name == FName(TEXT("ScalingGridSizes"))) || (Name == FName(TEXT("GridIntervals")))) //@TODO: This should use GET_MEMBER_NAME_CHECKED

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

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** Used to alter the intensity level of the selection highlight on selected objects */
	UPROPERTY(transient)
	float SelectionHighlightIntensity;

	/** Used to alter the intensity level of the selection highlight on selected BSP surfaces */
	UPROPERTY(transient)
	float BSPSelectionHighlightIntensity;

	/** Used to alter the intensity level of the selection highlight on selected billboard objects */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameEngine.cpp:778

Scope (from outer to inner):

file
function     UEngine::UEngine

Source code excerpt:

	C_BrushShape = FColor(128, 255, 128, 255);

	SelectionHighlightIntensity = 0.0f;
	BSPSelectionHighlightIntensity = 0.0f;

	SelectionHighlightIntensityBillboards = 0.25f;

	bIsInitialized = false;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp:1479

Scope (from outer to inner):

file
function     static FLinearColor ApplySelectionIntensity

Source code excerpt:

	static const float HoverIntensity = 0.15f;

	const float OverlayIntensity = bUseOverlayIntensity ? GEngine->SelectionHighlightIntensity : 1.0f;
	float ResultingIntensity = bSelected ? SelectedIntensity : (bHovered ? HoverIntensity : 0.0f);

	ResultingIntensity = (ResultingIntensity * OverlayIntensity) + BaseIntensity;

	FLinearColor ret = FinalColor * FMath::Pow(ResultingIntensity, 2.2f);
	ret.A = FinalColor.A;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessSelectionOutline.cpp:266

Scope: file

Source code excerpt:

		}
		PassParameters->OutlineColorIndexBits = 3;
		PassParameters->SelectionHighlightIntensity = GEngine->SelectionHighlightIntensity;
		PassParameters->BSPSelectionIntensity = GEngine->BSPSelectionHighlightIntensity;
		PassParameters->SecondaryViewportOffset = SecondaryViewOffset;

		EDisplayOutputFormat DisplayOutputFormat = View.Family->RenderTarget->GetDisplayOutputFormat();
		bool bIsHDR = false;
		bool bIsSCRGB = false;