Dynamic lighting in GOW3
-
Upload
chung-yuan-lee -
Category
Technology
-
view
464 -
download
0
Transcript of Dynamic lighting in GOW3
![Page 1: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/1.jpg)
A LIGHTING METHOD
FOR CONSOLE GAMES
Resource: Dynamic lighting in GOW3
Vassily Filippov (Sony Santa Monica)
Advances in Real-Time Rendering in 3D Graphics
and Games, SIGGRAPH 2011
![Page 2: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/2.jpg)
INTRODUCTION
Three major issues for console games
Modeling
Lighting
Animation
PS3‟s graphics processing is handled by the
NVIDIA RSX 'Reality Synthesizer„
RSX
Nvidia GeForce 7800 Architecture
256 MB GDDR3 RAM at 700 MHz
RSX is a bottleneck
Mesh Color
Today‟s emphasis
![Page 3: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/3.jpg)
TRADITIONAL METHOD
)0(
)(
iLNi
iilLN
iL
il
: Light direction
: Luminance
Light
Light
Light
Light
![Page 4: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/4.jpg)
THIS METHOD
AggAgglLN )(
AggL
Aggl
: Aggregate Light direction
: Aggregate Luminance
Light
![Page 5: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/5.jpg)
HYBRID VERTEX LIGHTS
For 1 light identical to pixel lights
For multiple lights
Calculate distance falloff per vertex.
Combine into a single Aggregate Light per-
vertex
Interpolate Aggregate Light Position per pixel
![Page 6: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/6.jpg)
INTERPOLATING DIRECTION
Light
![Page 7: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/7.jpg)
INTERPOLATING DIRECTION
A B
Light
L=(½LA+½L
B)
![Page 8: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/8.jpg)
INTERPOLATING DIRECTION
A L=normalize(½LA+½L
B) B
WRONG
![Page 9: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/9.jpg)
INTERPOLATING POSITION
A B
Light
![Page 10: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/10.jpg)
INTERPOLATING POSITION
AL = Light_Pos−(½A+½B)
B
Light
![Page 11: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/11.jpg)
INTERPOLATING POSITION
A
Normalize(Light_Pos−(½A+½B))
B
Light
BETTER
![Page 12: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/12.jpg)
BUT STILL NOT SO GOOD
Light with falloff in real world, but light weights
will both set to 1 here
Resulting lighting will over-emphasize Light 1
Light 0
Vertex V
Light 1
Aggregate
light
Ideal
aggregate
light
![Page 13: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/13.jpg)
“BETTER” APPROACH
Step1 - Subtract the world vertex position from each world
light position to create relative vectors
Step2 - Calculate lengths
And weights(light intensities are 1 for both
lights)
Light 0
Vertex V
L0
L1
Light 1
W0 = 1/L0
W1 = 1/L1
![Page 14: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/14.jpg)
“BETTER” APPROACH
Step3 - multiply relative vectors by weights to go
to direction domain
Step4 - Add up light directions
Light 0
Vertex V
Light 1
W0 = 1/L0
W1 = 1/L1
![Page 15: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/15.jpg)
“BETTER” APPROACH
Step5 - Accumulate weights
Step6 - Multiply aggregate direction by
accumulated weight to go back to positions
domain
We ended up with relative light vector for
aggregate light
Light 0
Vertex V
Light 1
W0 = 1/L0
W1 = 1/L1
+Wtotal
![Page 16: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/16.jpg)
“BETTER” APPROACH
Step7 - Add vertex world position to it to get
world position of the aggregate light
Light 0
Vertex V
Light 1
![Page 17: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/17.jpg)
“BETTER” APPROACH
Lagg is aggregate light position
Li is light position for Light i
Wi is light weight for Light i based on intensity of Light i at V
n is number of lights in the current light context
V is position of the vertex for which we combine lights
V
VL
W
VL
VLW
L
ni i
i
ni i
ii
agg
]..0[
]..0[
)( Light 0
Vertex V
![Page 18: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/18.jpg)
“BETTER” APPROACH
Lagg is aggregate light position
Li is light position for Light i
Wi is light weight for Light i based on intensity of Light i at V
n is number of lights in the current light context
V is position of the vertex for which we combine lights
V
VL
W
VL
VLW
L
ni i
i
ni i
ii
agg
]..0[
]..0[
)(Light 0
Vertex V
![Page 19: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/19.jpg)
“BETTER” APPROACH
Lagg is aggregate light position
Li is light position for Light i
Wi is light weight for Light i based on intensity of Light i at V
n is number of lights in the current light context
V is position of the vertex for which we combine lights
V
VL
W
VL
VLW
L
ni i
i
ni i
ii
agg
]..0[
]..0[
)( Light 0
Vertex V
![Page 20: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/20.jpg)
“BETTER” APPROACH
Lagg is aggregate light position
Li is light position for Light i
Wi is light weight for Light i based on intensity of Light i at V
n is number of lights in the current light context
V is position of the vertex for which we combine lights
V
VL
W
VL
VLW
L
ni i
i
ni i
ii
agg
]..0[
]..0[
)( Light 0
Vertex V
![Page 21: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/21.jpg)
“BETTER” APPROACH
Lagg is aggregate light position
Li is light position for Light i
Wi is light weight for Light i based on intensity of Light i at V
n is number of lights in the current light context
V is position of the vertex for which we combine lights
V
VL
W
VL
VLW
L
ni i
i
ni i
ii
agg
]..0[
]..0[
)( Light 0
Vertex V
![Page 22: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/22.jpg)
“BETTER” APPROACH
Lagg is aggregate light position
Li is light position for Light i
Wi is light weight for Light i based on intensity of Light i at V
n is number of lights in the current light context
V is position of the vertex for which we combine lights
V
VL
W
VL
VLW
L
ni i
i
ni i
ii
agg
]..0[
]..0[
)(Light 0
Vertex V
![Page 23: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/23.jpg)
AGGREGATE LIGHT COLOR
Calculate aggregate light
position
Calculate normalized
light directions
Calculate dot products
x + x =
![Page 24: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/24.jpg)
AGGREGATE LIGHT COLOR
Cagg is aggregate light color at the
Vertex V
Ci is color of Light i
Li is direction to Light i at Vertex
V
Lagg is direction to aggregate light
))((
]..0[ ni
aggiiaggLLCC
![Page 25: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/25.jpg)
AGGREGATE LIGHT COLOR
Cagg is aggregate light color at the
Vertex V
Ci is color of Light i
Li is direction to Light i at Vertex
V
Lagg is direction to aggregate light
))((
]..0[ ni
aggiiaggLLCC
x + x =
How well does this approximate actual lighting
by several lights?
![Page 26: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/26.jpg)
WHY THIS WORKS
This is what is tried to approximate
Assume lights have a single scalar luminance
value and no color.
)0(
)(iLNi
ii cLN
)0(
)(iLNi
ii lLN
![Page 27: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/27.jpg)
WHY THIS WORKS
Aggregate light approximation (with luminances)
AggAgg
LNi
iilLNlLN
i
)()(
)0(
Exact luminance calculation
Our approximation
![Page 28: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/28.jpg)
WHY THIS WORKS
)0(
)(iLNi
ii lLN
)( ii
LlN
X
XLl ii
![Page 29: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/29.jpg)
WHY THIS WORKS
V
VLpos
W
VLpos
VLposW
Lpos
ni i
i
ni i
ii
agg
]..0[
]..0[
)(
Light 0
Vertex V
il
![Page 30: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/30.jpg)
WHY THIS WORKS
V
VLpos
l
VLpos
VLposl
Lpos
ni i
i
ni i
ii
agg
]..0[
]..0[
)(
Light 0
Vertex V
aggLrel
![Page 31: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/31.jpg)
WHY THIS WORKS
]..0[
]..0[
)(
ni i
i
ni i
ii
agg
VLpos
l
VLpos
VLposl
Lrel
Light 0
Vertex V
Lagg
aggL]..0[
)(
ni i
ii
VLpos
VLposl
![Page 32: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/32.jpg)
WHY THIS WORKS
]..0[
]..0[
)(
)(
ni i
ii
ni i
ii
agg
VLpos
VLposl
VLpos
VLposl
L
Light 0
Vertex V
Lagg
iL
![Page 33: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/33.jpg)
WHY THIS WORKS
]..0[
]..0[
ni
ii
ni
ii
agg
Ll
Ll
L
Light 0
Vertex V
Lagg
X
![Page 34: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/34.jpg)
WHY THIS WORKS
X
XLagg
Xlagg
AggAgg
LNi
iilLNlLN
i
)()(
)0(
XLl ii
![Page 35: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/35.jpg)
VECTOR ARITHMETIC
V0
V1
V2
Adding multiple vectors
Length of the result
is equal to the sum of projections
![Page 36: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/36.jpg)
WHY THIS WORKS – THE LAST STEP
XlAgg
![Page 37: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/37.jpg)
WHY THIS WORKS – THE LAST STEP
ni
iiAgg LlXl
![Page 38: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/38.jpg)
WHY THIS WORKS – THE LAST STEP
ni
nj
jj
nj
jj
ii
ni
iiAgg
Ll
Ll
LlLlXl
LAgg
![Page 39: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/39.jpg)
WHY THIS WORKS – THE LAST STEP
i
AggiiAgg LLll )(
For luminance our approximation is exact
)( AggiiAgg LLCC
Which is what this method use
Extending to RGB:
![Page 40: Dynamic lighting in GOW3](https://reader033.fdocuments.in/reader033/viewer/2022060206/55a25d411a28ab9c2b8b479f/html5/thumbnails/40.jpg)
RESULT
God Of War III Runs Natively At 720p With 1080p Upscaling, and
stable 60fps most of the time