photorealism: ray tracing huamin wang (whmin@cc.gatech) georgia tech nov 11, 2008

Post on 13-Jan-2016

46 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Photorealism: Ray Tracing Huamin Wang (whmin@cc.gatech.edu) 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

Photorealism: Ray TracingHuamin Wang

(whmin@cc.gatech.edu)

Georgia TechNov 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• Basics of ray tracing

• Monte Carlo integration

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

• Conclusion

Basics of ray tracing

Camera

Image Plane

Light 0

Light 1 Object 0Object 1

E

L(E)?

Light Transport

ObjectObject

EI

L(I)L(E)

N

( )( )

( )R

L EF I E

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

p

Light Transport

EL(E)

N

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

p

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

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

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

Result of Basic Ray Tracing

Huamin Wang et al, 2005

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

…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)

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

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

Result of Basic Ray Tracing

A rendering result: max_depth=16

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. ….

CONTENT• Basics of ray tracing

• Monte Carlo integration

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

• Conclusion

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

Monte Carlo Integration

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

ΩΩ

( )f

1

( )( )

N

ii

ff

N

( )( ) ( ) if

f d fN

Monte Carlo Integration

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

ΩΩ

( )f

1

( )( )

N

ii

ff

N

( )( ) ( ) if

f d fN

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

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

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

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

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

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)

Monte Carlo VS Riemann• Similar:

• The difference between MC and Riemann:

( )( , ) if X

f x y dxdyN

Monte Carlo VS Riemann

• The advantage of Monte Carlo

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

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

1. Soft Shadow by Area Light

ObjectObject

EL(E)

N

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

Genetti & Gordon, 1993

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

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

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

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

Cornell Box: 10 samples

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

Cornell Box: 100 samples

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.

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

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

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

3. An Fuzzy Glass Example

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

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

4. Depth of Field: in-focus

Image Plane

lens

Focal plane

In-focus:

Pixel

Pixel

4. Depth of Field: out-of-focus

Image

lens

Out-of-focus:

Circle of Confusion

focal

object

Pixel

4. Depth of Field: out-of-focus

Image

lens

Out-of-focus:

Circle of Confusion

focalobject

Pixel

4. A Depth-of-Field Example

A rendered image illustrates the result at different depths.

http://www.pbrt.org/gallery

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’

4. Depth-of-field, Distributed Ray Tracing

Image Plane Lens

Pixel p

How to efficiently find sample rays?

E’

E

Focus Plane

q

f

4. A Depth-of-Field Example

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

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

5. A Motion Blur Example

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

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

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.

top related