IndirectPhotonEmitConeAngle

IndirectPhotonEmitConeAngle

#Overview

name: IndirectPhotonEmitConeAngle

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 IndirectPhotonEmitConeAngle is to control the angle around an indirect photon path in which indirect photons will be emitted from point, spot, and mesh area lights in Unreal Engine’s lighting system.

This setting variable is primarily used in Unreal Engine’s lighting and rendering subsystems, specifically in the Lightmass module, which is responsible for global illumination calculations.

The value of this variable is set in the Lightmass configuration file (GLightmassIni). It is read from the “DevOptions.PhotonMapping” section with the key “IndirectPhotonEmitConeAngle”.

IndirectPhotonEmitConeAngle interacts with other photon mapping settings, such as IndirectPhotonEmitDiskRadius, MaxImportancePhotonSearchDistance, and DirectPhotonDensity. It is used to initialize various light types, including point lights, spot lights, rect lights, and mesh area lights.

Developers must be aware that this variable is measured in degrees when set in the configuration file, but it is converted to radians when used in the lighting calculations. The value is clamped between 0 and 90 degrees before conversion.

Best practices when using this variable include:

  1. Adjusting it carefully to balance between light spread and performance.
  2. Considering its impact on different light types in the scene.
  3. Using it in conjunction with other photon mapping settings for optimal results.
  4. Remembering that smaller angles might result in more focused indirect lighting, while larger angles could create a more diffuse effect.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseLightmass.ini:185, section: [DevOptions.PhotonMapping]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:2375

Scope (from outer to inner):

file
function     void FLightmassExporter::WriteSceneSettings

Source code excerpt:

		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("IndirectPhotonEmitDiskRadius"), Scene.PhotonMappingSettings.IndirectPhotonEmitDiskRadius, GLightmassIni));
		float IndirectPhotonEmitConeAngleDegrees;
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("IndirectPhotonEmitConeAngle"), IndirectPhotonEmitConeAngleDegrees, GLightmassIni));
		Scene.PhotonMappingSettings.IndirectPhotonEmitConeAngle = FMath::Clamp(IndirectPhotonEmitConeAngleDegrees, 0.0f, 90.0f) * (float)PI / 180.0f;
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("MaxImportancePhotonSearchDistance"), Scene.PhotonMappingSettings.MaxImportancePhotonSearchDistance, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("MinImportancePhotonSearchDistance"), Scene.PhotonMappingSettings.MinImportancePhotonSearchDistance, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.PhotonMapping"), TEXT("NumImportanceSearchPhotons"), Scene.PhotonMappingSettings.NumImportanceSearchPhotons, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("OutsideImportanceVolumeDensityScale"), Scene.PhotonMappingSettings.OutsideImportanceVolumeDensityScale, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("DirectPhotonDensity"), Scene.PhotonMappingSettings.DirectPhotonDensity, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("DirectIrradiancePhotonDensity"), Scene.PhotonMappingSettings.DirectIrradiancePhotonDensity, GLightmassIni));

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/LightingSystem.cpp:505

Scope (from outer to inner):

file
namespace    Lightmass
function     FStaticLightingSystem::FStaticLightingSystem

Source code excerpt:

	for (int32 LightIndex = 0; LightIndex < InScene.PointLights.Num(); LightIndex++)
	{
		InScene.PointLights[LightIndex].Initialize(Scene.PhotonMappingSettings.IndirectPhotonEmitConeAngle);
		Lights.Add(&InScene.PointLights[LightIndex]);
	}

	for (int32 LightIndex = 0; LightIndex < InScene.SpotLights.Num(); LightIndex++)
	{
		InScene.SpotLights[LightIndex].Initialize(Scene.PhotonMappingSettings.IndirectPhotonEmitConeAngle);
		Lights.Add(&InScene.SpotLights[LightIndex]);
	}

	for (int32 LightIndex = 0; LightIndex < InScene.RectLights.Num(); LightIndex++)
	{
		InScene.RectLights[LightIndex].Initialize(Scene.PhotonMappingSettings.IndirectPhotonEmitConeAngle);
		Lights.Add(&InScene.RectLights[LightIndex]);
	}

	const FBoxSphereBounds3f EffectiveImportanceBounds = ImportanceBounds.SphereRadius > 0.0f ? ImportanceBounds : SceneBounds;
	for (int32 LightIndex = 0; LightIndex < MeshAreaLights.Num(); LightIndex++)
	{
		MeshAreaLights[LightIndex].Initialize(Scene.PhotonMappingSettings.IndirectPhotonEmitConeAngle, EffectiveImportanceBounds);
		Lights.Add(&MeshAreaLights[LightIndex]);
	}

	for (int32 LightIndex = 0; LightIndex < InScene.SkyLights.Num(); LightIndex++)
	{
		SkyLights.Add(&InScene.SkyLights[LightIndex]);

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:646

Scope (from outer to inner):

file
namespace    Lightmass
class        class FPhotonMappingSettings

Source code excerpt:


	/** Angle around an indirect photon path in which indirect photons will be emitted from point, spot and mesh area lights. */
	float IndirectPhotonEmitConeAngle;

	/** Maximum distance to search for importance photons. */
	float MaxImportancePhotonSearchDistance;

	/** 
	 * Distance to start searching for importance photons at.