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.
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.
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.
Code:
; 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
Comment