AngleSmoothFactor
AngleSmoothFactor
#Overview
name: AngleSmoothFactor
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 AngleSmoothFactor is to control the smoothness of irradiance caching in Unreal Engine’s lighting system, specifically for curved surfaces. It is used to filter the irradiance and adjust the interpolation of lighting data between cached points.
This setting variable is primarily used in the Lightmass subsystem, which is responsible for global illumination and static lighting calculations in Unreal Engine. It’s part of the IrradianceCachingSettings, indicating its importance in the irradiance caching process.
The value of this variable is typically set in the Lightmass configuration file (GLightmassIni). It’s read from the “DevOptions.IrradianceCache” section of this configuration file.
AngleSmoothFactor interacts with other variables in the IrradianceCachingSettings struct, such as DistanceSmoothFactor and InterpolationMaxAngle. It’s also influenced by the IndirectLightingSmoothness from the GeneralSettings.
Developers should be aware that:
- The value is clamped to be at least 1.0 (FMath::Max(AngleSmoothFactor, 1.0f)).
- It’s multiplied by the IndirectLightingSmoothness value, which can further increase its effect.
- It affects the calculation of InterpolationAngleNormalizationSmooth, which is used in the lighting interpolation process.
Best practices when using this variable include:
- Adjust it carefully, as it can significantly impact the quality and performance of lighting calculations.
- Consider the relationship between this variable and other smoothing factors (like DistanceSmoothFactor) to achieve the desired lighting result.
- Test different values in various lighting scenarios to find the optimal balance between quality and performance for your specific project.
- Remember that higher values will result in smoother lighting but may also introduce inaccuracies or loss of detail in areas with complex geometry or lighting conditions.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseLightmass.ini:216, section: [DevOptions.IrradianceCache]
- INI Section:
DevOptions.IrradianceCache
- Raw value:
4
- 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:2409
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.IrradianceCache"), TEXT("PointBehindRecordMaxAngle"), Scene.IrradianceCachingSettings.PointBehindRecordMaxAngle, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.IrradianceCache"), TEXT("DistanceSmoothFactor"), Scene.IrradianceCachingSettings.DistanceSmoothFactor, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.IrradianceCache"), TEXT("AngleSmoothFactor"), Scene.IrradianceCachingSettings.AngleSmoothFactor, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.IrradianceCache"), TEXT("SkyOcclusionSmoothnessReduction"), Scene.IrradianceCachingSettings.SkyOcclusionSmoothnessReduction, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.IrradianceCache"), TEXT("MaxRecordRadius"), Scene.IrradianceCachingSettings.MaxRecordRadius, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.IrradianceCache"), TEXT("CacheTaskSize"), Scene.IrradianceCachingSettings.CacheTaskSize, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.IrradianceCache"), TEXT("InterpolateTaskSize"), Scene.IrradianceCachingSettings.InterpolateTaskSize, GLightmassIni));
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:2480
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
VERIFYLIGHTMASSINI(GConfig->GetFloat(QualitySectionNames[QualityLevel], TEXT("IrradianceCacheSmoothFactor"), IrradianceCacheSmoothFactor, GLightmassIni));
Scene.IrradianceCachingSettings.DistanceSmoothFactor *= IrradianceCacheSmoothFactor;
Scene.IrradianceCachingSettings.AngleSmoothFactor *= IrradianceCacheSmoothFactor;
VERIFYLIGHTMASSINI(GConfig->GetInt(QualitySectionNames[QualityLevel], TEXT("NumAdaptiveRefinementLevels"), Scene.ImportanceTracingSettings.NumAdaptiveRefinementLevels, GLightmassIni));
float AdaptiveBrightnessThresholdScale;
VERIFYLIGHTMASSINI(GConfig->GetFloat(QualitySectionNames[QualityLevel], TEXT("AdaptiveBrightnessThresholdScale"), AdaptiveBrightnessThresholdScale, GLightmassIni));
Scene.ImportanceTracingSettings.AdaptiveBrightnessThreshold = Scene.ImportanceTracingSettings.AdaptiveBrightnessThreshold * AdaptiveBrightnessThresholdScale;
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/LightingCache.cpp:18
Scope (from outer to inner):
file
namespace Lightmass
function FLightingCacheBase::FLightingCacheBase
Source code excerpt:
InterpolationAngleNormalization = 1.0f / FMath::Sqrt(1.0f - FMath::Cos(InSystem.IrradianceCachingSettings.InterpolationMaxAngle * (float)PI / 180.0f));
const float AngleScale = FMath::Max(InSystem.IrradianceCachingSettings.AngleSmoothFactor * InSystem.GeneralSettings.IndirectLightingSmoothness, 1.0f);
InterpolationAngleNormalizationSmooth = 1.0f / FMath::Sqrt(1.0f - FMath::Cos(AngleScale * InSystem.IrradianceCachingSettings.InterpolationMaxAngle * (float)PI / 180.0f));
}
} //namespace Lightmass
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/LightingSystem.cpp:954
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::ValidateSettings
Source code excerpt:
InScene.IrradianceCachingSettings.PointBehindRecordMaxAngle = FMath::Clamp(InScene.IrradianceCachingSettings.PointBehindRecordMaxAngle, 0.0f, 90.0f);
InScene.IrradianceCachingSettings.DistanceSmoothFactor = FMath::Max(InScene.IrradianceCachingSettings.DistanceSmoothFactor, 1.0f);
InScene.IrradianceCachingSettings.AngleSmoothFactor = FMath::Max(InScene.IrradianceCachingSettings.AngleSmoothFactor, 1.0f);
InScene.IrradianceCachingSettings.SkyOcclusionSmoothnessReduction = FMath::Clamp(InScene.IrradianceCachingSettings.SkyOcclusionSmoothnessReduction, 0.1f, 1.0f);
if (InScene.GeneralSettings.IndirectLightingQuality > 50)
{
InScene.ImportanceTracingSettings.NumAdaptiveRefinementLevels += 2;
}
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:750
Scope (from outer to inner):
file
namespace Lightmass
class class FIrradianceCachingSettings
Source code excerpt:
* This effectively filters the irradiance on curved surfaces.
*/
float AngleSmoothFactor;
/**
* Scale applied to smoothness thresholds for sky occlusion.
* This is useful because sky occlusion tends to be less noisy than GI, so less smoothing is needed to hide noise.
*/
float SkyOcclusionSmoothnessReduction;