photorealism: ray tracing huamin wang ([email protected]) georgia tech nov 11, 2008

58
Photorealism: Ray Tracing Huamin Wang ([email protected]) Georgia Tech Nov 11, 2008

Upload: rollin

Post on 13-Jan-2016

46 views

Category:

Documents


0 download

DESCRIPTION

Photorealism: Ray Tracing Huamin Wang ([email protected]) Georgia Tech Nov 11, 2008. Quiz 1. Quiz 2. Henrik Wann Jensen, 1992. quiz. "Boreal" by Norbert Kern (2004). "Christmas Baubles" by Jaime Vives Piqueres (2005). quiz. "The Wet Bird" by Gilles Tran (2001). CONTENT. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Photorealism: Ray TracingHuamin Wang

([email protected])

Georgia TechNov 11, 2008

Page 2: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Quiz 1

Page 3: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Quiz 2

Henrik Wann Jensen, 1992

Page 4: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

quiz

"Boreal" by Norbert Kern (2004)

Page 5: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

"Christmas Baubles" by Jaime Vives Piqueres (2005)

Page 6: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

quiz

"The Wet Bird" by Gilles Tran (2001)

Page 7: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

CONTENT• Basics of ray tracing

• Monte Carlo integration

• Distributed ray tracing– Soft shadow– Glossy surface– Fuzzy glass– Depth of field– Motion blur

• Conclusion

Page 8: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Basics of ray tracing

Camera

Image Plane

Light 0

Light 1 Object 0Object 1

E

L(E)?

Page 9: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Light Transport

ObjectObject

EI

L(I)L(E)

N

( )( )

( )R

L EF I E

L I ( ) ( ) ( )RL E F I E L I

p

Page 11: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Light Transport

EL(E)

N

( ) ( ) ( )RL E F I E L I

p

( ) ( ) ( )RL E F I E L I dI

Page 12: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Light Transport in Basic Ray Tracing

EI

L(E)?

N

( ) ( )RF I E L I

R

( ) ( )RF R E L R

T

( ) ( )TF T E L T 2 2( ) ( )RF I E L I

direct illumination

Mirror (indirect) Glass (indirect)

L(I1)L(In)

L(R)

L(T)

( ) ( ) ( )RL E F I E L I dI

known

Page 13: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Basics of ray tracing

L(E)1.p=Intersection(E);2. if p==NULL return backgrd;3.

4. R=Reflection(E, N);5. 6. T=Refraction(E, N);7. 8. return l;

Camera

Image Plane

Light 0

Light 1 Object 0Object 1

N

( , ) ( ) ( );i R i ii

l g p I F I E L I

I0

pE

I1

g(p,I1)=0

R

T

g(p,I0)=1

( ) ( );Rl F R E L R

( ) ( );Tl F T E L T

Page 14: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Result of Basic Ray Tracing

Huamin Wang et al, 2005

Page 15: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008
Page 16: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

1 2 3 1 2 3

2 3 1 1 2 3

3 1 2 1 2 3

( ) / ( )

( ) / ( )

( ) / ( )

s area PP P area PP P

s area PP P area PP P

s area PPP area PP P

Page 17: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

…area of a triangle…

1 2 3

1 2 3 1 2 3

1 2 3

1 2 3 1 2 3 1 2 3

1 2 3 1 2 3 1 2 3

, ,x x x

y y y

z z z

x y z y z x z x y

z y x y x z x z y

P P P

area P P P P P P

P P P

P P P P P P P P P

P P P P P P P P P

P2=(P2.x, P2.y, P2.z)

P1=(P1.x, P1.y, P1.z)

P3=(P3.x, P3.y, P3.z)

Page 18: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Ray-Implicit Surface IntersectionImplicit Surface: f(P)=0Ray: P=O+tDSolution t: f(O+tD)=0

Example (Sphere):

C

r

2 2 2 2( ) ( ) ( ) ( ) 0x x y y z zf P P C P C P C r

2 2 2 2( ) ( ) ( ) 0x x x y y y z z zO tD C O tD C O tD C r

2 0at bt c 2, 42

bt b ac

a

Page 19: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Review: Basics of ray tracing

E

Camera

IntersectionIntersection

IntersectionIntersection

R

IntersectionIntersection

T

IntersectionIntersection

R

IntersectionIntersection

R

IntersectionIntersection

T

L

L

L

L

L

L

L

Page 20: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Result of Basic Ray Tracing

A rendering result: max_depth=16

Page 21: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Limitations of Basic Ray Tracing

Image Plane

Light 1 Object 0Object 1

N

pE

R

T 1. Light Source2. Indirect Illumination3. Lens Camera4. Pixel Intergration5. ….

Page 22: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

CONTENT• Basics of ray tracing

• Monte Carlo integration

• Distributed ray tracing– Soft shadow– Glossy surface– Fuzzy glass– Depth of field– Motion blur

• Conclusion

Page 23: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• What’s the integral of ?

a b

( )( ) ( ) ( ) ( )

b i

a

f Xf x dx f x b a b a

N

( ), [ , ]f x x a b

f

x1X

1f

2X

2f

3X

3f

4X

4f

5X

5f

6X

6f

7X

7f

8X

8f

1

( )( )

N

ii

f Xf x

N

Page 24: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• What’s the integral of ?( ),f

ΩΩ

( )f

1

( )( )

N

ii

ff

N

( )( ) ( ) if

f d fN

Page 25: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• What’s the integral of ?( ),f

ΩΩ

( )f

1

( )( )

N

ii

ff

N

( )( ) ( ) if

f d fN

Page 26: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• Given a 1D uniform random function Rand() from 0 to 1, How to uniformly sample a rectangle?

a

b

(0,0)

(a,b)

()

()

x Rand a

y Rand b

p=(x,y)

dydx

dydx

dydx

Page 27: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• Given a 1D uniform random function Rand() from 0 to 1, How to uniformly sample a sphere?

() 2

()

Rand

Rand

WRONG!d

d

d r rd

Page 28: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• Given a 1D uniform random function Rand() from 0 to 1, How to uniformly sample a sphere?

http://www.cs.utah.edu/~thiago/cs7650/hw5/

d

Page 29: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• Given a 1D uniform random function Rand() from 0 to 1, How to uniformly sample a sphere?

() 2

2 () 1

arccos( )

Rand

h Rand

h

h

Page 30: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• Given a 1D uniform random function Rand() from 0 to 1, How to uniformly sample a sphere?

http://www.cs.utah.edu/~thiago/cs7650/hw5/

2 rh2 rh2 rh2 rh

2 rh

Page 31: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo Integration

• Given a 1D uniform random function Rand() from 0 to 1, How to uniformly sample a region?

(a,b)

(0,0)

()

()

x Rand a

y Rand b

While(1){

if ( (x,y) in Ω )break;

}

Rejection Method

p=(x,y)

Page 32: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo VS Riemann• Similar:

• The difference between MC and Riemann:

( )( , ) if X

f x y dxdyN

Page 33: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Monte Carlo VS Riemann

• The advantage of Monte Carlo

Page 34: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

CONTENT• Basics of ray tracing

• Monte Carlo integration

• Distributed ray tracing– 1. Soft shadow– 2. Glossy surface– 3. Fuzzy glass– 4. Depth of field– 5. Motion blur

• Conclusion

Page 35: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

1. Hard Shadow by Point Light

ObjectObject

EL(E)

N

( ) 1g I

p

Illuminated:Shadow: ( ) 0g I

( ) ( ) ( ) ( )RL E g I F I E L I

Genetti & Gordon, 1993

Page 36: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

1. Soft Shadow by Area Light

ObjectObject

EL(E)

N

1. No Shadow2. Half Shadow (penumbra)3. Complete Shadow (umbra)

Genetti & Gordon, 1993

Page 37: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

1. Area Light, distributed ray tracing

ObjectObject

EI

L(I)L(E)

N

ObjectObject

EL(E)

N

( ) ( ) ( ) ( )RL E g I F I E L I 1. For i=1:N2. Ii=Uniform_Sample(Ω); 3. 4. End;5.

( ) ( ) ( ) ( );i R i iL E g I F I E L I

p p

( ) ( ) ;L E L E N

Page 38: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

1. Mathematical Validation

ΩΩ

( ) ( ) ( ) ( )rf I g I F I E L I

p

E: Eye

1

( )( ) ( )

( ) ( ) ( )

i

N

i R i ii

f IL E f I dI

N

g I F I E L IN

: Light

I

Page 39: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

1. An Area Light ExampleCornell Box: 4 sampleshttp://www.cs.utah.edu/~thiago/cs7650/hw5/

Page 40: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

1. An Area Light Examplehttp://www.cs.utah.edu/~thiago/cs7650/hw5/

Cornell Box: 10 samples

Page 41: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

1. An Area Light Examplehttp://www.cs.utah.edu/~thiago/cs7650/hw5/

Cornell Box: 100 samples

Page 42: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Distributed Ray Tracing

• It was proposed by Cook, Porter and Carpenter in 1984.

• It is NOT ray tracing on a distributed system.

• It is a ray tracing method based on sampling rays randomly with certain distribution.

Page 43: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

2. Glossy Surface Definition

Ideal Specular (mirror) Specular (glossy)

E R

L(E) L(R)

( ) ( ) ( )rL E F R E L R ( ) ( ) ( )rL E F R E L R dR

E

L(E) R

Page 44: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

2. Glossy Surface, Distributed Ray Tracing

Mirror4 samples

E

L(E)

16 samples64 samples

( ) ( ) ( )rL E F R E L R dR

1. For i=1:N2.

Ri=Uniform_Sample(Ω);3. 4. End;5.

( ) ( ) ( );R i iL E F R E L R

( ) ( ) ;L E L E N

R

http://www.cse.ohio-state.edu/~xue/courses/782/final/dtr.html

Page 45: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

2. Fuzzy Glass, Distributed Ray Tracing

Mirror

EL(E)

( ) ( ) ( )TL E F T E L T dT

4 samples16 samples

T

1. For i=1:N2.

Ti=Uniform_Sample(Ω);3. 4. End;5.

( ) ( ) ( );T i iL E F T E L T

( ) ( ) ;L E L E N

http://www.cse.ohio-state.edu/~xue/courses/782/final/dtr.html

Page 46: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

3. An Fuzzy Glass Example

Different glasses rendered by distributing refracted rays, from left to right: ideal glass, fuzzy glass, more fuzzy glass.

Page 47: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

4. The Pinhole Camera Model

Camera

Image P

lane E

Image Plane

Pinhole

The projection model in basic ray tracing

The pinhole camera model

Pixel

Pixel

Object

Object

Page 48: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

4. Depth of Field: in-focus

Image Plane

lens

Focal plane

In-focus:

Pixel

Pixel

Page 49: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

4. Depth of Field: out-of-focus

Image

lens

Out-of-focus:

Circle of Confusion

focal

object

Pixel

Page 50: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

4. Depth of Field: out-of-focus

Image

lens

Out-of-focus:

Circle of Confusion

focalobject

Pixel

Page 51: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

4. A Depth-of-Field Example

A rendered image illustrates the result at different depths.

http://www.pbrt.org/gallery

Page 52: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

4. Depth-of-field, Distributed Ray Tracing

Image Plane lens

Image Plane

Pinhole

The pinhole camera model

The lens camera model

( ) ( )p L E E

Pixel p

Pixel p

( ) ( ') 'p L E dE

1

( ) ( ')N

i

p L EN

EE’

Page 53: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

4. Depth-of-field, Distributed Ray Tracing

Image Plane Lens

Pixel p

How to efficiently find sample rays?

E’

E

Focus Plane

q

f

Page 54: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

4. A Depth-of-Field Example

Scene rendered in POV-Ray 3.5 (http://www.povray.org)

Page 55: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

5. Motion Blur, Distributed Ray Tracing

Camera

Image Plane

T0

ti

Tn

P(p)

( ) ( , )o

n

T

Tp p t dt

[ , ]i o nt T Tin which,

uniform distribution

0

1

( ) ( , )N

ni

i

T Tp p t

N

Page 56: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

5. A Motion Blur Example

Motion Blur, by http://www.finalrender.com/

Page 57: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

CONTENT• Basics of ray tracing

• Monte Carlo integration (uniform sampling)

• Distributed ray tracing– Glossy surface– Fuzzy glass– Soft shadow– Depth of field– Motion blur

• Conclusion

Page 58: Photorealism: Ray Tracing Huamin Wang  (whmin@cc.gatech) Georgia Tech Nov 11, 2008

Conclusion

Basic ray tracing algorithm generates images with direct illumination + Mirror reflection + Glass transmission.

Sampling rays in space and time to obtain various ray tracing effects.

Monte Carlo integration is easy to implement, but needs sufficient samples for better approximation.