ShowFlag.LightRadius
ShowFlag.LightRadius
#Overview
name: ShowFlag.LightRadius
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 18
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.LightRadius is to control the visibility of light radius visualizations in the Unreal Engine editor and rendering system. This setting is primarily used for debugging and visualization purposes in the editor viewport.
- ShowFlag.LightRadius is mainly used by the rendering system, specifically for visualizing light sources in the editor.
- The Unreal Engine subsystems that rely on this setting variable are primarily the editor’s visualization components and the rendering system.
- The value of this variable is set through the engine’s show flags system, which allows toggling various visualization features in the editor.
- This variable interacts with other light-related properties, such as the actual light radius of point lights, spot lights, and rect lights.
- Developers should be aware that this flag is mainly for editor visualization and debugging purposes, and it doesn’t affect the actual light behavior in the game.
- Best practices when using this variable include:
- Use it for debugging light placement and coverage in the editor.
- Remember to disable it when not needed to reduce visual clutter.
- Don’t rely on it for gameplay or in-game visuals, as it’s an editor-only feature.
Regarding the associated variable LightRadius:
The purpose of LightRadius is to define the actual radius of a light source in the game world. This variable is used in various contexts within the engine:
- It’s used in the rendering system to determine the area affected by a light source.
- The Niagara particle system uses it for light-emitting particles.
- It’s used in editor tests and automation for light placement and manipulation.
- The variable is set directly on light components (e.g., PointLightComponent, RectLightComponent) and can be modified through Blueprint or C++ code.
- LightRadius interacts with other light properties like brightness, color, and attenuation.
- Developers should be aware that changing LightRadius affects both the visual appearance and performance of the lighting system.
- Best practices for using LightRadius include:
- Carefully balance the radius with light intensity for realistic lighting.
- Consider performance implications when using many large radius lights.
- Use it in conjunction with other light properties for fine-tuned lighting control.
- Remember that extremely large light radii can impact performance, especially with many overlapping lights.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:275
Scope: file
Source code excerpt:
SHOWFLAG_ALWAYS_ACCESSIBLE(Landscape, SFG_Normal, NSLOCTEXT("UnrealEd", "LandscapeSF", "Landscape"))
/** */
SHOWFLAG_FIXED_IN_SHIPPING(0, LightRadius, SFG_Advanced, NSLOCTEXT("UnrealEd", "LightRadiusSF", "Light Radius"))
/** Draws fog, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Fog, SFG_Normal, NSLOCTEXT("UnrealEd", "FogSF", "Fog"))
/** Draws Volumes */
SHOWFLAG_FIXED_IN_SHIPPING(0, Volumes, SFG_Advanced, NSLOCTEXT("UnrealEd", "VolumesSF", "Volumes"))
/** if this is a game viewport, needed? */
SHOWFLAG_ALWAYS_ACCESSIBLE(Game, SFG_Hidden, NSLOCTEXT("UnrealEd", "GameSF", "Game"))
#Associated Variable and Callsites
This variable is associated with another variable named LightRadius
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererLights.cpp:139
Scope (from outer to inner):
file
function FNiagaraDynamicDataBase* FNiagaraRendererLights::GenerateDynamicData
Source code excerpt:
const int32 VisTag = VisTagReader.GetSafe(ParticleIndex, DefaultVisibilityTag);
const bool bShouldRenderParticleLight = EnabledReader.GetSafe(ParticleIndex, DefaultEnabled).GetValue() && (VisTag == Properties->RendererVisibility);
const float LightRadius = RadiusReader.GetSafe(ParticleIndex, DefaultRadius) * Properties->RadiusScale;
if (bShouldRenderParticleLight && (LightRadius > 0.0f))
{
SimpleLightData& LightData = DynamicData->LightArray.AddDefaulted_GetRef();
const FLinearColor Color = ColorReader.GetSafe(ParticleIndex, DefaultColor);
const float Brightness = Properties->bAlphaScalesBrightness ? Color.A : 1.0f;
const FVector3f SimPos = PositionReader.GetSafe(ParticleIndex, DefaultPos);
LightData.LightEntry.Radius = LightRadius;
LightData.LightEntry.Color = FVector3f(Color) * Brightness + Properties->ColorAdd;
LightData.LightEntry.Exponent = Properties->bUseInverseSquaredFalloff ? 0 : ExponentReader.GetSafe(ParticleIndex, DefaultExponent);
LightData.LightEntry.InverseExposureBlend = InverseExposureBlend;
LightData.LightEntry.bAffectTranslucency = Properties->bAffectsTranslucency;
LightData.LightEntry.VolumetricScatteringIntensity = ScatteringReader.GetSafe(ParticleIndex, DefaultScattering);
LightData.LightEntry.SpecularScale = SpecularScaleReader.GetSafe(ParticleIndex, DefaultSpecularScale);
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererLights.cpp:163
Scope (from outer to inner):
file
function FNiagaraDynamicDataBase* FNiagaraRendererLights::GenerateDynamicData
Source code excerpt:
const bool bEnabled = DefaultEnabled.GetValue();
const int32 VisTag = DefaultVisibilityTag;
const float LightRadius = DefaultRadius * Properties->RadiusScale;
if (bEnabled && VisTag == Properties->RendererVisibility && LightRadius > 0.0f)
{
const FVector3f SimPos = DefaultPos;
const FLinearColor LightColor = DefaultColor;
const float LightExponent = DefaultExponent;
const float LightScattering = DefaultScattering;
const float Brightness = Properties->bAlphaScalesBrightness ? LightColor.A : 1.0f;
SimpleLightData& LightData = DynamicData->LightArray.AddDefaulted_GetRef();
LightData.LightEntry.Radius = LightRadius;
LightData.LightEntry.Color = FVector3f(LightColor) * Brightness + Properties->ColorAdd;
LightData.LightEntry.Exponent = Properties->bUseInverseSquaredFalloff ? 0 : LightExponent;
LightData.LightEntry.InverseExposureBlend = InverseExposureBlend;
LightData.LightEntry.bAffectTranslucency = Properties->bAffectsTranslucency;
LightData.LightEntry.VolumetricScatteringIntensity = LightScattering;
LightData.LightEntry.SpecularScale = Properties->SpecularScale;
#Loc: <Workspace>/Engine/Plugins/Tests/EditorTests/Source/EditorTests/Private/UnrealEd/EditorAutomationTests.cpp:66
Scope: file
Source code excerpt:
APointLight* PointLight;
float LightBrightness;
float LightRadius;
FVector LightLocation;
FColor LightColor;
PointLightParameters()
: PointLight(nullptr)
, LightBrightness(5000.0f)
, LightRadius(1000.0f)
, LightLocation(FVector(0.0f, 0.0f, 0.0f))
, LightColor(FColor::White)
{
}
};
#Loc: <Workspace>/Engine/Plugins/Tests/EditorTests/Source/EditorTests/Private/UnrealEd/EditorAutomationTests.cpp:89
Scope (from outer to inner):
file
function bool PointLightUpdateCommand::Update
Source code excerpt:
PointLightUsing.PointLight->SetLightColor(PointLightUsing.LightColor);
PointLightUsing.PointLight->TeleportTo(PointLightUsing.LightLocation, FRotator(0, 0, 0));
PointLightUsing.PointLight->SetRadius(PointLightUsing.LightRadius);
return true;
}
/**
* Duplicates a point light.
*/
#Loc: <Workspace>/Engine/Plugins/Tests/EditorTests/Source/EditorTests/Private/UnrealEd/EditorAutomationTests.cpp:699
Scope (from outer to inner):
file
function bool FLightPlacement::RunTest
Source code excerpt:
//Update the original point light actor.
LightParameters.LightRadius = 500.0f;
LightParameters.LightLocation = FVector(500.0f, 300.0f, 500.0f);
LightParameters.LightColor = FColor::White;
ADD_LATENT_AUTOMATION_COMMAND(PointLightUpdateCommand(LightParameters));
//Wait
ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(0.1f));
#Loc: <Workspace>/Engine/Source/Editor/ComponentVisualizers/Private/PointLightComponentVisualizer.cpp:26
Scope (from outer to inner):
file
function void FPointLightComponentVisualizer::DrawVisualization
Source code excerpt:
void FPointLightComponentVisualizer::DrawVisualization( const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI )
{
if(View->Family->EngineShowFlags.LightRadius)
{
const UPointLightComponent* PointLightComp = Cast<const UPointLightComponent>(Component);
if(PointLightComp != NULL)
{
FTransform LightTM = PointLightComp->GetComponentTransform();
LightTM.RemoveScaling();
#Loc: <Workspace>/Engine/Source/Editor/ComponentVisualizers/Private/RectLightComponentVisualizer.cpp:18
Scope (from outer to inner):
file
function void FRectLightComponentVisualizer::DrawVisualization
Source code excerpt:
void FRectLightComponentVisualizer::DrawVisualization( const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI )
{
if(View->Family->EngineShowFlags.LightRadius)
{
const URectLightComponent* RectLightComp = Cast<const URectLightComponent>(Component);
if(RectLightComp != NULL)
{
FTransform LightTM = RectLightComp->GetComponentTransform();
LightTM.RemoveScaling();
#Loc: <Workspace>/Engine/Source/Editor/ComponentVisualizers/Private/SpotLightComponentVisualizer.cpp:20
Scope (from outer to inner):
file
function void FSpotLightComponentVisualizer::DrawVisualization
Source code excerpt:
void FSpotLightComponentVisualizer::DrawVisualization( const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI )
{
if(View->Family->EngineShowFlags.LightRadius)
{
const USpotLightComponent* SpotLightComp = Cast<const USpotLightComponent>(Component);
if(SpotLightComp != NULL)
{
FTransform TransformNoScale = SpotLightComp->GetComponentTransform();
TransformNoScale.RemoveScaling();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleModules.cpp:3320
Scope (from outer to inner):
file
function void UParticleModuleLight::Render3DPreview
Source code excerpt:
const FVector LightPosition = bLocalSpace ? FVector(LocalToWorld.TransformPosition(Particle.Location)) : FVector(Particle.Location);
const FVector Size = Scale * (FVector)Particle.Size;
const float LightRadius = LightPayload->RadiusScale * (Size.X + Size.Y) / 2.0f;
DrawWireSphere(PDI, LightPosition, FColor::White, LightRadius, 18, SDPG_World);
}
}
}
#endif //#if WITH_EDITOR
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:275
Scope: file
Source code excerpt:
SHOWFLAG_ALWAYS_ACCESSIBLE(Landscape, SFG_Normal, NSLOCTEXT("UnrealEd", "LandscapeSF", "Landscape"))
/** */
SHOWFLAG_FIXED_IN_SHIPPING(0, LightRadius, SFG_Advanced, NSLOCTEXT("UnrealEd", "LightRadiusSF", "Light Radius"))
/** Draws fog, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Fog, SFG_Normal, NSLOCTEXT("UnrealEd", "FogSF", "Fog"))
/** Draws Volumes */
SHOWFLAG_FIXED_IN_SHIPPING(0, Volumes, SFG_Advanced, NSLOCTEXT("UnrealEd", "VolumesSF", "Volumes"))
/** if this is a game viewport, needed? */
SHOWFLAG_ALWAYS_ACCESSIBLE(Game, SFG_Hidden, NSLOCTEXT("UnrealEd", "GameSF", "Game"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsTransmittance.cpp:110
Scope: file
Source code excerpt:
uint32 LightChannelMask = 0;
uint32 ShadowChannelMask = 0;
float LightRadius = 0;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
// Clear transmittance Mask
class FHairStrandsClearTransmittanceMaskCS : public FGlobalShader
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsTransmittance.cpp:267
Scope (from outer to inner):
file
function static FRDGBufferRef AddHairStrandsVoxelTransmittanceMaskPass
Source code excerpt:
{
Parameters->TranslatedLightPosition_LightDirection = Params.TranslatedLightPosition_LightDirection;
Parameters->LightRadius = Params.LightRadius;
Parameters->RayMarchMaskTexture = ShadowMaskTexture ? ShadowMaskTexture : GSystemTextures.GetWhiteDummy(GraphBuilder);
Parameters->ShadowMaskBitsTexture = nullptr;
}
Parameters->ShadowChannelMask = FVector4f(0, 0, 0, 0);
Parameters->ShadowChannelMask[FMath::Clamp<uint32>(Params.ShadowChannelMask, 0, 3)] = 1.0f;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsTransmittance.cpp:400
Scope (from outer to inner):
file
function static FRDGBufferRef AddHairStrandsDeepShadowTransmittanceMaskPass
Source code excerpt:
Parameters->DeepShadow_Resolution = Params.DeepShadow_Resolution;
Parameters->TranslatedLightPosition_LightDirection = Params.TranslatedLightPosition_LightDirection;
Parameters->LightRadius = Params.LightRadius;
Parameters->DeepShadow_DepthBiasScale = Params.DeepShadow_DepthBiasScale;
Parameters->DeepShadow_DensityScale = Params.DeepShadow_DensityScale;
Parameters->DeepShadow_KernelAperture = GetDeepShadowKernelAperture();
Parameters->DeepShadow_KernelType = GetDeepShadowKernelType();
Parameters->DeepShadow_DebugMode = GetDeepShadowDebugMode();
Parameters->DeepShadow_LayerDepths = Params.DeepShadow_LayerDepths;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsTransmittance.cpp:818
Scope (from outer to inner):
file
function static FHairStrandsTransmittanceMaskData InternalRenderHairStrandsTransmittanceMask
Source code excerpt:
Params.DeepShadow_DomTexture = DeepShadowResources.LayersAtlasTexture;
Params.DeepShadow_Resolution = DeepShadowData.ShadowResolution;
Params.LightRadius = 0;
Params.LightChannelMask = LightSceneInfo->Proxy->GetLightingChannelMask();
Params.ShadowChannelMask = bProjectingForForwardShading ? LightSceneInfo->GetDynamicShadowMapChannel() : 0;
Params.DeepShadow_LayerDepths = ComputeDeepShadowLayerDepths(DeepShadowData.LayerDistribution);
Params.DeepShadow_AtlasSlotOffsets_AtlasSlotIndex[DeepShadowData.MacroGroupId] = FIntVector4(DeepShadowData.AtlasRect.Min.X, DeepShadowData.AtlasRect.Min.Y, DeepShadowData.AtlasSlotIndex, 0);
Params.DeepShadow_CPUTranslatedWorldToLightTransforms[DeepShadowData.MacroGroupId] = DeepShadowData.CPU_TranslatedWorldToLightTransform;
Params.DeepShadow_ViewInfoBuffer = DeepShadow_ViewInfoBufferSRV;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HairStrands/HairStrandsTransmittance.cpp:854
Scope (from outer to inner):
file
function static FHairStrandsTransmittanceMaskData InternalRenderHairStrandsTransmittanceMask
Source code excerpt:
Params.LightChannelMask = LightSceneInfo->Proxy->GetLightingChannelMask();
Params.ShadowChannelMask = bProjectingForForwardShading ? LightSceneInfo->GetDynamicShadowMapChannel() : 0;
Params.LightRadius = FMath::Max(LightParameters.SourceLength, LightParameters.SourceRadius);
Out.TransmittanceMask = AddHairStrandsVoxelTransmittanceMaskPass(
GraphBuilder,
SceneTextures,
View,
EHairTransmittancePassType::PerLight,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Shadows/ShadowSceneRenderer.cpp:216
Scope (from outer to inner):
file
function FVirtualShadowMapProjectionShaderData FShadowSceneRenderer::GetLocalLightProjectionShaderData
Source code excerpt:
Data.LightSourceRadius = ProjectedShadowInfo->GetLightSceneInfo().Proxy->GetSourceRadius();
Data.ResolutionLodBias = ResolutionLODBiasLocal;
Data.LightRadius = ProjectedShadowInfo->GetLightSceneInfo().Proxy->GetRadius();
Data.LightDirection = FVector3f(0, 0, 0); // Unused for local lights
Data.Flags = Flags;
Data.TexelDitherScale = ProjectedShadowInfo->GetLightSceneInfo().Proxy->GetVSMTexelDitherScale();
return Data;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapArray.h:92
Scope: file
Source code excerpt:
FVector3f PreViewTranslationHigh;
float LightRadius;
FVector3f PreViewTranslationLow;
// Slightly different meaning for clipmaps (includes camera pixel size scaling stuff) and local lights (raw bias)
float ResolutionLodBias = 0.0f;
// TODO: There are more local lights than directional