dynamic lighting in gow3

40
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

Upload: chung-yuan-lee

Post on 12-Jul-2015

464 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Dynamic lighting in GOW3

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

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

TRADITIONAL METHOD

)0(

)(

iLNi

iilLN

iL

il

: Light direction

: Luminance

Light

Light

Light

Light

Page 4: Dynamic lighting in GOW3

THIS METHOD

AggAgglLN )(

AggL

Aggl

: Aggregate Light direction

: Aggregate Luminance

Light

Page 5: Dynamic lighting in GOW3

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

INTERPOLATING DIRECTION

Light

Page 7: Dynamic lighting in GOW3

INTERPOLATING DIRECTION

A B

Light

L=(½LA+½L

B)

Page 8: Dynamic lighting in GOW3

INTERPOLATING DIRECTION

A L=normalize(½LA+½L

B) B

WRONG

Page 9: Dynamic lighting in GOW3

INTERPOLATING POSITION

A B

Light

Page 10: Dynamic lighting in GOW3

INTERPOLATING POSITION

AL = Light_Pos−(½A+½B)

B

Light

Page 11: Dynamic lighting in GOW3

INTERPOLATING POSITION

A

Normalize(Light_Pos−(½A+½B))

B

Light

BETTER

Page 12: Dynamic lighting in GOW3

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

“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

“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

“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

“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

“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

“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

“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

“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

“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

“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

AGGREGATE LIGHT COLOR

Calculate aggregate light

position

Calculate normalized

light directions

Calculate dot products

x + x =

Page 24: Dynamic lighting in GOW3

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

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

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

WHY THIS WORKS

Aggregate light approximation (with luminances)

AggAgg

LNi

iilLNlLN

i

)()(

)0(

Exact luminance calculation

Our approximation

Page 28: Dynamic lighting in GOW3

WHY THIS WORKS

)0(

)(iLNi

ii lLN

)( ii

LlN

X

XLl ii

Page 29: Dynamic lighting in GOW3

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

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

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

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

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

WHY THIS WORKS

X

XLagg

Xlagg

AggAgg

LNi

iilLNlLN

i

)()(

)0(

XLl ii

Page 35: Dynamic lighting in GOW3

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

WHY THIS WORKS – THE LAST STEP

XlAgg

Page 37: Dynamic lighting in GOW3

WHY THIS WORKS – THE LAST STEP

ni

iiAgg LlXl

Page 38: Dynamic lighting in GOW3

WHY THIS WORKS – THE LAST STEP

ni

nj

jj

nj

jj

ii

ni

iiAgg

Ll

Ll

LlLlXl

LAgg

Page 39: Dynamic lighting in GOW3

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

RESULT

God Of War III Runs Natively At 720p With 1080p Upscaling, and

stable 60fps most of the time