際際滷

際際滷Share a Scribd company logo
Directional Light Shadows
2020-02-15  538 Dev Rookie 覦 伎
CONCEPT
1
Directional Light
 ル伎 覈 豺 螳 覦レ朱 覃伎 豐 觜 襷.
2
Directional Light
  蟇磯 蟲 伎襷    覲企 磯Μ  讌 螳.
3




覃
磯殊   覦 觜 覦レ れ 螳り 覲  .
Directional Light
 煙 蟯 覲伎覃 蠏濠骸 覿蠏轟 觜 覦レ るゼ  .
4
蠏碁 ル(Scene)  轟 豺企殊  覯 蠍 覓語 覦レ 螳 蟯 .
Directional Light Shadows
 蠏碁殊 觜 酔   襷.
 讀, Directional Light Shadow 讌蟯 酔   覦.
5
Shadow Mapping
 る 蠏碁殊 襷ろ 2螻襯 蟇一 襷.
6
Rendering
Shadow Map
Rendering
Scene
蟾 覯 蠏碁殊 襷ろ /SukwooLee4/20181222-126893802
Shadow Map
 蠏碁殊 襷旧 蟾 覯朱ゼ 伎伎 燕. (蟾 覯 蠏碁殊 覯)
 企   蟯 豺襦覿 螳 螳蟾 螳豌 覃伎 蟇磯Μ襯 蟾 覯殊 ロ.
7
A
B
C
D
0.0
0.5
0.7
0.85
1.0
蟾 覯 蠏碁殊 襷ろ /SukwooLee4/20181222-126893802
Perspective Projection
 Light Space 豺襯 蠏  蠏碁殊 襷旧 ロ.
8
Perspective Projection
0.0
1.0
Spotlight Shadow, Point Light Shadow  螳
  蟯 觜 覦襦 覦り 螳
Perspective Projection
 Directional Light Shadow Map 蠏 伎 蟾?
9
Directional Light 覈 豺 觜  覦レ朱襷 覦.
Perspective Projection
0.0
1.0
Perspective Projection
 讀, 蠏  覃 朱Μ る螳 覦.
10
磯殊  覦 Directional Light Shadow   .
Perspective Projection
0.0
1.0
X X X X
O
O
Orthographic Projection
 磯殊 Directional Light Shadow Map 讌蟲 .
11
Perspective Projection
0.0
1.0
Orthographic Projection
    near 覃伎 蠍一朱 蟾 螳 螻壱.
12
Orthogonal Projection
 Shadow Map Scene  伎 蠏碁殊螳 覓語 覲伎碁.
13
蠏碁殊 X
Scene Scene
Good Case Bad Case
DLSM 覓語(1)
 Camera Scene 豌伎 覦覃 Shadow Map 讌°伎牡企襦 觜 螻糾 .
14
Shadow Map
Scene
Ideal case
覓企Μ 朱 蠏碁殊 襷旧 燕企 觜 螻糾 譟伎
DLSM 覓語(2)
 豺企殊 蟇磯Μ 蟯 蠏碁殊 襴郁 狩.
15
near far
豺企殊 螳蟾 蠏碁殊  襴磯ゼ 蟲
DLSM 覓語(2)
 Trade-off
襴 覃覈襴
12
Motive
17
螻糾 觜襯 豕螻,
蟇磯Μ 磯 襴一 谿企ゼ
 覦覯 蟾?
Cascade Shadow Mapping
 螳 伎 蠏碁殊 襷旧 伎 豺企殊 豺 磯 蠏碁殊 襷旧 伎襯 襴 覦覯
18
豺企殊 蟇磯Μ螳 螳蟾磯, 伎
覃覃, 伎
Cascade Shadow Mapping
  螳 伎  襷 煙 覲伎譯殊襷 朱  覲願鍵 る.
19
覓企Μ CSM 企 一朱 螻糾 觜 覿覿 譟伎.
Directional Light
Cascade Shadow Mapping
 蠏碁 願覲企 も
20
Directional Light
CSM 蟲
21
Shadow Map Aliasing Problem
 蟲  螻ろ伎狩  .
 覦襦  襷旧  蟆曙 覦 覦 襴伎 覓語企.
22
Shadow Map Aliasing Problem
 ル伎 襷  覦焔朱 豺企朱ゼ 蠍一朱 3谿 一危磯ゼ .
 覦覃  襷旧 觜 蠍一朱 蠍 覓語 伎 磯ジ 襴伎 覓語螳 覦.
23
Back Buffer
Shadow Map
Shadow Map Aliasing Problem
 磯殊 襴伎煙 螻ろ  襷旧 覿伎 .
24


=
1
$


ю



Projective
Aliasing
Perspective
Aliasing
Practical Split Scheme
  蠏碁殊 豺企 ろ 覿 覦覯 覲伎譴.
 蠏碁 (a)   蠏燕蟆 . 蠏碁  覦 豺企 螳蟾 ろ 
 襷旧 襴伎 覓語螳 朱  襴郁 伎.
25
Practical Split Scheme
 蠏碁 (b) 襦蠏 襯 伎 覿.
 襦蠏 覿 蟆曙 螳蟾 ろ   襷旧 襴郁 譬讌讌襷 覃襴
ろ  襷 襴郁 覓 伎  .
26
Practical Split Scheme
 蠏碁 (c) 蠏 覿螻 襦蠏 覿  覲願 (a) (b)  覲伎.
27
Practical Split Scheme
 蠏碁り 覓伎^蟇 (c)螳 褐 蟇 . 襦 語 螳朱 麹 覿 蟆   
. 蠏碁  讌 蠏碁 覩語誤 譟一蟾讌 讌 伎 ? 
28
Rendering Process
29
Rendering
Shadow Map
Rendering
Scene
Rendering Shadow Map
30
Light View
Transformation
Orthographic
Projection
Cascade
Transformation
Light View Transformation
  螻糾 豺襯 (蟯 蠍一)  螻糾朱 覲
31
螳讌 轟危  World Center襯 蠍一朱 觀 襷ろ碁Νるゼ 燕.
企蟆  伎 Directional Light 豺襯 轟蠍 企糾鍵 覓語企.
Light View Transformation
  螻糾 豺襯 (蟯 蠍一)  螻糾朱 覲
32
Eye position
World Center
Directional light vector
Look at
Orthographic Projection
 れ朱 讌蟲  蠍 伎 襾殊 豺企 觀 ろ  螻糾 谿讌 
  .
33
蠏碁  襷旧 谿讌    .
Orthographic Projection
 螻一 豕 蠍  豺企 譴 螳 襾 豺襯 蟲.
34
Orthographic Projection
 Extract Frustum Bound Sphere
35
Eye position
Bound Center
Bound Radius
Bound Sphere
Orthographic Projection
 伎 豕 蟇磯Μ襯 伎 讌蟲  燕.
36
World Center螳 譴願鍵 覓語 zn 螳  企.
Orthographic Projection
 Radius襯 伎 讌蟲 
37
Eye position
Bound Center
Shadow Map
zn = - r
zf = r
Orthographic Projection
38
w h
light
zn
zf
2/ 0 0 0
0 2/ 0 0
0 0 1/(ю  ю) 0
0 0 ю/(ю  ю) 1
Cascade Transformation
 豺企 企 磯ジ 蠏碁殊 瑚浬 蟾觜♀碓襴(flickering) 豌襴 貊 貅れ企 覲
貊螳  .
39
Cascade Transformation
 企螻 れ朱
40
Cascade Transformation
 Translation
41
z
x
Cascade space
Translation
Translation
Light space
(Shadow space)
Cascade Transformation
 Scaling
42
y
x
Light space
(Shadow space)
Cascade space
Scaling
z 覦レ朱 れ朱 讌 .
CPU & GPU Process
43
Update Light
View Matrix
Update
Projection Matrix
Update
World Matrix
World
Transformation
Light View
Transformation
Projection
Transformation
CPU
GPU
Geometry Shader
Texture Array
 れ 覦一
 Direct10 覿 讌 蠍磯.
 れ 覦一伎  蟆 觀磯 讌.
 れ 覦一願骸 讌る碁Μ 企襯 伎 1 襦 貊 螳ロ.
443 draw call
1 2 3
1 draw call
Texture Array
Geometry Shader
45
れ 覦一 碁煙
覈  襷旧 伎 手 覯るゼ 豢
Geometry Shader
46
 讌る碁Μ 企 貊襯 覲企  手  3螳 覯るゼ 覈  襷旧 豢
.
 企 企  襷 豺  蟆 豢ロる 蟆 覩誤.
 覓朱 願  企Μ伎手鹸 讌襷 蟲ロ 觜朱 覲伎碁.
 讌 貊襯 燕 貉襷    企蟆 豌襴 蟆手?
 蠏 伎 貉襷 螻一  觜 襷襷豺 蠍 覓語企.
 蠍一 願 企Μ襦 螻 讌襷 螳  襷 貉襷 ろ 企慨襦
.
Rendering Scene
47
Vertex Shader Pixel Shader
Pixel Shader
48
DL 譟磯 螻
49
DL 蠏碁殊 螻
 襾殊,  豺襯 Light Space(Shadow Space)襦 覲.
 れ朱, 覈 貂れ企 螻糾朱 覲  螳螳 ロ.
50
DL 蠏碁殊 螻
 蠏 譴 豺企殊 螳 螳蟾  貅れ企 螻糾朱 覲 豺襯 .
51
DL 蠏碁殊 螻
 UV 譬襦 覲  れ 覦一伎 一危磯ゼ 襦.
52
UV譬 覦一 碁煙
CSM IN ENGINE
53
CSM in UE4
 Scene Directional light襯 豢螳  覯 覃   CSM れ  .
54
CSM in UE4
 Dynamic Shadow Distance StationaryLight
55
豺企 豺襯 蠍一朱 CSM 覯襯 れ.
(0企 off, 蠏  螳企 on )
Shadow Map
Scene
Dynamic Shadow Distance
CSM in UE4
  磯У 螳 れ
56
CSM 覈 螳襦 讓手阿讌 .
1
2
3
谿瑚襭
 HLSL 襦蠏碁覦  譴豌 磯 襷
  貊 : http://www.acornpub.co.kr/book/hlsl-cookbook
 GPU Gem3 Chapter 10. Parallel-Split Shadow Maps on Programmable GPUs :
https://developer.nvidia.com/gpugems/gpugems3/part-ii-light-and-shadows/chapter-10-
parallel-split-shadow-maps-programmable-gpus
 碁Μ 讌 螳企 CSM :
https://docs.unrealengine.com/ko/Resources/ContentExamples/DynamicSceneShadows/index.html
57

More Related Content

Cascade Shadow Mapping