BaseLightmass.ini - A Summary From Various Posts

Hi all,

I created this thread to summarize all good information from DanielW about Lightmass and BaseLightmass.ini in UE4. Achieving realistic lighting and rendering (in real time!) for archviz with UE4 is impossible without touching the BaseLighmass.ini and changing some of its variables according to your needs/scenes. The default lighting values however are already good for games or quick proof of concept archviz, but as we all know by now, it’s not enough for realistic rendering archviz. Almost all important variables in BaseLightmass.ini need further explanation, since they seem to have tight relation with each other. Generally you can not just change one variable without changing other variables. So hopefully with this thread we can together dissecting and understand BaseLightmass.ini better. It would be best if DanielW also could post some insights here.

DISCLAIMER: I’m not an expert at BaseLightmass.ini. This thread mainly contains summary of explanations from DanielW, Epic’s rendering and GI solver engineer, and also some test results (and their setting values) from Koola and Rafareis123 that was based on Raghu’s sample scene. Thanks to Raghu whom had started this thread and that thread has made me touch BaseLightmass.ini file (something that I was trying to avoid, but it seems impossible to achieve good lighting setup without messing with BaseLightmass.ini).

DISCLAIMER 2: DanielW has developed ‘light portal’ to address some issues that was asked by Raghu in above thread. So this thread might become obsolete whenever the light portal comes with UE4.11 (early 2016, hopefully). But for now, we still have to mess around with BaseLightmass.ini to achieve best lighting setup.

Below is the content of BaseLightmass.ini. In general this file contains mainly three sections: initialization, lighting setup, and light quality presets (I’ve ordered the section so it follows [roughly] the lighting work flow described by DanielW). In this file I also inserted some comments from DanielW (and mine) about the variable and its effect. The most interesting part that you might be looking for to achieve best quality lighting starts from [DevOptions.PhotonMapping] section.



*; These are tweaked defaults for various lightmass solver and export settings
; Artist-oriented lightmass settings are in the editor UI
; Documentation for all of these is in UnrealLightmass/Public/SceneExport.h
; This ini is reloaded every time a lighting build begins, no need to restart*

[DevOptions.StaticLighting]
bAllowMultiThreadedStaticLighting=True
ViewSingleBounceNumber=-1
bUseBilinearFilterLightmaps=True
bCompressLightmaps=True
bUseConservativeTexelRasterization=True
bAccountForTexelSize=True
bUseMaxWeight=True
MaxTriangleLightingSamples=8
MaxTriangleIrradiancePhotonCacheSamples=4
bAllow64bitProcess=True
DefaultStaticMeshLightingRes=32
bAllowCropping=False
bGarbageCollectAfterExport=True
bRebuildDirtyGeometryForLighting=True

[DevOptions.StaticLightingSceneConstants]
StaticLightingLevelScale=1
VisibilityRayOffsetDistance=.1
VisibilityNormalOffsetDistance=3
VisibilityNormalOffsetSampleRadiusScale=.5
VisibilityTangentOffsetSampleRadiusScale=.8
SmallestTexelRadius=.1
*; Tweaked for a good tradeoff between 'Cache Indirect Photon Paths' time and Indirect photon emitting 'Sampling Lights' time*
LightGridSize=100
AutomaticImportanceVolumeExpandBy=500
MinimumImportanceVolumeExtentWithoutWarning=10000.0

[DevOptions.StaticLightingMaterial]
bUseDebugMaterial=False
ShowMaterialAttribute=None
*; Material export sizes default to very small to keep exports fast*
EmissiveSampleSize=128
DiffuseSampleSize=128
SpecularSampleSize=128
TransmissionSampleSize=256
NormalSampleSize=256
*; Terrain materials default to much higher resolution since each material typically covers a large area in world space*
TerrainSampleScalar=4
DebugDiffuse=(R=0.500000,G=0.500000,B=0.500000)
EnvironmentColor=(R=0.00000,G=0.00000,B=0.00000)

[DevOptions.MeshAreaLights]
bVisualizeMeshAreaLightPrimitives=False
*; Only emissive texels above .01 will be used to create mesh area lights*
EmissiveIntensityThreshold=.01
MeshAreaLightGridSize=100
MeshAreaLightSimplifyNormalAngleThreshold=25
MeshAreaLightSimplifyCornerDistanceThreshold=.5
MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold=.1
MeshAreaLightGeneratedDynamicLightSurfaceOffset=30

[DevOptions.PrecomputedDynamicObjectLighting]
bVisualizeVolumeLightSamples=False
bVisualizeVolumeLightInterpolation=False
NumHemisphereSamplesScale=2
SurfaceLightSampleSpacing=300
FirstSurfaceSampleLayerHeight=50
SurfaceSampleLayerHeightSpacing=250
NumSurfaceSampleLayers=2
DetailVolumeSampleSpacing=300
VolumeLightSampleSpacing=3000
*; Clamp the number of volume samples generated to ~15mb*
MaxVolumeSamples=250000
bUseMaxSurfaceSampleNum=True
*; Approximately clamp the number of surface samples generated to ~30mb (only for Landscape currently)*
MaxSurfaceLightSamples=500000

[DevOptions.PrecomputedVisibility]
bVisualizePrecomputedVisibility=False
bCompressVisibilityData=True
bPlaceCellsOnOpaqueOnly=True
NumCellDistributionBuckets=800
CellRenderingBucketSize=5
NumCellRenderingBuckets=5
PlayAreaHeight=220
MeshBoundsScale=1.2
VisibilitySpreadingIterations=1
MinMeshSamples=14
MaxMeshSamples=40
NumCellSamples=24
NumImportanceSamples=40

[DevOptions.PrecomputedVisibilityModeratelyAggressive]
MeshBoundsScale=1
VisibilitySpreadingIterations=1

[DevOptions.PrecomputedVisibilityMostAggressive]
MeshBoundsScale=1
VisibilitySpreadingIterations=0

[DevOptions.VolumeDistanceField]
VoxelSize=75
VolumeMaxDistance=900
NumVoxelDistanceSamples=800
*; Clamp the size of the volume distance field generated to ~15mb*
MaxVoxels=3992160

**; my note: This is the lighting setup**
**; my note: This section is for the first/basic lighting bounce (maybe?)**
[DevOptions.PhotonMapping]
bUsePhotonMapping=True
bUseFinalGathering=True
bUsePhotonDirectLightingInFinalGather=False
bVisualizeCachedApproximateDirectLighting=False
bUseIrradiancePhotons=True
bCacheIrradiancePhotonsOnSurfaces=True
bVisualizePhotonPaths=False
bVisualizePhotonGathers=True
bVisualizePhotonImportanceSamples=False
bVisualizeIrradiancePhotonCalculation=False
bEmitPhotonsOutsideImportanceVolume=False
ConeFilterConstant=1

*; 400 gives a smooth enough result without requiring a very large search*
**
; my note: should be used in combination with IndirectPhotonSearchDistance to eliminate leaking
;              if you increase this value, then IndirectPhotonSearchDistance should be increased too
;              value of 1000-2000 seems to be a good starting point
**
NumIrradianceCalculationPhotons=400

*; Allocating most final gather samples towards importance samples gives a good result as long as there are enough first bounce photons*
FinalGatherImportanceSampleFraction=.6
*; 10 degrees is a good tradeoff between capturing high frequency incident lighting at final gather points and covering the whole incident lighting domain with a limited number of importance directions*
FinalGatherImportanceSampleConeAngle=10
IndirectPhotonEmitDiskRadius=200

**; DanielW: IndirectPhotonEmitConeAngle used in combination with IndirectPhotonPathDensity to channel
;          indirect photons into small windows and doors where they are needed the most
; my note: use this to extend the indirect photons emitter radius, widen its trace area**
IndirectPhotonEmitConeAngle=30
MaxImportancePhotonSearchDistance=2000
MinImportancePhotonSearchDistance=20

*; Preview (quality) uses a very small number of importance directions*
NumImportanceSearchPhotons=10
OutsideImportanceVolumeDensityScale=.0005

**; DanielW: DirectPhotonDensity controls how many photons are emitted in this stage
;          Try jacking up DirectPhotonDensity, IndirectPhotonDensity, IndirectPhotonPathDensity,
;          IndirectIrradiancePhotonDensity by a factor of 10 or so to eliminate leaking artifacts
; my note: if you change the values above then you may need to change the value of
;          IndirectPhotonEmitConeAngle as well since it also need to work with IndirectPhotonPathDensity (see above)**
DirectPhotonDensity=350

*; Same as DirectPhotonDensity, since currently direct photons are only used to create irradiance photons*
DirectIrradiancePhotonDensity=350
DirectPhotonSearchDistance=200

**; DanielW: IndirectPhotonPathDensity controls how many paths are recorded
;          (how accurately we find small windows)**
IndirectPhotonPathDensity=5

*; Need a very high indirect photon density since first bounce photons are used to guide the final gather*
**; DanielW: IndirectPhotonDensity + IndirectIrradiancePhotonDensity controls
;          how many photons are emitted to represent multi-bounce lighting**
IndirectPhotonDensity=600
IndirectIrradiancePhotonDensity=300

**
; my note: should be used in combination with NumIrradianceCalculationPhotons to eliminate leaking
;              if you increase this value, then NumIrradianceCalculationPhotons also need to be increased as well
;              value between 1000-2000 seems to be a good start
**
IndirectPhotonSearchDistance=200

PhotonSearchAngleThreshold=.5
IrradiancePhotonSearchConeAngle=10
CachedIrradiancePhotonDownsampleFactor=2

**; my note: this section is moved below photon settings above,
;          to give a clear view of lighting work flow in UE4 as described by DanielW**
[DevOptions.StaticShadows]
*; Using area shadows by default instead of filtering in texture space*
bUseZeroAreaLightmapSpaceFilteredLights=False

**; DanielW: for static lights which use area shadows, NumShadowRays and NumPenumbraShadowRays
;          control the quality of the penumbra, more samples are needed to support
;          very large smooth penumbras**
NumShadowRays=8
NumPenumbraShadowRays=8

NumBounceShadowRays=1
bFilterShadowFactor=True
ShadowFactorGradientTolerance=0.5
bAllowSignedDistanceFieldShadows=True
MaxTransitionDistanceWorldSpace=50
ApproximateHighResTexelsPerMaxTransitionDistance=50
MinDistanceFieldUpsampleFactor=3
MinUnoccludedFraction=.005
StaticShadowDepthMapTransitionSampleDistanceX=100
StaticShadowDepthMapTransitionSampleDistanceY=100
StaticShadowDepthMapSuperSampleFactor=2

*; Clamp the number of shadow samples generated to ~8mb for huge levels*
StaticShadowDepthMapMaxSamples=4194304

[DevOptions.IrradianceCache]
bAllowIrradianceCaching=True
bUseIrradianceGradients=False
bShowGradientsOnly=False
bVisualizeIrradianceSamples=True

**; DanielW: Too much interpolation causes indirect shadows to be lost
;          The amount of reuse is controlled by three variables below.
;          During interpolation we can gather even more nearby irradiance samples
;          to further smooth the lighting**
RecordRadiusScale=.8
InterpolationMaxAngle=20
PointBehindRecordMaxAngle=10

*; Increase distance and angle constraints in the shading pass, which filters the interpolated result without losing too much detail.*
DistanceSmoothFactor=4
AngleSmoothFactor=4
*; Sky occlusion has less noise than normal GI, don't blur away details*
SkyOcclusionSmoothnessReduction=.5
*; Enforce a minimum sample rate on surfaces with no nearby occluders*
MaxRecordRadius=1024
CacheTaskSize=64
InterpolateTaskSize=64

**; my note: this section moved below IrradianceCache,
;          to give clear view of lighting work flow in UE4**
[DevOptions.ImportanceTracing]
bUseCosinePDF=False
bUseStratifiedSampling=True

**; DanielW: this variable controls how many rays there are at the base level of refinement step
;          for the final gather, which means direct shadowing for a skylight
; my note: used together with IndirectLightingQuality (in Lightmass World Settings) and NumHemisphereSamplesScale (in Quality Preset sections),
;          the end result formula seems to be IndirectLightingQuality * NumHemisphereSamples * NumHemisphereSamplesScale
;          I think it works better in 2^n step: 2 (2^1), 4 (2^2), 8 (2^3), 16 (2^4), 32 (2^5), etc.
**
NumHemisphereSamples=16

**
; my note: I'm guessing that MaxHemisphereRayAngle starts at 0
;          From my small experiment, increasing this to 179 gave me a brighter lit room
;          than the default value of 89 [90 degrees]**
MaxHemisphereRayAngle=89
bUseAdaptiveSolver=true

**
; DanielW: this var below controls how many refinement levels there are
; my note: need more experiments with this variable
**
NumAdaptiveRefinementLevels=2

**; DanielW: this var below controls how big of a neighbour difference there must be to refine a sector**
AdaptiveBrightnessThreshold=0.1
AdaptiveFirstBouncePhotonConeAngle=4

**; my note: Settings below are QUALITY PRESETS in UE Editor: Medium, High, and Production.
;          The Preview Quality only use 'basic' light settings above**
[DevOptions.StaticLightingMediumQuality]
NumShadowRaysScale=2
NumPenumbraShadowRaysScale=4
ApproximateHighResTexelsPerMaxTransitionDistanceScale=3
MinDistanceFieldUpsampleFactor=3
NumHemisphereSamplesScale=2
NumImportanceSearchPhotonsScale=1
NumDirectPhotonsScale=2
DirectPhotonSearchDistanceScale=.5
NumIndirectPhotonPathsScale=1
NumIndirectPhotonsScale=2
NumIndirectIrradiancePhotonsScale=2
RecordRadiusScaleScale=.75
InterpolationMaxAngleScale=1
IrradianceCacheSmoothFactor=.75
NumAdaptiveRefinementLevels=3
AdaptiveBrightnessThresholdScale=.5
AdaptiveFirstBouncePhotonConeAngleScale=1

[DevOptions.StaticLightingHighQuality]
NumShadowRaysScale=4
NumPenumbraShadowRaysScale=8
ApproximateHighResTexelsPerMaxTransitionDistanceScale=6
MinDistanceFieldUpsampleFactor=5
NumHemisphereSamplesScale=4
NumImportanceSearchPhotonsScale=2
NumDirectPhotonsScale=2
DirectPhotonSearchDistanceScale=.5
NumIndirectPhotonPathsScale=2
NumIndirectPhotonsScale=4
NumIndirectIrradiancePhotonsScale=2
RecordRadiusScaleScale=.75
InterpolationMaxAngleScale=.75
IrradianceCacheSmoothFactor=.75
NumAdaptiveRefinementLevels=3
AdaptiveBrightnessThresholdScale=.25
AdaptiveFirstBouncePhotonConeAngleScale=2

[DevOptions.StaticLightingProductionQuality]
NumShadowRaysScale=8
NumPenumbraShadowRaysScale=32
ApproximateHighResTexelsPerMaxTransitionDistanceScale=6
MinDistanceFieldUpsampleFactor=5
NumHemisphereSamplesScale=8
NumImportanceSearchPhotonsScale=3
NumDirectPhotonsScale=4
*; Decrease direct photon search distance so that we will have more accurate shadow transitions.  This requires a higher density of direct photons.*
DirectPhotonSearchDistanceScale=.5
NumIndirectPhotonPathsScale=2
*; Need a lot of indirect photons since we have increased the number of first bounce photons to use for final gathering with NumImportanceSearchPhotonsScale*
NumIndirectPhotonsScale=8
NumIndirectIrradiancePhotonsScale=2
*; Decreasing the record radius results in more records, which increases quality*
RecordRadiusScaleScale=.5625
InterpolationMaxAngleScale=.75
IrradianceCacheSmoothFactor=.75
NumAdaptiveRefinementLevels=3
AdaptiveBrightnessThresholdScale=.25
AdaptiveFirstBouncePhotonConeAngleScale=2.5


At the moment, that’s all information I can gather. If you guys know something about a variable in this BaseLightmass.ini and it’s effect to UE4 world, please do post your finding in this thread. This way we can learn together about BaseLightmass.ini because it’s such an important file to get best quality lighting in UE4.

Q & A Session With DanielW

Here’s the Q & A Session With DanielW

This is the samples that was provided by Rafareis123 and Koola using Raghu’s second test scene. They also provided their settings to achieve the result.

NumIrradianceCalculationPhotons and IndirectPhotonSearchDistance

The latest finding by Raghu about Koola and Rafaeris123 test result was this:

  • NumIrradianceCalculationPhotons=1000
    I’m guessing this variable is to define number of photons used for irradiance calculation. Default value is 400 and according to comment inside BaseLightmass.ini: “400 gives a smooth enough result without requiring a very large search”.

  • IndirectPhotonSearchDistance=1000
    I’m guessing this value is in Unreal unit (which is 1uu = 1cm). So in this case 1000uu = 1000cm = 10m. If my guess is true, then values more than 1000 is used for very large areas only. The default value is 200 (2m). What this variable do? Again I’m guessing this var is to define max distance to search for nearby photons.

@tupikp Very good reference. Thanks for compiling this together. Do you have any updates for 4.11.2 since your last post?

We should have a sticky post where people can download the actual revised .ini file from say Koola, Raghu, etc. for the latest version of UE4. It takes too long to decipher all the random info on the subject.

I totally disagree with you. People should learn what the values are doing. Even Koola didn’t know what the values are doing. But since he only created scenes, it was okay to just maximize the numbers.

Just copying numbers shouldn’t be the right thing to do.

That’s okay if people want to learn what the values are doing some of us just want to get our work done as quickly as possible. It won’t hurt anyone wanting to learn if the .ini file is available.

Hey guys. With 4.11 version, a lot things has changed. Please don’t use my past tests as reference point. I’m going to write a new article about it soon.

My latest work using 4.11 with lighting portals

Building time : about 40-50 minutes
Running at 180 FPS on a Geforce 980 ti

That’s beautiful man! Great work.

That’s great to hear. Looking forward to read your article.

@Haskellf Sorry for the late reply. Actually, I stop messing with .ini file since UE 4.11 preview 1. UE4.11 lightmass and the introduction of light portal is good enough for me to avoid the lighting problem commonly found in previous version of UE4s. I admit that I usually don’t go after 100% photo-realistic scenes though. When clients are happy with the scene (even when it’s not 100% photo-realistic), then I just stop changing the lighting and/or lightmass settings.

It really doesn’t hurt if people still experimenting with the .ini file, since the default values in the file are targeting good performance instead of excellent visuals.

@rafareis123 Wow! That’s just… wow! :smiley:

@rafareis123 Fantastic work! Could you briefly describe your method? Are you using a hybrid of Lightmaps with dynamic shadows or is this all Raytraced Distance Fields, DFAO and DFGI?

@tupikp I come from a feature film background, so realism and stylized renders are my preference. I am slowly transitioning from a Renderman, Vray and ClarisseIFX pipeline to that of UE4. It is great discovering the innards of the .ini files as it gives me greater control over the quality vs performance. Yes, performance is not a huge factor right now, but it will be when VR is put into the mix. For now, I have been reading through all the forum threads and trying to gain as much knowledge as possible.
I would be interested as to what workflow you are using in regards to Arch Viz? Are you using DFGI with DFAO and Raytraced DF or are you mixing Lightmaps with Dynamic lights? Is it even possible to mix Lightmaps with DFAO and raytraced DF? I haven’t tried it but that is my next test on my list.
There are so many variations and I am just trying to narrow down the most realistic workflow without confusing myself, but UE4 does hold a lot of promise for realtime rendering.

I think you should start a new thread with that question, the last thread we had about Lightmass and settings went way off the rails and I personally would like this thread to stay strictly on Lightmass settings and the .ini file.

@rafareis123 you are a stunner as usual :slight_smile: looking forward for your article. Still getting really dark results using skylight only, shall I relay on autoexposure to compensate? Your works are literally full of light

I am also wondering how everyone uses autoexposure and other post process settings? I also get really dark results even with 4.18 and the multi sky light bounce. Any info would be helpful.