4.6K Views
April 20, 17
スライド概要
Epic Games Japan hold a meeting named "Lightmass Deep Dive" on July 30, 2016.
A Japanese architectural artist, Kenichi Makaya, created Casa Barragan on UE4. the architecture is a house of Mexican Architect, Luis Barragan. And he gave a presentation about making of the scene. .
CASA BARRAGAN Unreal Engine4
https://www.youtube.com/watch?v=Y7r28nO4iDU&feature=youtu.be
EGJ translated the slide for the presentation to English and published it.
Unreal Engineを開発・提供しているエピック ゲームズ ジャパンによる公式アカウントです。 勉強会や配信などで行った講演資料を公開しています。 公式サイトはこちら https://www.unrealengine.com/ja/
Lightmass Deep Dive #2 Practical usage of Lightmass in Architectural Visualization
Architectural Visualizer Kenichi Makaya
Profile • Creating architectural perspectives since 2008 as a freelancer. • Started creating architectural content with UE4 soon after its release.
CASA BARRAGAN
Scene Data Used in this Presentation Casa Barragan Forum Sample Reference Resources House of Mexican Architect, Luis Barragan https://forums.unrealengine.com/showthread.php? 88952-Lets-make-Lightmass-EPIC-(and -understandable)&p=413678&viewfull=1#post413678
Test PC Specs • CPU • Memory • GPU Core i7 4790K 4.0GHZ x 4 core 16GB GTX770
Presentation Theme
Improving Lightmass Details and Addressing Artifacts
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Production Settings with Normal Lighting Layout
Final Settings
Rendering Soft Indirect Lighting
Likely differs from optimizations for games
Procedure 1. Selecting Lights 2. Setting up the Scene 3. Testing Lighting 4. Lighting Sketch (Esquisse) 5. Final Lighting 6. Lightmass Deep Dive
1. Selecting Lights
Four Types of Lights: • Directional Light • Point Light • Spot Light • Sky Light
Light Mobility: Static or Stationary?
Designed mainly using Directional Light and Sky Light But encountered problems....
Insufficient diffraction of Indirect Light
Sky Light can calculate only one bounce of Indirect Light
Drawbacks of Sky Light Lighting from Sky Light only
Drawbacks of Sky Light Insufficient diffraction of Indirect Light
Because no photons are emitted
Emit Photons Emit No Photons • Directional Light • Point Light • Spot Light • Sky Light
Need Soft Indirect Lighting from the window
Spot Light placed in window Static Spot Light Source Radius 200
Both Light and Shadows are hard
Used Koola-style Bounce Card
What is a Koola Bounce Card? Supports multiple bounces of Indirect Light while enabling Soft Lighting.
Koola Bounce Card Size 200 x 200 cm
Static Spot Light Source Radius 200
Main Lights Used in Casa Barragan • Directional Light Stationary • Sky Light • Koola Bounce Card Static Static Spot Light Decided to try the above settings first
2. Setting up the Scene
Lightmass Importance Volume Placement Specifies Area for Volume Lighting Samples
Lightmass Portal Specifies Area of Focus for Final Gathering calculations
Improved Skylight Quality With Portal
Improved Skylight Quality Without Portal
Improved Skylight Quality With Portal
Improved Skylight Quality Without Portal
Reflection Capture Placement Without Reflection Captures, results are poor due to Skylight reflection
Reflection Capture Placement Better to temporarily place Reflection Captures to approximate the final image
PostProcess Off • Auto Exposure • Causes exposure changes • Bloom • Overly bright screen and poor results • Screen Space Ambient Occlusion (AO) Difficult to tell if results are from the light bake or from AO
Compress LightMaps off UMAP size 63MB UMAP size 90MB Not sure whether noise is caused by insufficient number of samples during light bake or by compression noise. Be careful of increase in Light map size!
3. Test Lighting
Adjusting Lighting Balance Preview or Medium Lighting Quality is good enough
Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 0 2m54s
Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 1 3m41s
Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 2 3m35s
Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 3 3m46s
Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 5 3m39s
Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 10 3m55s
Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 20 3m42s
Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 100 3m31s
Adjusting Num Indirect Lighting Bounces • Differences are practically unnoticeable at around 10 • Almost no influence on build time
4. Lighting Sketch (Esquisse)
Need detail in the Lightmaps How?
1. Higher Lightmap Resolution LightmapResolution = 512 LightmapResolution = 64 • Details lower than or equal to minimum texel of light map can not be captured
2. Decrease Static Lighting Level Scale (Decrease RecordRadiusScale of Irradiance caching) StaticLightingLevelScale = 1 StaticLightingLevelScale = 0.1 • Details smaller than RecordRadius can not be captured
This means... 1. Decrease Static Lighting Level Scale until required detail is present 2. Increase lightmap resolution until detail can be captured
1. Setting Static Lighting Level Scale
Details in photograph Details of shadows and bokeh around here need to be reproduced in our scene. Reference source http://motokimokito.blogspot.jp/
Static Lighting Level Scale = 1 (Default)
Static Lighting Level Scale = 0.5
Static Lighting Level Scale = 0.2
Static Lighting Level Scale =0.1 We’ll use this!
At this stage, do not worry about noise. Check the Detail.
Setting for Final Lighting Build
Reference source: http://motokimokito.blogspot.jp/ Is sufficient detail reproduced?
Influence on Dynamic Meshes Static Lighting Level Scale 1.0 Static Lighting Level Scale 0.1 Be careful! Decreasing Static Lighting Level Scale increases Volume Lighting Samples.
2. Setting Lightmap Resolution
Light Map Resolution 32
Light Map Resolution 64
Light Map Resolution 128
Light Map Resolution 256
Light Map Resolution 512
Light Map Resolution 1024
Detail of Direct Shadows Tempted to increase resolution to prevent jaggy shadows
Detail of Direct Shadows Used Cascaded Shadows instead to avoid increasing resolution
Lightmap Resolution was set
Is it enough to simply increase LightMapResolution for each mesh?
Adjusting UVs for Lightmaps is still required
Adjust to appropriate padding Padding between UV islands for Lightmap = 0
Adjust to appropriate padding Padding between UV islands for Lightmap = 4
64 4 Adjust padding to 4 texels
Adjusting Indirect Lighting Smoothness
Static Lighting Level Scale = 0.1 Indirect Lighting Quality = 5 Medium Decided on the above settings
Indirect Lighting Smoothness = 0.5 28m56s
Indirect Lighting Smoothness = 0.8 32m55s
Indirect Lighting Smoothness = 1 29m46s (Default Value)
Indirect Lighting Smoothness = 1.2 33m22s
Indirect Lighting Smoothness = 1.5 28m58s
Indirect Lighting Smoothness = 2.0 33m28s
Indirect Lighting Smoothness = 0.5 28m56s
Indirect Lighting Smoothness = 0.8 32m55s
Indirect Lighting Smoothness = 1 29m46s (Default Value)
Indirect Lighting Smoothness = 1.2 33m22s
Indirect Lighting Smoothness = 1.5 28m58s
Indirect Lighting Smoothness = 2.0 33m28s
Indirect Lighting Smoothness = 0.5 28m56s
Indirect Lighting Smoothness = 0.8 32m55s
Indirect Lighting Smoothness = 1 29m46s (Default Value)
Indirect Lighting Smoothness = 1.2 33m22s
Indirect Lighting Smoothness = 1.5 28m58s
Indirect Lighting Smoothness = 2.0 33m28s
Indirect Lighting Smoothness = 0.5 28m56s
Indirect Lighting Smoothness = 0.8 32m55s
Indirect Lighting Smoothness = 1 29m46s (Default Value)
Indirect Lighting Smoothness = 1.2 33m22s
Indirect Lighting Smoothness = 1.5 28m58s
Indirect Lighting Smoothness = 0.5 28m56s
Indirect Lighting Smoothness = 0.8 32m55s
Indirect Lighting Smoothness = 1 29m46s (Default Value)
Indirect Lighting Smoothness = 1.2 33m22s
Indirect Lighting Smoothness = 1.5 28m58s
Indirect Lighting Smoothness = 2.0 33m28s
Indirect Lighting Smoothness = 0.5 28m56s
Indirect Lighting Smoothness = 0.8 32m55s
Indirect Lighting Smoothness = 1 29m46s (Default Value)
Indirect Lighting Smoothness = 1.2 33m22s
Indirect Lighting Smoothness = 1.5 28m58s
Indirect Lighting Smoothness = 2.0 33m28s
How Indirect Lighting Smoothness works More Detail Improved Smoothness Increased Noise Less Detail Value Decreased 1.0 Value Increased
Basically, Indirect Lighting Smoothness=1.0 is acceptable.
The following values may be also be acceptable: If detail is important: 0.8 If smoothness is important: 1.2
5. Final Lighting
Addressing artifacts
Before that,
What are the Lighting Quality and Lightmass settings doing? In BaseLightmass.ini, we already mentioned: • Static Lighting Level Scale, • Num Indirect Lighting Bounces, and other settings including: Indirect Lighting Quality, Indirect Lighting Smoothness
Configuring BaseLightmass.ini
BaseLightmass.ini is in C:¥Program Files¥Epic Games¥4.12¥Engine¥Config
; 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 bUseEmbree=true bVerifyEmbree=false [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 [DevOptions.StaticShadows] ; Using area shadows by default instead of filtering in texture space bUseZeroAreaLightmapSpaceFilteredLights=False 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.ImportanceTracing] bUseCosinePDF=False bUseStratifiedSampling=True NumHemisphereSamples=16 MaxHemisphereRayAngle=89 bUseAdaptiveSolver=true NumAdaptiveRefinementLevels=2 AdaptiveBrightnessThreshold=1 AdaptiveFirstBouncePhotonConeAngle=4 [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 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 IndirectPhotonEmitConeAngle=30 MaxImportancePhotonSearchDistance=2000 MinImportancePhotonSearchDistance=20 ; Preview uses a very small number of importance directions NumImportanceSearchPhotons=10 OutsideImportanceVolumeDensityScale=.0005 DirectPhotonDensity=350 ; Same as DirectPhotonDensity, since currently direct photons are only used to create irradiance photons DirectIrradiancePhotonDensity=350 DirectPhotonSearchDistance=200 IndirectPhotonPathDensity=5 ; Need a very high indirect photon density since first bounce photons are used to guide the final gather IndirectPhotonDensity=600 IndirectIrradiancePhotonDensity=300 IndirectPhotonSearchDistance=200 PhotonSearchAngleThreshold=.5 IrradiancePhotonSearchConeAngle=10 CachedIrradiancePhotonDownsampleFactor=2 [DevOptions.IrradianceCache] bAllowIrradianceCaching=True bUseIrradianceGradients=False bShowGradientsOnly=False bVisualizeIrradianceSamples=True 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 [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
Whoa! So many settings!
When Lighting Quality is set to Production: [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
What do these each adjust? [DevOptions.StaticLightingProductionQuality] NumShadowRaysScale=8 NumPenumbraShadowRaysScale=32 ApproximateHighResTexelsPerMaxTransitionDistanceScale=6 Shadow Quality MinDistanceFieldUpsampleFactor=5 NumHemisphereSamplesScale=8 Number of rays in final gathering NumImportanceSearchPhotonsScale=3 NumDirectPhotonsScale=4 DirectPhotonSearchDistanceScale=.5 NumIndirectPhotonPathsScale=2 Number of photons and quality of photon mapping calculation NumIndirectPhotonsScale=8 NumIndirectIrradiancePhotonsScale=2 RecordRadiusScaleScale=.5625 InterpolationMaxAngleScale=.75 Irradiance Caching Quality IrradianceCacheSmoothFactor=.75 NumAdaptiveRefinementLevels=3 AdaptiveBrightnessThresholdScale=.25 AdaptiveFirstBouncePhotonConeAngleScale=2.5 Quality of Adaptive Sampling for Final Gathering
Scales important items collectively so that artists can adjust with just one setting
Possible to overwrite settings where necessary in DefaultLightmass.ini located in <ProjectName>¥Config
I will explain this later
Now, back to addressing artifacts
First, adjust Lighting Quality
Used Static Lighting Level Scale=0.1
Preview 2m16s
Medium 7m48s
High 13m58s
Production 30m22s
Quality is still insufficient
Need higher calculation accuracy for light
Adjust with Indirect Lighting Quality (Increase number of rays in final gathering)
Indirect Lighting Quality 1 Medium 7m48s
Indirect Lighting Quality 2 Medium 12m55s
Indirect Lighting Quality 5 Medium 29m46s
Indirect Lighting Quality 10 Medium 1h5m24s
Most artifacts disappear at 10
Static Lighting Level Scale=0.1 Indirect Lighting Quality=10 Production 4h10m24s
With Lighting Quality set to Production Level Static Lighting Level Scale×Indirect Lighting Quality =1.0 0.1 X 10 0.2 X 5 X 0.5 2 Artifacts can be reduced to an acceptable level when the above multiplication results in 1.0
Lightmass Settings Final Settings Static Lighting Level Scale= 0.1 Num Indirect Lighting Bounces=20 Indirect Lighting Quality = 10 Indirect Lighting Smoothness=1.0 Lighting Quality = Production
6. Lightmass Deep Dive
Let’s adjust Lightmass.ini
BaseLightmass.ini is in
C:¥Program Files¥Epic Games¥4.12¥Engine¥Config
; 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 bUseEmbree=true bVerifyEmbree=false [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 [DevOptions.StaticShadows] ; Using area shadows by default instead of filtering in texture space bUseZeroAreaLightmapSpaceFilteredLights=False 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.ImportanceTracing] bUseCosinePDF=False bUseStratifiedSampling=True NumHemisphereSamples=16 MaxHemisphereRayAngle=89 bUseAdaptiveSolver=true NumAdaptiveRefinementLevels=2 AdaptiveBrightnessThreshold=1 AdaptiveFirstBouncePhotonConeAngle=4 [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 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 IndirectPhotonEmitConeAngle=30 MaxImportancePhotonSearchDistance=2000 MinImportancePhotonSearchDistance=20 ; Preview uses a very small number of importance directions NumImportanceSearchPhotons=10 OutsideImportanceVolumeDensityScale=.0005 DirectPhotonDensity=350 ; Same as DirectPhotonDensity, since currently direct photons are only used to create irradiance photons DirectIrradiancePhotonDensity=350 DirectPhotonSearchDistance=200 IndirectPhotonPathDensity=5 ; Need a very high indirect photon density since first bounce photons are used to guide the final gather IndirectPhotonDensity=600 IndirectIrradiancePhotonDensity=300 IndirectPhotonSearchDistance=200 PhotonSearchAngleThreshold=.5 IrradiancePhotonSearchConeAngle=10 CachedIrradiancePhotonDownsampleFactor=2 [DevOptions.IrradianceCache] bAllowIrradianceCaching=True bUseIrradianceGradients=False bShowGradientsOnly=False bVisualizeIrradianceSamples=True 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 [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
Don’t worry!
Copy, paste, and edit values only where tuning is required, then put it in <ProjectName>¥Config as “DefaultLightmass.ini”
For example, when area shadow quality needs to be improved,
Increase shadow detail in DefaultLightmass.ini Default Values for Medium Setting
Allows tuning that is not available in Editor NumShadowRaysScale=16 NumPenumbraShadowRaysScale=64
Simply copy and paste from BaseLightmass.ini, and change the values Save as ”DefaultLightmass.ini” in <ProjectName>¥Config
Experimented with the various config file settings
Quality improves as number of rays increases but processing takes longer
Improving Final Gathering Increasing Indirect Lighting Quality ↓ Increases Number of Rays in Final gathering
Sufficient Rays Insufficient Rays Insufficient Rays Sufficient Rays Increasing rays across the entire area may be wasteful...
Improving Final Gathering Increasing Indirect Lighting Quality increases rays even where unnecessary ↓ Use adaptive sampling to increase rays only where necessary ↓ Increase level of adaptive sampling refinement or Decrease threshold of intensity when increasing the level
Increase level of adaptive sample refinement NumAdaptiveRefinementLevel
NumAdaptiveRefinementLevels = 0 Medium 1 m16s
NumAdaptiveRefinementLevels = 1 Medium 2 m15s
NumAdaptiveRefinementLevels = 2 Medium 4 m43s (Default Value when Lighting Quality is Preview)
NumAdaptiveRefinementLevels = 3 Medium 10 m59s (Default Value when Lighting Quality is Medium, High, or Production)
NumAdaptiveRefinementLevels = 4 Medium 34 m45s
Adjust threshold to increase level of adaptive sample refinement AdaptiveBrightnessThresholdScale
Static Lighting Level Scale = 0.2 Indirect Lighting Quality = 5 Medium Decided on the above settings
NumAdaptiveRefinementLevels = 3 AdaptiveBrightnessThresholdScale = 0.5 (Medium Default) 3 m 28 s
NumAdaptiveRefinementLevels=3 AdaptiveBrightnessThresholdScale = 0.25 3 m 33 s
NumAdaptiveRefinementLevels = 3 AdaptiveBrightnessThresholdScale = 0.05 4 m 13 s
NumAdaptiveRefinementLevels = 4 AdaptiveBrightnessThresholdScale = 0.5 12 m 41 s
NumAdaptiveRefinementLevels = 5 AdaptiveBrightnessThresholdScale = 0.25 48 m 03 s
Why is it so time consuming? Let’s compare when set at Static Lighting Level Scale = 0.2 and Indirect Lighting Quality = 10 Production
Static Lighting Level Scale=0.2 Indirect Lighting Quality=10 Production 28m22s
NumAdaptiveRefinementLevels = 5 AdaptiveBrightnessThresholdScale = 0.25 48 m 03 s
Because cost performance is low, increasing the number of rays of Indirect Lighting Quality is better.
Be careful when using a value of 11 or more for Indirect Lighting Quality
When Indirect Lighting Quality>11, NumAdaptiveRefinementLevel +1
Build time increases substantially.
Adjust the number of rays in Lightmass.ini Adjust “NumHemisphereSamplesScale” for each Lighting Quality level Or [DevOptions.ImportanceTracing] NumHemisphereSamples can scale the number of rays as well.
Lightmass.ini includes all settings required to apply custom tuning to your content.
Lets make Lightmass Epic https://forums.unrealengine.com/showthread.php?88952-Letsmake-Lightmass-EPIC-(and-understandable) Talented artists including Koola study Lightmass
Conclusion
Understanding differences in the behaviors of various lights is important. Especially Sky light! Emit Photons Emit No Photon • Directional Light • Point Light • Spot Light • Koola Bounce Card • Sky Light • Use Emissive For Static Lighting
What does each setting influence? Setting Influence on Influence on Build time Shadow Photon Mapping Lighting Quality Irradiance Caching Final Gathering Overall Quality Settings High
What each setting influences on? Setting Influence on Details of Lightmass Static Lighting Level Scale (Irradiance Caching recording radius) Influence on Build time Medium Brightness of Scene Num Indirect Lighting Bounces (Number of photon reflections) Low Decreases artifact noise Indirect Lighting Quality Indirect Lighting Smoothness (Number of rays for final gathering) Blurs indirect light component in Lightmap (Irradiance Caching Interpolation Ratio) High Low
Lightmass Quality (Detail) & Build Time = Lightmap Resolution (Increases Resolution) × Lighting Quality (Improves Overall Quality) × Indirect Lighting Quality (Decreases Artifacts) ÷ Static Lighting Level Scale (Improves Detail)
Any feedback or suggestions for better solutions is always welcome!
Thank you! http://www.frames-cg.com/ @torashami