Practical usage of Lightmass in Architectural Visualization (Kenichi Makaya, UE4 Lightmass Deep Dive)

4.5K 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.

profile-image

Unreal Engineを開発・提供しているエピック ゲームズ ジャパンによる公式アカウントです。 勉強会や配信などで行った講演資料を公開しています。 公式サイトはこちら https://www.unrealengine.com/ja/

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
1.

Lightmass Deep Dive #2 Practical usage of Lightmass in Architectural Visualization

2.

Architectural Visualizer Kenichi Makaya

3.

Profile • Creating architectural perspectives since 2008 as a freelancer. • Started creating architectural content with UE4 soon after its release.

4.

CASA BARRAGAN

6.

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

7.

Test PC Specs • CPU • Memory • GPU Core i7 4790K 4.0GHZ x 4 core 16GB GTX770

8.

Presentation Theme

9.

Improving Lightmass Details and Addressing Artifacts

10.

Production Settings with Normal Lighting Layout

11.

Final Settings

12.

Production Settings with Normal Lighting Layout

13.

Final Settings

14.

Production Settings with Normal Lighting Layout

15.

Final Settings

16.

Production Settings with Normal Lighting Layout

17.

Final Settings

18.

Production Settings with Normal Lighting Layout

19.

Final Settings

20.

Production Settings with Normal Lighting Layout

21.

Final Settings

22.

Production Settings with Normal Lighting Layout

23.

Final Settings

24.

Production Settings with Normal Lighting Layout

25.

Final Settings

26.

Production Settings with Normal Lighting Layout

27.

Final Settings

28.

Production Settings with Normal Lighting Layout

29.

Final Settings

30.

Production Settings with Normal Lighting Layout

31.

Final Settings

32.

Production Settings with Normal Lighting Layout

33.

Final Settings

34.

Production Settings with Normal Lighting Layout

35.

Final Settings

36.

Rendering Soft Indirect Lighting

37.

Likely differs from optimizations for games

38.

Procedure 1. Selecting Lights 2. Setting up the Scene 3. Testing Lighting 4. Lighting Sketch (Esquisse) 5. Final Lighting 6. Lightmass Deep Dive

39.

1. Selecting Lights

40.

Four Types of Lights: • Directional Light • Point Light • Spot Light • Sky Light

41.

Light Mobility: Static or Stationary?

42.

Designed mainly using Directional Light and Sky Light But encountered problems....

43.

Insufficient diffraction of Indirect Light

44.

Sky Light can calculate only one bounce of Indirect Light

45.

Drawbacks of Sky Light Lighting from Sky Light only

46.

Drawbacks of Sky Light Insufficient diffraction of Indirect Light

47.

Because no photons are emitted

48.

Emit Photons Emit No Photons • Directional Light • Point Light • Spot Light • Sky Light

49.

Need Soft Indirect Lighting from the window

50.

Spot Light placed in window Static Spot Light Source Radius 200

51.

Both Light and Shadows are hard

52.

Used Koola-style Bounce Card

53.

What is a Koola Bounce Card? Supports multiple bounces of Indirect Light while enabling Soft Lighting.

54.

Koola Bounce Card Size 200 x 200 cm

55.

Static Spot Light Source Radius 200

56.

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

57.

2. Setting up the Scene

58.

Lightmass Importance Volume Placement Specifies Area for Volume Lighting Samples

59.

Lightmass Portal Specifies Area of Focus for Final Gathering calculations

60.

Improved Skylight Quality With Portal

61.

Improved Skylight Quality Without Portal

62.

Improved Skylight Quality With Portal

63.

Improved Skylight Quality Without Portal

64.

Reflection Capture Placement Without Reflection Captures, results are poor due to Skylight reflection

65.

Reflection Capture Placement Better to temporarily place Reflection Captures to approximate the final image

66.

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

67.

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!

68.

3. Test Lighting

69.

Adjusting Lighting Balance Preview or Medium Lighting Quality is good enough

70.

Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 0 2m54s

71.

Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 1 3m41s

72.

Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 2 3m35s

73.

Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 3 3m46s

74.

Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 5 3m39s

75.

Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 10 3m55s

76.

Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 20 3m42s

77.

Adjusting Num Indirect Lighting Bounces Num Indirect Lighting Bounces 100 3m31s

78.

Adjusting Num Indirect Lighting Bounces • Differences are practically unnoticeable at around 10 • Almost no influence on build time

79.

4. Lighting Sketch (Esquisse)

80.

Need detail in the Lightmaps How?

81.

1. Higher Lightmap Resolution LightmapResolution = 512 LightmapResolution = 64 • Details lower than or equal to minimum texel of light map can not be captured

82.

2. Decrease Static Lighting Level Scale (Decrease RecordRadiusScale of Irradiance caching) StaticLightingLevelScale = 1 StaticLightingLevelScale = 0.1 • Details smaller than RecordRadius can not be captured

83.

This means... 1. Decrease Static Lighting Level Scale until required detail is present 2. Increase lightmap resolution until detail can be captured

84.

1. Setting Static Lighting Level Scale

85.

Details in photograph Details of shadows and bokeh around here need to be reproduced in our scene. Reference source http://motokimokito.blogspot.jp/

86.

Static Lighting Level Scale = 1 (Default)

87.

Static Lighting Level Scale = 0.5

88.

Static Lighting Level Scale = 0.2

89.

Static Lighting Level Scale =0.1 We’ll use this!

90.

At this stage, do not worry about noise. Check the Detail.

91.

Setting for Final Lighting Build

92.

Reference source: http://motokimokito.blogspot.jp/ Is sufficient detail reproduced?

93.

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.

94.

2. Setting Lightmap Resolution

95.

Light Map Resolution 32

96.

Light Map Resolution 64

97.

Light Map Resolution 128

98.

Light Map Resolution 256

99.

Light Map Resolution 512

100.

Light Map Resolution 1024

101.

Detail of Direct Shadows Tempted to increase resolution to prevent jaggy shadows

102.

Detail of Direct Shadows Used Cascaded Shadows instead to avoid increasing resolution

103.

Lightmap Resolution was set

104.

Is it enough to simply increase LightMapResolution for each mesh?

105.

Adjusting UVs for Lightmaps is still required

106.

Adjust to appropriate padding Padding between UV islands for Lightmap = 0

107.

Adjust to appropriate padding Padding between UV islands for Lightmap = 4

108.

64 4 Adjust padding to 4 texels

109.

Adjusting Indirect Lighting Smoothness

110.

Static Lighting Level Scale = 0.1 Indirect Lighting Quality = 5 Medium Decided on the above settings

111.

Indirect Lighting Smoothness = 0.5 28m56s

112.

Indirect Lighting Smoothness = 0.8 32m55s

113.

Indirect Lighting Smoothness = 1 29m46s (Default Value)

114.

Indirect Lighting Smoothness = 1.2 33m22s

115.

Indirect Lighting Smoothness = 1.5 28m58s

116.

Indirect Lighting Smoothness = 2.0 33m28s

117.

Indirect Lighting Smoothness = 0.5 28m56s

118.

Indirect Lighting Smoothness = 0.8 32m55s

119.

Indirect Lighting Smoothness = 1 29m46s (Default Value)

120.

Indirect Lighting Smoothness = 1.2 33m22s

121.

Indirect Lighting Smoothness = 1.5 28m58s

122.

Indirect Lighting Smoothness = 2.0 33m28s

123.

Indirect Lighting Smoothness = 0.5 28m56s

124.

Indirect Lighting Smoothness = 0.8 32m55s

125.

Indirect Lighting Smoothness = 1 29m46s (Default Value)

126.

Indirect Lighting Smoothness = 1.2 33m22s

127.

Indirect Lighting Smoothness = 1.5 28m58s

128.

Indirect Lighting Smoothness = 2.0 33m28s

129.

Indirect Lighting Smoothness = 0.5 28m56s

130.

Indirect Lighting Smoothness = 0.8 32m55s

131.

Indirect Lighting Smoothness = 1 29m46s (Default Value)

132.

Indirect Lighting Smoothness = 1.2 33m22s

133.

Indirect Lighting Smoothness = 1.5 28m58s

134.

Indirect Lighting Smoothness = 0.5 28m56s

135.

Indirect Lighting Smoothness = 0.8 32m55s

136.

Indirect Lighting Smoothness = 1 29m46s (Default Value)

137.

Indirect Lighting Smoothness = 1.2 33m22s

138.

Indirect Lighting Smoothness = 1.5 28m58s

139.

Indirect Lighting Smoothness = 2.0 33m28s

140.

Indirect Lighting Smoothness = 0.5 28m56s

141.

Indirect Lighting Smoothness = 0.8 32m55s

142.

Indirect Lighting Smoothness = 1 29m46s (Default Value)

143.

Indirect Lighting Smoothness = 1.2 33m22s

144.

Indirect Lighting Smoothness = 1.5 28m58s

145.

Indirect Lighting Smoothness = 2.0 33m28s

146.

How Indirect Lighting Smoothness works More Detail Improved Smoothness Increased Noise Less Detail Value Decreased 1.0 Value Increased

147.

Basically, Indirect Lighting Smoothness=1.0 is acceptable.

148.

The following values may be also be acceptable: If detail is important: 0.8 If smoothness is important: 1.2

149.

5. Final Lighting

150.

Addressing artifacts

151.

Before that,

152.

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

153.

Configuring BaseLightmass.ini

154.

BaseLightmass.ini is in C:¥Program Files¥Epic Games¥4.12¥Engine¥Config

155.

; 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

156.

Whoa! So many settings!

157.

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

158.

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

159.

Scales important items collectively so that artists can adjust with just one setting

160.

Possible to overwrite settings where necessary in DefaultLightmass.ini located in <ProjectName>¥Config

161.

I will explain this later

162.

Now, back to addressing artifacts

163.

First, adjust Lighting Quality

164.

Used Static Lighting Level Scale=0.1

165.

Preview 2m16s

166.

Medium 7m48s

167.

High 13m58s

168.

Production 30m22s

169.

Quality is still insufficient

170.

Need higher calculation accuracy for light

171.

Adjust with Indirect Lighting Quality (Increase number of rays in final gathering)

172.

Indirect Lighting Quality 1 Medium 7m48s

173.

Indirect Lighting Quality 2 Medium 12m55s

174.

Indirect Lighting Quality 5 Medium 29m46s

175.

Indirect Lighting Quality 10 Medium 1h5m24s

176.

Most artifacts disappear at 10

177.

Static Lighting Level Scale=0.1 Indirect Lighting Quality=10 Production 4h10m24s

178.

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

179.

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

180.

6. Lightmass Deep Dive

181.

Let’s adjust Lightmass.ini

182.

BaseLightmass.ini is in

183.

C:¥Program Files¥Epic Games¥4.12¥Engine¥Config

184.

; 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

185.

Don’t worry!

186.

Copy, paste, and edit values only where tuning is required, then put it in <ProjectName>¥Config as “DefaultLightmass.ini”

187.

For example, when area shadow quality needs to be improved,

188.

Increase shadow detail in DefaultLightmass.ini Default Values for Medium Setting

189.

Allows tuning that is not available in Editor NumShadowRaysScale=16 NumPenumbraShadowRaysScale=64

190.

Simply copy and paste from BaseLightmass.ini, and change the values Save as ”DefaultLightmass.ini” in <ProjectName>¥Config

191.

Experimented with the various config file settings

192.

Quality improves as number of rays increases but processing takes longer

193.

Improving Final Gathering Increasing Indirect Lighting Quality ↓ Increases Number of Rays in Final gathering

194.

Sufficient Rays Insufficient Rays Insufficient Rays Sufficient Rays Increasing rays across the entire area may be wasteful...

195.

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

196.

Increase level of adaptive sample refinement NumAdaptiveRefinementLevel

197.

NumAdaptiveRefinementLevels = 0 Medium 1 m16s

198.

NumAdaptiveRefinementLevels = 1 Medium 2 m15s

199.

NumAdaptiveRefinementLevels = 2 Medium 4 m43s (Default Value when Lighting Quality is Preview)

200.

NumAdaptiveRefinementLevels = 3 Medium 10 m59s (Default Value when Lighting Quality is Medium, High, or Production)

201.

NumAdaptiveRefinementLevels = 4 Medium 34 m45s

202.

Adjust threshold to increase level of adaptive sample refinement AdaptiveBrightnessThresholdScale

203.

Static Lighting Level Scale = 0.2 Indirect Lighting Quality = 5 Medium Decided on the above settings

204.

NumAdaptiveRefinementLevels = 3 AdaptiveBrightnessThresholdScale = 0.5 (Medium Default) 3 m 28 s

205.

NumAdaptiveRefinementLevels=3 AdaptiveBrightnessThresholdScale = 0.25 3 m 33 s

206.

NumAdaptiveRefinementLevels = 3 AdaptiveBrightnessThresholdScale = 0.05 4 m 13 s

207.

NumAdaptiveRefinementLevels = 4 AdaptiveBrightnessThresholdScale = 0.5 12 m 41 s

208.

NumAdaptiveRefinementLevels = 5 AdaptiveBrightnessThresholdScale = 0.25 48 m 03 s

209.

Why is it so time consuming? Let’s compare when set at Static Lighting Level Scale = 0.2 and Indirect Lighting Quality = 10 Production

210.

Static Lighting Level Scale=0.2 Indirect Lighting Quality=10 Production 28m22s

211.

NumAdaptiveRefinementLevels = 5 AdaptiveBrightnessThresholdScale = 0.25 48 m 03 s

212.

Because cost performance is low, increasing the number of rays of Indirect Lighting Quality is better.

213.

Be careful when using a value of 11 or more for Indirect Lighting Quality

214.

When Indirect Lighting Quality>11, NumAdaptiveRefinementLevel +1

215.

Build time increases substantially.

216.

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.

217.

Lightmass.ini includes all settings required to apply custom tuning to your content.

218.

Lets make Lightmass Epic https://forums.unrealengine.com/showthread.php?88952-Letsmake-Lightmass-EPIC-(and-understandable) Talented artists including Koola study Lightmass

219.

Conclusion

220.

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

221.

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

222.

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

223.

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)

224.

Any feedback or suggestions for better solutions is always welcome!

225.

Thank you! http://www.frames-cg.com/ @torashami