MinImportancePhotonSearchDistance
MinImportancePhotonSearchDistance
#Overview
name: MinImportancePhotonSearchDistance
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 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MinImportancePhotonSearchDistance is to define the minimum search distance for importance photons in Unreal Engine’s lightmass system, which is part of the global illumination and static lighting calculation process.
This setting variable is primarily used in the lightmass and static lighting subsystems of Unreal Engine. It’s specifically utilized in the photon mapping process, which is a crucial part of the global illumination calculation.
The value of this variable is typically set in the Lightmass configuration file (GLightmassIni). It’s read from the “DevOptions.PhotonMapping” section of this configuration file.
MinImportancePhotonSearchDistance interacts with several other variables in the photon mapping settings, such as MaxImportancePhotonSearchDistance and NumImportanceSearchPhotons. Together, these variables control the search parameters for importance photons.
Developers should be aware that this variable directly affects the quality and performance of the lightmass calculation. A smaller value may result in more accurate lighting at the cost of increased computation time, while a larger value might speed up the process but potentially miss fine lighting details.
Best practices when using this variable include:
- Balancing it with MaxImportancePhotonSearchDistance to ensure an appropriate search range.
- Adjusting it based on the scale of your scene - larger scenes may require larger values.
- Fine-tuning it in conjunction with other photon mapping settings to achieve the desired balance between lighting quality and build time.
- Considering the impact on memory usage, as smaller search distances might require storing more photons.
It’s important to note that this variable is scaled by the StaticLightingLevelScale, so changes to the overall lighting scale will affect the effective search distance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseLightmass.ini:187, section: [DevOptions.PhotonMapping]
- INI Section:
DevOptions.PhotonMapping
- Raw value:
20
- Is Array:
False
#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:2378
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
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));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("DirectPhotonSearchDistance"), Scene.PhotonMappingSettings.DirectPhotonSearchDistance, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PhotonMapping"), TEXT("IndirectPhotonPathDensity"), Scene.PhotonMappingSettings.IndirectPhotonPathDensity, GLightmassIni));
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/ImportExport/LightmassScene.cpp:533
Scope (from outer to inner):
file
namespace Lightmass
function void FScene::ApplyStaticLightingScale
Source code excerpt:
PhotonMappingSettings.IndirectPhotonEmitDiskRadius *= SceneConstants.StaticLightingLevelScale;
PhotonMappingSettings.MaxImportancePhotonSearchDistance *= SceneConstants.StaticLightingLevelScale;
PhotonMappingSettings.MinImportancePhotonSearchDistance *= SceneConstants.StaticLightingLevelScale;
// Scale surface densities in world units
const float ScaleSquared = SceneConstants.StaticLightingLevelScale * SceneConstants.StaticLightingLevelScale;
PhotonMappingSettings.DirectPhotonDensity /= ScaleSquared;
PhotonMappingSettings.DirectIrradiancePhotonDensity /= ScaleSquared;
PhotonMappingSettings.DirectPhotonSearchDistance *= SceneConstants.StaticLightingLevelScale;
PhotonMappingSettings.IndirectPhotonPathDensity /= ScaleSquared;
PhotonMappingSettings.IndirectPhotonDensity /= ScaleSquared;
PhotonMappingSettings.IndirectIrradiancePhotonDensity /= ScaleSquared;
PhotonMappingSettings.IndirectPhotonSearchDistance *= SceneConstants.StaticLightingLevelScale;
*/
}
//----------------------------------------------------------------------------
// Light base class
//----------------------------------------------------------------------------
void FLight::Import( FLightmassImporter& Importer )
{
Importer.ImportData( (FLightData*)this );
Importer.ImportArray( LightTextureProfileData, FLightData::LightProfileTextureDataSize );
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/FinalGather.cpp:38
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::GatherVolumeImportancePhotonDirections
Source code excerpt:
WorldPosition,
PhotonMappingSettings.NumImportanceSearchPhotons,
PhotonMappingSettings.MinImportancePhotonSearchDistance,
PhotonMappingSettings.MaxImportancePhotonSearchDistance,
FoundPhotonSegments,
bDebugThisSample);
FirstHemisphereImportancePhotonDirections.Empty(FoundPhotonSegments.Num());
SecondHemisphereImportancePhotonDirections.Empty(FoundPhotonSegments.Num());
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/FinalGather.cpp:1560
Scope (from outer to inner):
file
namespace Lightmass
function FFinalGatherSample FStaticLightingSystem::CachePointIncomingRadiance
Source code excerpt:
Vertex.TriangleNormal,
PhotonMappingSettings.NumImportanceSearchPhotons,
PhotonMappingSettings.MinImportancePhotonSearchDistance,
PhotonMappingSettings.MaxImportancePhotonSearchDistance,
bDebugThisTexel,
false,
FoundPhotons,
DummyStats);
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:656
Scope (from outer to inner):
file
namespace Lightmass
class class FPhotonMappingSettings
Source code excerpt:
* Since it can early out once enough photons are found. For other scenes a small start distance will just cause redundant photon map searches.
*/
float MinImportancePhotonSearchDistance;
/** Number of importance photons to find at each irradiance cache sample that will be used to guide the final gather. */
int32 NumImportanceSearchPhotons;
/** Scales the density at which to gather photons outside of the importance volume, if one exists. */
float OutsideImportanceVolumeDensityScale;