SkyOcclusionSmoothnessReduction
SkyOcclusionSmoothnessReduction
#Overview
name: SkyOcclusionSmoothnessReduction
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 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of SkyOcclusionSmoothnessReduction is to control the smoothness of sky occlusion in the irradiance caching system used for global illumination calculations in Unreal Engine 5’s lighting system.
This setting variable is primarily used in the Lightmass module, which is responsible for static lighting calculations in Unreal Engine. It is specifically utilized in the irradiance caching system, which is a technique used to optimize global illumination calculations.
The value of this variable is typically set in the Lightmass configuration file (GLightmassIni) and is read during the scene export process in the Lightmass exporter.
SkyOcclusionSmoothnessReduction interacts with other irradiance caching settings such as DistanceSmoothFactor and AngleSmoothFactor. It specifically affects the interpolation of sky occlusion values when calculating indirect lighting.
Developers should be aware that this variable has a direct impact on the quality and performance of sky occlusion calculations in static lighting. A lower value will result in smoother sky occlusion, potentially reducing noise but also potentially losing some detail.
Best practices when using this variable include:
- Keep the value within the range of 0.1 to 1.0, as enforced by the engine.
- Adjust this value in conjunction with other irradiance caching settings for optimal results.
- Use higher values when more detailed sky occlusion is needed, and lower values when smoother results are desired.
- Test different values to find the right balance between quality and performance for your specific scene.
Remember that changes to this variable will require a rebuild of lighting to take effect, which can be time-consuming for large scenes.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseLightmass.ini:218, section: [DevOptions.IrradianceCache]
- INI Section:
DevOptions.IrradianceCache
- Raw value:
.5
- 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:2410
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
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));
}
// Modify settings based on the quality level required
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/LightingSystem.cpp:955
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::ValidateSettings
Source code excerpt:
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;
}
else if (InScene.GeneralSettings.IndirectLightingQuality > 10)
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/Radiosity.cpp:405
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::RadiositySetupTextureMapping
Source code excerpt:
FFinalGatherSample UnusedSecondLighting;
float UnusedBackfacingHitsFraction;
RadiosityCache.InterpolateLighting(CurrentVertex, false, false, IrradianceCachingSettings.SkyOcclusionSmoothnessReduction, SkyLighting, UnusedSecondLighting, UnusedBackfacingHitsFraction, MappingContext.DebugCacheRecords, RecordCollectorPtr);
if (GeneralSettings.ViewSingleBounceNumber < 0 || GeneralSettings.ViewSingleBounceNumber == 1)
{
IncidentLighting += SkyLighting.IncidentLighting + SkyLighting.StationarySkyLighting.IncidentLighting;
}
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/Radiosity.cpp:693
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::RadiosityIterationTextureMapping
Source code excerpt:
FFinalGatherSample UnusedSecondLighting;
float UnusedBackfacingHitsFraction;
RadiosityCache.InterpolateLighting(CurrentVertex, false, false, IrradianceCachingSettings.SkyOcclusionSmoothnessReduction, IterationLighting, UnusedSecondLighting, UnusedBackfacingHitsFraction, MappingContext.DebugCacheRecords);
const bool bIsTranslucent = TextureMapping->Mesh->IsTranslucent(TexelToVertex.ElementIndex);
const FLinearColor Reflectance = (bIsTranslucent ? FLinearColor::Black : TextureMapping->Mesh->EvaluateTotalReflectance(CurrentVertex, TexelToVertex.ElementIndex)) * (float)INV_PI;
const FLinearColor IterationRadiosity = IterationLighting.IncidentLighting * Reflectance;
if (GeneralSettings.ViewSingleBounceNumber < 0 || GeneralSettings.ViewSingleBounceNumber == PassIndex + 2)
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/TextureMapping.cpp:2970
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::ProcessInterpolateTask
Source code excerpt:
// Interpolate the indirect lighting from the irradiance cache
// Interpolation must succeed since this is the second pass
verify(Task->FirstBounceCache->InterpolateLighting(TexelVertex, false, bDebugThisTexel && GeneralSettings.ViewSingleBounceNumber == 1, IrradianceCachingSettings.SkyOcclusionSmoothnessReduction, IndirectLighting, SecondInterpolatedIndirectLighting, BackfacingHitsFraction, Task->MappingContext.DebugCacheRecords));
// Replace sky occlusion in the lighting sample that will be written into the lightmap with the interpolated sky occlusion using IrradianceCachingSettings.SkyOcclusionSmoothnessReduction
IndirectLighting.SkyOcclusion = SecondInterpolatedIndirectLighting.SkyOcclusion;
IndirectLighting.StationarySkyLighting = SecondInterpolatedIndirectLighting.StationarySkyLighting;
if (Task->TextureMapping->Mesh->UsesTwoSidedLighting(TexelToVertex.ElementIndex))
{
TexelVertex.WorldTangentX = -TexelVertex.WorldTangentX;
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/TextureMapping.cpp:2985
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::ProcessInterpolateTask
Source code excerpt:
FFinalGatherSample BackFaceSecondInterpolatedIndirectLighting;
// Interpolate indirect lighting for the back face
verify(Task->FirstBounceCache->InterpolateLighting(TexelVertex, false, bDebugThisTexel && GeneralSettings.ViewSingleBounceNumber == 1, IrradianceCachingSettings.SkyOcclusionSmoothnessReduction, BackFaceIndirectLighting, BackFaceSecondInterpolatedIndirectLighting, BackFaceBackfacingHitsFraction, Task->MappingContext.DebugCacheRecords));
BackFaceIndirectLighting.SkyOcclusion = BackFaceSecondInterpolatedIndirectLighting.SkyOcclusion;
// Average front and back face incident lighting
IndirectLighting = (BackFaceIndirectLighting + IndirectLighting) * 0.5f;
}
if (BackfacingHitsFraction > 0.5f && BackFaceBackfacingHitsFraction > 0.5f)
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:756
Scope (from outer to inner):
file
namespace Lightmass
class class FIrradianceCachingSettings
Source code excerpt:
* This is useful because sky occlusion tends to be less noisy than GI, so less smoothing is needed to hide noise.
*/
float SkyOcclusionSmoothnessReduction;
/** Largest radius an irradiance cache record can have. */
float MaxRecordRadius;
/**
* Task size for parallelization of irradiance cache population within a mapping. A mapping will be split into pieces of this size which allows other threads to help.