Upload
-epic-games-japan
View
5.206
Download
3
Embed Size (px)
Citation preview
Lightmass Deep Dive
#2 建築ビジュアライズにおける
Lightmass実践使用方法
建築ビジュアライズ制作者
ま かや けん いち
真 茅 健 一
活動内容
• 2008年よりフリーランスとして建築パースを制作
• UnrealEngine4の一般公開後まもなくより、UE4で建築コンテンツを制作
このセッションで使うシーンデータ
フォーラムサンプル引用元
https://forums.unrealengine.com/showthread.php?
88952-Lets-make-Lightmass-EPIC-(and
-understandable)&p=413678&viewfull=1#post413678
Casa Barragan
メキシコの建築家
ルイス・バラガンの自邸
https://youtu.be/Y7r28nO4iDU
検証用マシン
• CPU Core i7 4790K 4コア
• メモリ 16GB
• GPU GTX770
このセッションのテーマ
Lightmassでのディティールアップとモヤモヤ対策
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
普通にライトを置いてProduction設定
最終設定
やわらかな間接光の表現
ゲームでの最適化とはおそらく異なります。
おしながき
1. 使用ライトの選定
2. シーンセットアップ
3. テストライティング
4. ライティングエスキス
5. 最終ライティング
6. Lightmass Deep Dive
1.使用ライトの選定
4つのライト
•Directional Light
•Point Light
•Spot Light
•Sky Light
ライトの可動性はStatic か Stationary
Directional LightとSky Lightをメインに設計
しかし問題点が…
間接光が回り切らない
SkyLightは間接光のバウンスが一回しか計算出来ない
スカイライトの弱点
スカイライトのみでライティング
スカイライトの弱点
間接光が回り切らない
フォトンがでないから
フォトンがでるライト
• Directional Light
• Point Light
• Spot Light
フォトンがでないライト
• Sky Light
窓からの柔らかい間接光を表現したい
窓にスポットライトを置いてみる
Static Spot Light SourceRadius 100 (直径200cmの球体からのエリアシャドウ)
光も影も硬い。
Koola式バウンスカードを採用しました
Koola式バウンスカードとは
やわらかい光の表現をしつつ複数回の間接光のバウンスに対応できる
Koola式 バウンスカードサイズ 200x200cm
Static Spot Light SourceRadius 200
バラガン邸で使用したメインのライト
• Directional Light
• Sky Light
• Koola式バウンスカード
ひとまずこの方針でいくことに
Stationery
Static
Static Spot Light
2.シーンセットアップ
Lightmass Importance Volumeの配置
Volume Lighting Samplesの配置範囲を指定
Lightmass Portal
ファイナルギャザーの際にどこを重点的に計算するべきか教える
SkyLightの品質が改善
Portalあり
SkyLightの品質が改善
Portalなし
SkyLightの品質が改善
Portalあり
SkyLightの品質が改善
Portalなし
ReflectionCaptureの配置
何も置かないとスカイライトの反射でよくわからないことに
ReflectionCaptureの配置
最終のイメージをつかむために仮で入れておいたほうが良い
PostProcessのオフ
• Auto Exposure
•露出が変わってしまう。
• Bloom
•画面が明るくなりわかりにくい
• Screen Space Ambient Occlusion
ライトベイクの結果かAOの結果かわからない
Compress LightMapsのオフ
Compress On 63MB
モヤモヤの原因がライトベイク時のサンプル数不足か
圧縮によるノイズかわからない。ライトマップのサイズが増えるので注意。
Compress Off 90MB
3.テストライティング
ライティングバランスの調整
LightingQualityはPreviewかMediumで十分
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces 0 2m54s
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces 1 3m41s
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces 2 3m35s
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces 3 3m46s
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces 5 3m39s
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces 10 3m55s
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces 20 3m42s
Num Indirect Lighting Bounces の調整
Num Indirect Lighting Bounces 100 3m31s
Num Indirect Lighting Bounces の調整
• 「5」ぐらいで絵はほとんど変わらなくなる
•ほとんどビルド時間への影響はない
4.ライティングエスキス
ライトマップのディティールを出したい
どうやって?
1.ライトマップの高解像度化
• ライトマップの最小テクセル以下のディティールは記録できない
LightmapResolution=64LightmapResolution=512
2.Static Lighting Level Scaleを下げる
2.Static Lighting Level Scaleを下げる(イラディアンスキャッシュのRecordRadiusScaleを下げる)
• RecordRadiusより小さなディティールは記録できない
StaticLightingLevelScale=0.1StaticLightingLevelScale=1
つまり…
1.欲しいディティールがでるまで
Static Lighting Level Scaleを下げる。
2.引き出したディティールを記録できるまで
ライトマップ解像度を上げる
1.Static Lighting Level Scaleの設定
このへんの
影のディティールと
ボケ足感が欲しい
写真のディティール
引用元 http://motokimokito.blogspot.jp/
Static Lighting Level Scale =1 (デフォルト)
Static Lighting Level Scale =0.5
Static Lighting Level Scale =0.2
Static Lighting Level Scale =0.1 (今回の設定)
この段階ではモヤモヤは気にしない。
ディティールのチェック
最終ライティングビルドの設定
ディティールは出たかな?
引用元 http://motokimokito.blogspot.jp/
動的メッシュへの影響
Static Lighting Level Scaleを下げると
Volume Lighting Sampleが増えるので注意
Static Lighting Level Scale 1.0 Static Lighting Level Scale 0.1
2.ライトマップ解像度の設定
Light Map Resolution 32
Light Map Resolution 64
Light Map Resolution 128
Light Map Resolution 256 (今回の設定)
Light Map Resolution 512
Light Map Resolution 1024
ダイレクトシャドウのディティール
影のギザギザが嫌なら解像度を上げざるを得ない
ダイレクトシャドウのディティール
上げたくないのでカスケードシャドウを使いました。
ライトマップ解像度が決まった。
各メッシュのLightMapResolutionをあげるだけでいいか~
ライトマップ用UVの調整が残っていますね。
不適切なライトマップ用UV
ライトマップ用UV アイランド間のパディング=0
ライトマップ解像度に対して4テクセルのパディングになるように調整
64
4
適切なパディングに調整
ライトマップ用UV アイランド間のパディング=4
Indirect Lighting Smoothnessを調整
Static Lighting Level Scale =0.1
Indirect Lighitng Quality=5
Medium
の設定で固定
Indirect Lighting Smoothness=0.5 28m56s
Indirect Lighting Smoothness=0.8 32m55s
Indirect Lighting Smoothness=1 29m46s (デフォルト値)
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 (デフォルト値)
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 (デフォルト値)
Indirect Lighting Smoothness=1.2 33m22s
Indirect Lighting Smoothness=1.5 28m58s
Indirect Lighting Smoothness=2.0 33m28s
ディティールアップ
ノイズが増える(ビルド時間が増える)
スムーズUP(ビルド時間が短くなる)
ディティール消失
1.0値を下げる 値を上げる
Indirect Lighting Smoothnessの考察
基本的に
Indirect Lighting Smoothness=1.0で、よさそうです
ディティール重視の時は0.8
スムーズさ重視の時は1.2ぐらいは、ありかもしれません
5.最終ライティング
モヤモヤ(アーティファクト)を消していく
ちょっとその前に
Lighting Quality やLightmass Settingsって何してるの?
これまで触ってきた
• Static Lighting Level Scale
• Indirect Lighting Smoothness
他にも
• Indirect Lighting Quality
などなど…
BaseLightmass.iniをスケーリングしています
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=TrueViewSingleBounceNumber=-1bUseBilinearFilterLightmaps=TruebCompressLightmaps=TruebUseConservativeTexelRasterization=TruebAccountForTexelSize=TruebUseMaxWeight=TrueMaxTriangleLightingSamples=8MaxTriangleIrradiancePhotonCacheSamples=4bAllow64bitProcess=TrueDefaultStaticMeshLightingRes=32bAllowCropping=FalsebGarbageCollectAfterExport=TruebRebuildDirtyGeometryForLighting=TruebUseEmbree=truebVerifyEmbree=false
[DevOptions.StaticLightingSceneConstants]StaticLightingLevelScale=1VisibilityRayOffsetDistance=.1VisibilityNormalOffsetDistance=3VisibilityNormalOffsetSampleRadiusScale=.5VisibilityTangentOffsetSampleRadiusScale=.8SmallestTexelRadius=.1; Tweaked for a good tradeoff between 'Cache Indirect Photon Paths' time and Indirect photon emitting 'Sampling Lights' timeLightGridSize=100AutomaticImportanceVolumeExpandBy=500MinimumImportanceVolumeExtentWithoutWarning=10000.0
[DevOptions.StaticLightingMaterial]bUseDebugMaterial=FalseShowMaterialAttribute=None; Material export sizes default to very small to keep exports fastEmissiveSampleSize=128DiffuseSampleSize=128SpecularSampleSize=128TransmissionSampleSize=256NormalSampleSize=256; Terrain materials default to much higher resolution since each material typically covers a large area in world spaceTerrainSampleScalar=4DebugDiffuse=(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 lightsEmissiveIntensityThreshold=.01MeshAreaLightGridSize=100MeshAreaLightSimplifyNormalAngleThreshold=25MeshAreaLightSimplifyCornerDistanceThreshold=.5MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold=.1MeshAreaLightGeneratedDynamicLightSurfaceOffset=30
[DevOptions.PrecomputedDynamicObjectLighting]bVisualizeVolumeLightSamples=FalsebVisualizeVolumeLightInterpolation=FalseNumHemisphereSamplesScale=2SurfaceLightSampleSpacing=300FirstSurfaceSampleLayerHeight=50SurfaceSampleLayerHeightSpacing=250NumSurfaceSampleLayers=2DetailVolumeSampleSpacing=300VolumeLightSampleSpacing=3000; Clamp the number of volume samples generated to ~15mbMaxVolumeSamples=250000bUseMaxSurfaceSampleNum=True; Approximately clamp the number of surface samples generated to ~30mb (only for Landscape currently)MaxSurfaceLightSamples=500000
[DevOptions.PrecomputedVisibility]bVisualizePrecomputedVisibility=FalsebCompressVisibilityData=TruebPlaceCellsOnOpaqueOnly=TrueNumCellDistributionBuckets=800CellRenderingBucketSize=5NumCellRenderingBuckets=5PlayAreaHeight=220MeshBoundsScale=1.2VisibilitySpreadingIterations=1MinMeshSamples=14MaxMeshSamples=40NumCellSamples=24NumImportanceSamples=40
[DevOptions.PrecomputedVisibilityModeratelyAggressive]MeshBoundsScale=1VisibilitySpreadingIterations=1
[DevOptions.PrecomputedVisibilityMostAggressive]MeshBoundsScale=1VisibilitySpreadingIterations=0
[DevOptions.VolumeDistanceField]VoxelSize=75VolumeMaxDistance=900NumVoxelDistanceSamples=800; Clamp the size of the volume distance field generated to ~15mbMaxVoxels=3992160
[DevOptions.StaticShadows]; Using area shadows by default instead of filtering in texture spacebUseZeroAreaLightmapSpaceFilteredLights=FalseNumShadowRays=8NumPenumbraShadowRays=8NumBounceShadowRays=1bFilterShadowFactor=TrueShadowFactorGradientTolerance=0.5bAllowSignedDistanceFieldShadows=TrueMaxTransitionDistanceWorldSpace=50ApproximateHighResTexelsPerMaxTransitionDistance=50MinDistanceFieldUpsampleFactor=3MinUnoccludedFraction=.005StaticShadowDepthMapTransitionSampleDistanceX=100StaticShadowDepthMapTransitionSampleDistanceY=100StaticShadowDepthMapSuperSampleFactor=2; Clamp the number of shadow samples generated to ~8mb for huge levelsStaticShadowDepthMapMaxSamples=4194304
[DevOptions.ImportanceTracing]bUseCosinePDF=FalsebUseStratifiedSampling=TrueNumHemisphereSamples=16MaxHemisphereRayAngle=89bUseAdaptiveSolver=trueNumAdaptiveRefinementLevels=2AdaptiveBrightnessThreshold=1AdaptiveFirstBouncePhotonConeAngle=4
[DevOptions.PhotonMapping]bUsePhotonMapping=TruebUseFinalGathering=TruebUsePhotonDirectLightingInFinalGather=FalsebVisualizeCachedApproximateDirectLighting=FalsebUseIrradiancePhotons=TruebCacheIrradiancePhotonsOnSurfaces=TruebVisualizePhotonPaths=FalsebVisualizePhotonGathers=TruebVisualizePhotonImportanceSamples=FalsebVisualizeIrradiancePhotonCalculation=FalsebEmitPhotonsOutsideImportanceVolume=FalseConeFilterConstant=1; 400 gives a smooth enough result without requiring a very large searchNumIrradianceCalculationPhotons=400; Allocating most final gather samples towards importance samples gives a good result as long as there are enough first bounce photonsFinalGatherImportanceSampleFraction=.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 directionsFinalGatherImportanceSampleConeAngle=10IndirectPhotonEmitDiskRadius=200IndirectPhotonEmitConeAngle=30MaxImportancePhotonSearchDistance=2000MinImportancePhotonSearchDistance=20; Preview uses a very small number of importance directionsNumImportanceSearchPhotons=10OutsideImportanceVolumeDensityScale=.0005DirectPhotonDensity=350; Same as DirectPhotonDensity, since currently direct photons are only used to create irradiance photonsDirectIrradiancePhotonDensity=350DirectPhotonSearchDistance=200IndirectPhotonPathDensity=5; Need a very high indirect photon density since first bounce photons are used to guide the final gatherIndirectPhotonDensity=600IndirectIrradiancePhotonDensity=300IndirectPhotonSearchDistance=200PhotonSearchAngleThreshold=.5IrradiancePhotonSearchConeAngle=10CachedIrradiancePhotonDownsampleFactor=2
[DevOptions.IrradianceCache]bAllowIrradianceCaching=TruebUseIrradianceGradients=FalsebShowGradientsOnly=FalsebVisualizeIrradianceSamples=TrueRecordRadiusScale=.8InterpolationMaxAngle=20PointBehindRecordMaxAngle=10; Increase distance and angle constraints in the shading pass, which filters the interpolated result without losing too much detail.DistanceSmoothFactor=4AngleSmoothFactor=4; Sky occlusion has less noise than normal GI, don't blur away detailsSkyOcclusionSmoothnessReduction=.5; Enforce a minimum sample rate on surfaces with no nearby occludersMaxRecordRadius=1024CacheTaskSize=64InterpolateTaskSize=64
[DevOptions.StaticLightingMediumQuality]NumShadowRaysScale=2NumPenumbraShadowRaysScale=4ApproximateHighResTexelsPerMaxTransitionDistanceScale=3MinDistanceFieldUpsampleFactor=3NumHemisphereSamplesScale=2NumImportanceSearchPhotonsScale=1NumDirectPhotonsScale=2DirectPhotonSearchDistanceScale=.5NumIndirectPhotonPathsScale=1NumIndirectPhotonsScale=2NumIndirectIrradiancePhotonsScale=2RecordRadiusScaleScale=.75InterpolationMaxAngleScale=1IrradianceCacheSmoothFactor=.75NumAdaptiveRefinementLevels=3AdaptiveBrightnessThresholdScale=.5AdaptiveFirstBouncePhotonConeAngleScale=1
[DevOptions.StaticLightingHighQuality]NumShadowRaysScale=4NumPenumbraShadowRaysScale=8ApproximateHighResTexelsPerMaxTransitionDistanceScale=6MinDistanceFieldUpsampleFactor=5NumHemisphereSamplesScale=4NumImportanceSearchPhotonsScale=2NumDirectPhotonsScale=2DirectPhotonSearchDistanceScale=.5NumIndirectPhotonPathsScale=2NumIndirectPhotonsScale=4NumIndirectIrradiancePhotonsScale=2RecordRadiusScaleScale=.75InterpolationMaxAngleScale=.75IrradianceCacheSmoothFactor=.75NumAdaptiveRefinementLevels=3AdaptiveBrightnessThresholdScale=.25AdaptiveFirstBouncePhotonConeAngleScale=2
[DevOptions.StaticLightingProductionQuality]NumShadowRaysScale=8NumPenumbraShadowRaysScale=32ApproximateHighResTexelsPerMaxTransitionDistanceScale=6MinDistanceFieldUpsampleFactor=5NumHemisphereSamplesScale=8NumImportanceSearchPhotonsScale=3NumDirectPhotonsScale=4; Decrease direct photon search distance so that we will have more accurate shadow transitions. This requires a higher density of direct photons.DirectPhotonSearchDistanceScale=.5NumIndirectPhotonPathsScale=2; Need a lot of indirect photons since we have increased the number of first bounce photons to use for final gathering with NumImportanceSearchPhotonsScaleNumIndirectPhotonsScale=8NumIndirectIrradiancePhotonsScale=2; Decreasing the record radius results in more records, which increases qualityRecordRadiusScaleScale=.5625InterpolationMaxAngleScale=.75IrradianceCacheSmoothFactor=.75NumAdaptiveRefinementLevels=3AdaptiveBrightnessThresholdScale=.25AdaptiveFirstBouncePhotonConeAngleScale=2.5
ぎゃ~~~~
Lighting Quality が 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
[DevOptions.StaticLightingProductionQuality]NumShadowRaysScale=8
NumPenumbraShadowRaysScale=32
ApproximateHighResTexelsPerMaxTransitionDistanceScale=6
MinDistanceFieldUpsampleFactor=5
NumHemisphereSamplesScale=8
NumImportanceSearchPhotonsScale=3
NumDirectPhotonsScale=4
DirectPhotonSearchDistanceScale=.5
NumIndirectPhotonPathsScale=2
NumIndirectPhotonsScale=8
NumIndirectIrradiancePhotonsScale=2
RecordRadiusScaleScale=.5625
InterpolationMaxAngleScale=.75
IrradianceCacheSmoothFactor=.75
NumAdaptiveRefinementLevels=3
AdaptiveBrightnessThresholdScale=.25
AdaptiveFirstBouncePhotonConeAngleScale=2.5
何を調整しているか?
ファイナルギャザーのレイの数
影の品質
フォトンの数、フォトンマッピングの計算の品質
イラディアンスキャッシュの品質
ファイナルギャザーのアダプティブサンプルの品質
アーティストが調整できるように重要項目を複数まとめて
スケーリングしてくれています
後で少しお話します
では改めて、モヤモヤを消していきましょう
まずはLighting Qualityで調整
Static Lighting Level Scale=0.1で固定
Preview 2m16s
Medium 7m48s
High 13m58s
Production 30m22s
まだクオリティが足りない
計算精度をさらに上げたい
Indirect Lighting Qualityで調整(ファイナルギャザーのレイの数を上げる)
Indirect Lighting Quality 1 Medium 7m48s
Indirect Lighting Quality 2 Medium 12m55s
Indirect Lighting Quality 5 Medium 29m46s
Indirect Lighting Quality 10 Medium 1h5m24s
Productionに
Static Lighting Level Scale=0.1 Indirect Lighting Quality=10 Production
Static Lighting Level Scale×Indirect Lighting Quality =1.0
掛けて1.0になる割合で概ね満足できるレベルにモヤモヤがとれました。
Lighting QualityがProductionの場合
0.1 10
0.2 5
0.5 2
のとき
のとき
のとき
Static Lighting Level Scale = 1→ 0.1Num Indirect Lighting Bounces =3→20Indirect Lighting Quality = 1→10Indirect Lighting Smoothness=1.0→1.0
Lighting Quality = Production
Build Time 15m57s →4h10m24s
Casa Barragan最終設定
Static Lighting Level Scale = 1→ 0.1Num Indirect Lighting Bounces =3→20Indirect Lighting Quality = 1→10Indirect Lighting Smoothness=1.0→1.0
Lighting Quality = Production
Build Time 15m57s →4h10m24s
Casa Barragan最終設定
15倍!!
はっきり言ってゲームエンジンの設定としては重い設定だと思います。
ここまでは入り口です。
6. Lightmass Deep Dive
Lightmass.iniでしかできないチューニングが
たくさんあります
C:¥Program Files¥Epic Games¥4.12¥Engine¥Config
BaseLightmass.ini
; 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=TrueViewSingleBounceNumber=-1bUseBilinearFilterLightmaps=TruebCompressLightmaps=TruebUseConservativeTexelRasterization=TruebAccountForTexelSize=TruebUseMaxWeight=TrueMaxTriangleLightingSamples=8MaxTriangleIrradiancePhotonCacheSamples=4bAllow64bitProcess=TrueDefaultStaticMeshLightingRes=32bAllowCropping=FalsebGarbageCollectAfterExport=TruebRebuildDirtyGeometryForLighting=TruebUseEmbree=truebVerifyEmbree=false
[DevOptions.StaticLightingSceneConstants]StaticLightingLevelScale=1VisibilityRayOffsetDistance=.1VisibilityNormalOffsetDistance=3VisibilityNormalOffsetSampleRadiusScale=.5VisibilityTangentOffsetSampleRadiusScale=.8SmallestTexelRadius=.1; Tweaked for a good tradeoff between 'Cache Indirect Photon Paths' time and Indirect photon emitting 'Sampling Lights' timeLightGridSize=100AutomaticImportanceVolumeExpandBy=500MinimumImportanceVolumeExtentWithoutWarning=10000.0
[DevOptions.StaticLightingMaterial]bUseDebugMaterial=FalseShowMaterialAttribute=None; Material export sizes default to very small to keep exports fastEmissiveSampleSize=128DiffuseSampleSize=128SpecularSampleSize=128TransmissionSampleSize=256NormalSampleSize=256; Terrain materials default to much higher resolution since each material typically covers a large area in world spaceTerrainSampleScalar=4DebugDiffuse=(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 lightsEmissiveIntensityThreshold=.01MeshAreaLightGridSize=100MeshAreaLightSimplifyNormalAngleThreshold=25MeshAreaLightSimplifyCornerDistanceThreshold=.5MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold=.1MeshAreaLightGeneratedDynamicLightSurfaceOffset=30
[DevOptions.PrecomputedDynamicObjectLighting]bVisualizeVolumeLightSamples=FalsebVisualizeVolumeLightInterpolation=FalseNumHemisphereSamplesScale=2SurfaceLightSampleSpacing=300FirstSurfaceSampleLayerHeight=50SurfaceSampleLayerHeightSpacing=250NumSurfaceSampleLayers=2DetailVolumeSampleSpacing=300VolumeLightSampleSpacing=3000; Clamp the number of volume samples generated to ~15mbMaxVolumeSamples=250000bUseMaxSurfaceSampleNum=True; Approximately clamp the number of surface samples generated to ~30mb (only for Landscape currently)MaxSurfaceLightSamples=500000
[DevOptions.PrecomputedVisibility]bVisualizePrecomputedVisibility=FalsebCompressVisibilityData=TruebPlaceCellsOnOpaqueOnly=TrueNumCellDistributionBuckets=800CellRenderingBucketSize=5NumCellRenderingBuckets=5PlayAreaHeight=220MeshBoundsScale=1.2VisibilitySpreadingIterations=1MinMeshSamples=14MaxMeshSamples=40NumCellSamples=24NumImportanceSamples=40
[DevOptions.PrecomputedVisibilityModeratelyAggressive]MeshBoundsScale=1VisibilitySpreadingIterations=1
[DevOptions.PrecomputedVisibilityMostAggressive]MeshBoundsScale=1VisibilitySpreadingIterations=0
[DevOptions.VolumeDistanceField]VoxelSize=75VolumeMaxDistance=900NumVoxelDistanceSamples=800; Clamp the size of the volume distance field generated to ~15mbMaxVoxels=3992160
[DevOptions.StaticShadows]; Using area shadows by default instead of filtering in texture spacebUseZeroAreaLightmapSpaceFilteredLights=FalseNumShadowRays=8NumPenumbraShadowRays=8NumBounceShadowRays=1bFilterShadowFactor=TrueShadowFactorGradientTolerance=0.5bAllowSignedDistanceFieldShadows=TrueMaxTransitionDistanceWorldSpace=50ApproximateHighResTexelsPerMaxTransitionDistance=50MinDistanceFieldUpsampleFactor=3MinUnoccludedFraction=.005StaticShadowDepthMapTransitionSampleDistanceX=100StaticShadowDepthMapTransitionSampleDistanceY=100StaticShadowDepthMapSuperSampleFactor=2; Clamp the number of shadow samples generated to ~8mb for huge levelsStaticShadowDepthMapMaxSamples=4194304
[DevOptions.ImportanceTracing]bUseCosinePDF=FalsebUseStratifiedSampling=TrueNumHemisphereSamples=16MaxHemisphereRayAngle=89bUseAdaptiveSolver=trueNumAdaptiveRefinementLevels=2AdaptiveBrightnessThreshold=1AdaptiveFirstBouncePhotonConeAngle=4
[DevOptions.PhotonMapping]bUsePhotonMapping=TruebUseFinalGathering=TruebUsePhotonDirectLightingInFinalGather=FalsebVisualizeCachedApproximateDirectLighting=FalsebUseIrradiancePhotons=TruebCacheIrradiancePhotonsOnSurfaces=TruebVisualizePhotonPaths=FalsebVisualizePhotonGathers=TruebVisualizePhotonImportanceSamples=FalsebVisualizeIrradiancePhotonCalculation=FalsebEmitPhotonsOutsideImportanceVolume=FalseConeFilterConstant=1; 400 gives a smooth enough result without requiring a very large searchNumIrradianceCalculationPhotons=400; Allocating most final gather samples towards importance samples gives a good result as long as there are enough first bounce photonsFinalGatherImportanceSampleFraction=.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 directionsFinalGatherImportanceSampleConeAngle=10IndirectPhotonEmitDiskRadius=200IndirectPhotonEmitConeAngle=30MaxImportancePhotonSearchDistance=2000MinImportancePhotonSearchDistance=20; Preview uses a very small number of importance directionsNumImportanceSearchPhotons=10OutsideImportanceVolumeDensityScale=.0005DirectPhotonDensity=350; Same as DirectPhotonDensity, since currently direct photons are only used to create irradiance photonsDirectIrradiancePhotonDensity=350DirectPhotonSearchDistance=200IndirectPhotonPathDensity=5; Need a very high indirect photon density since first bounce photons are used to guide the final gatherIndirectPhotonDensity=600IndirectIrradiancePhotonDensity=300IndirectPhotonSearchDistance=200PhotonSearchAngleThreshold=.5IrradiancePhotonSearchConeAngle=10CachedIrradiancePhotonDownsampleFactor=2
[DevOptions.IrradianceCache]bAllowIrradianceCaching=TruebUseIrradianceGradients=FalsebShowGradientsOnly=FalsebVisualizeIrradianceSamples=TrueRecordRadiusScale=.8InterpolationMaxAngle=20PointBehindRecordMaxAngle=10; Increase distance and angle constraints in the shading pass, which filters the interpolated result without losing too much detail.DistanceSmoothFactor=4AngleSmoothFactor=4; Sky occlusion has less noise than normal GI, don't blur away detailsSkyOcclusionSmoothnessReduction=.5; Enforce a minimum sample rate on surfaces with no nearby occludersMaxRecordRadius=1024CacheTaskSize=64InterpolateTaskSize=64
[DevOptions.StaticLightingMediumQuality]NumShadowRaysScale=2NumPenumbraShadowRaysScale=4ApproximateHighResTexelsPerMaxTransitionDistanceScale=3MinDistanceFieldUpsampleFactor=3NumHemisphereSamplesScale=2NumImportanceSearchPhotonsScale=1NumDirectPhotonsScale=2DirectPhotonSearchDistanceScale=.5NumIndirectPhotonPathsScale=1NumIndirectPhotonsScale=2NumIndirectIrradiancePhotonsScale=2RecordRadiusScaleScale=.75InterpolationMaxAngleScale=1IrradianceCacheSmoothFactor=.75NumAdaptiveRefinementLevels=3AdaptiveBrightnessThresholdScale=.5AdaptiveFirstBouncePhotonConeAngleScale=1
[DevOptions.StaticLightingHighQuality]NumShadowRaysScale=4NumPenumbraShadowRaysScale=8ApproximateHighResTexelsPerMaxTransitionDistanceScale=6MinDistanceFieldUpsampleFactor=5NumHemisphereSamplesScale=4NumImportanceSearchPhotonsScale=2NumDirectPhotonsScale=2DirectPhotonSearchDistanceScale=.5NumIndirectPhotonPathsScale=2NumIndirectPhotonsScale=4NumIndirectIrradiancePhotonsScale=2RecordRadiusScaleScale=.75InterpolationMaxAngleScale=.75IrradianceCacheSmoothFactor=.75NumAdaptiveRefinementLevels=3AdaptiveBrightnessThresholdScale=.25AdaptiveFirstBouncePhotonConeAngleScale=2
[DevOptions.StaticLightingProductionQuality]NumShadowRaysScale=8NumPenumbraShadowRaysScale=32ApproximateHighResTexelsPerMaxTransitionDistanceScale=6MinDistanceFieldUpsampleFactor=5NumHemisphereSamplesScale=8NumImportanceSearchPhotonsScale=3NumDirectPhotonsScale=4; Decrease direct photon search distance so that we will have more accurate shadow transitions. This requires a higher density of direct photons.DirectPhotonSearchDistanceScale=.5NumIndirectPhotonPathsScale=2; Need a lot of indirect photons since we have increased the number of first bounce photons to use for final gathering with NumImportanceSearchPhotonsScaleNumIndirectPhotonsScale=8NumIndirectIrradiancePhotonsScale=2; Decreasing the record radius results in more records, which increases qualityRecordRadiusScaleScale=.5625InterpolationMaxAngleScale=.75IrradianceCacheSmoothFactor=.75NumAdaptiveRefinementLevels=3AdaptiveBrightnessThresholdScale=.25AdaptiveFirstBouncePhotonConeAngleScale=2.5
ご安心を!
必要なところだけコピペ&値を変更
「DefaultLightmass.ini」として
「ProjectName」¥Configに置くことで設定可能
例えばエリアシャドウのクオリティを
上げたい時
DefaultLightmass.iniでシャドウのディティール上げる
NumShadowRaysScale=2 NumPenumbraShadowRaysScale=4
Medium 設定のデフォルト値
エディタでできないチューニングができる
NumShadowRaysScale=16 NumPenumbraShadowRaysScale=64
「BaseLightmass.ini」からコピペして値を変えるだけ
「ProjectName」¥Configの中に「DefaultLightmass.ini」として保存
さっきのシーンをもっと最適化できる方法はないか
レイが足りない
レイが十分
レイが十分
レイが足りない
全体のレイの数を増やすと無駄なのでは…
ファイナルギャザーを改善
Indirect Lighting Qualityを上げる
↓
ファイナルギャザーのレイの数を上げる
ファイナルギャザーのレイの数に比例して品質は上がるが時間がかかる。
ファイナルギャザーを改善
Indirect Lighting Qualityを増やすと必要のない所までレイが増えるので無駄なのでは
↓
アダプティブサンプルで必要なとこに必要なだけレイを増やしたい
↓
アダプティブサンプル改善の
レベルを上げる
or
レベルが上がる際の明るさの閾値を下げる
アダプティブサンプル改善のレベルを上げる
NumAdaptiveRefinementLevel
NumAdaptiveRefinementLevels=0 Medium 1m16s
NumAdaptiveRefinementLevels=1 Medium 2m15s
NumAdaptiveRefinementLevels=2 Medium 4m43s
(Lighting Quality Previewの時のデフォルト値)
NumAdaptiveRefinementLevels=3 Medium 10m59s
(Lighting Quality Medium,High,Productionの時のデフォルト値)
NumAdaptiveRefinementLevels=4 Medium 34m45s
アダプティブサンプル改善のレベルを上げる閾値を調整
AdaptiveBrightnessThresholdScale
Static Lighting Level Scale =0.2
Indirect Lighitng Quality=5
Medium
の設定で固定
NumAdaptiveRefinementLevels=3 AdaptiveBrightnessThresholdScale=0.5
(Mediumのデフォルト) 3m28s
NumAdaptiveRefinementLevels=3 AdaptiveBrightnessThresholdScale=0.25
3m33s
NumAdaptiveRefinementLevels=3 AdaptiveBrightnessThresholdScale=0.05
4m13s
NumAdaptiveRefinementLevels=4 AdaptiveBrightnessThresholdScale=0.5
12m41s
NumAdaptiveRefinementLevels=5 AdaptiveBrightnessThresholdScale=0.25
48m03s
あれ、よけい重くないか?ということで
Static Lighting Level Scale =0.2Indirect Lighitng Quality=10
Productionと比較
Static Lighting Level Scale=0.2 Indirect Lighintg Quality=10 Production 28m22s
NumAdaptiveRefinementLevels=5 AdaptiveBrightnessThresholdScale=0.25
48m03s
費用対効果が悪いため素直にIndirect Ligihting Qualityでレイの数を上げたほうがよいです
ただし、Indirect Lighting Qualityで11以上値をいれるのは要注意
Indirect Lighting Quality>11の時
NumAdaptiveRefinementLevel +1になります
ビルド時間が跳ね上がります。
Lightimass.iniからレイの数を調整
各Ligihtng Qualityの「NumHemisphereSamplesScale」
Or
[DevOptions.ImportanceTracing]NumHemisphereSamples
これらの値を変更することでもレイの数をスケーリングできる
Lightmass.iniにはあなたのコンテンツにあった
カスタムチューニングをするための全ての設定があります
Lets make Lightmass Epic
Koolaさんはじめ凄腕アーティスト達がLightmassを研究しています
https://forums.unrealengine.com/showthread.php?88952-Lets-make-Lightmass-EPIC-(and-understandable)
まとめ
静的なシーンでのLightmapの品質
(MovableなStaticMesh,SkeltalMeshは後半のセッションで)
フォトンがでるライト
• Directional Light
• Point Light
• Spot Light
• Koola式バウンスカード
フォトンがでないライト
• Sky Light
• Use Emissive ForStatic Lighting
各種光源の挙動の違いを理解するのが大事
特にスカイライト!
Lighting Quality
各種設定が何に影響するか
影
フォトンマッピング
イラディアンスキャッシュ
ファイナルギャザー
全体的な品質設定
項目 影響するもの ビルド時間への影響
高
Static Lighting Level Scale
Num Indirect Lighting Bouces
Indirect Lighting Quality
Indirect Lighting Smoothness
各種設定が何に影響するか
Lightmassのディティール
(イラディアンスキャッシュの
記録半径)
シーンの明るさ
(フォトンの反射回数)
アーティファクトノイズを減らす
(ファイナルギャザーのレイの数)
ライトマップをぼかす割合
(イラディアンスキャッシュの
補間の割合)
項目 影響するもの ビルド時間への影響
中(高)
低
高
低
Lightmassの品質(ディティール)&ビルド時間=
ライトマップ解像度(解像度が上がる)
×Lighitng Quality(全体的な品質が上がる)
×Indirect Lighting Quality(アーティファクトノイズが減る)
÷Static Lighting Level Scale(ディティールが上がる)
間違っている事やこんないい方法あるよって方は
ドシドシご意見を頂けると嬉しいです!!
@torashami
http://www.frames-cg.com/