cs 428: fall 2009 introduction to computer graphics · 2009. 12. 7. · ray casting create nrays...

40
CS 428: Fall 2009 Introduction to Computer Graphics Computer Graphics Radiosity 12/7/2009 1 Andrew Nealen, Rutgers, 2009

Upload: others

Post on 09-Mar-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

CS 428: Fall 2009

Introduction to

Computer GraphicsComputer Graphics

Radiosity

12/7/2009 1Andrew Nealen, Rutgers, 2009

Page 2: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Problems with diffuse lighting

A Daylight Experiment, John FerrenA Daylight Experiment, John Ferren

12/7/2009 2Andrew Nealen, Rutgers, 2009

Page 3: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Problems with diffuse lighting

12/7/2009 3Andrew Nealen, Rutgers, 2009

Page 4: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Direct lighting

12/7/2009 4Andrew Nealen, Rutgers, 2009

Page 5: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Global lighting

12/7/2009 5Andrew Nealen, Rutgers, 2009

Page 6: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Cornell box

Photography

Goral, Torrance, Greenberg & Battaile Modeling the Interaction of Light Between Diffuse Surfaces

SIGGRAPH '84

Photography

Simulation

12/7/2009 6Andrew Nealen, Rutgers, 2009

Page 7: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Cornell box

� Calibration and measurement allows

comparisons between reality and simulation

Light Measurement LaboratoryCornell University, Program for Computer Graphics

Andrew Nealen, Rutgers, 2009 12/7/2009 7

Page 8: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The rendering equation

x'

ω'

L (x',ω') is the radiance from point x’ in

direction of ω'

L(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA

12/7/2009 8Andrew Nealen, Rutgers, 2009

Radiance is measured in [W/(m2∙sr)]http://en.wikipedia.org/wiki/Radiance

Page 9: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The rendering equation

x'

ω'

E(x',ω') is the emitted radiance: E is greater

zero for light sources

L(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA

12/7/2009 9Andrew Nealen, Rutgers, 2009

Page 10: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The rendering equation

x'

ω'

Sum of contributions from all other scene

elements to the radiance from point x’ in

direction of ω'

L(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA

12/7/2009 10Andrew Nealen, Rutgers, 2009

Page 11: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The rendering equation

x'

ω'ω

x

For every x, compute L(x, ω), the radiance

in point x in direction ω (from x to x')

L(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA

12/7/2009 11Andrew Nealen, Rutgers, 2009

Page 12: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The rendering equation

x'

ω'ω

x

The contribution is scaled

by ρx'(ω,ω') (the BRDF in x’)

L(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA

12/7/2009 12Andrew Nealen, Rutgers, 2009

Page 13: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The rendering equation

x'

ω'ω

x

For every x, determine V(x,x'), the visibility from x relative to x': 1 if there is no occlusion in

direction ω, 0 otherwise

L(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA

12/7/2009 13Andrew Nealen, Rutgers, 2009

Page 14: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The rendering equation

x'

ω'ω

x

For every x, compute G(x, x'), the

geometry term w.r.t. x and x’

L(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA

12/7/2009 14Andrew Nealen, Rutgers, 2009

Page 15: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

G(x,x')?

� Which constellation leads to a large exchange

of light and why?

Andrew Nealen, Rutgers, 2009 12/7/2009 15

Page 16: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The radiosity assumptions

� Surfaces are Lambertian

(perfectly diffuse)

� Reflection occurs in all

directions

� The scene is split into � The scene is split into

small surface elements

� The radiosity Bi, is the

total radiosity that

comes from element i

� For each element, the

radiosity is constantAndrew Nealen, Rutgers, 2009 12/7/2009 16

x'

ω'

Page 17: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The radiosity equation

L(x',ω') = E(x',ω') + ∫ρx'(ω,ω')L(x,ω)G(x,x')V(x,x') dA

Bx' = Ex' + ρx' ∫ Bx G(x,x')V(x,x')

Radiosity assumption:

Perfectly diffuse surfaces – no directional dependency

Andrew Nealen, Rutgers, 2009 12/7/2009 17

Bx' = Ex' + ρx' ∫ Bx G(x,x')V(x,x')

Page 18: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

� Continuous radiosity equation

The radiosity equation

Reflection factor

xBx' = Ex' + ρx' ∫ G(x,x') V(x,x') Bx

� G: geometry term

� V: visibility term

� Properties

� No analytical solution,even for simple scenes

Form factor

x

x’

12/7/2009 18Andrew Nealen, Rutgers, 2009

Page 19: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The radiosity equation

� Discretize into elements with const. radiosity

Aj∑+=jijiii BFEB ρ

n

Reflection factor

� Properties

� Iterative solution

� Expensive geometry

computationsAndrew Nealen, Rutgers, 2009 12/7/2009 19

iA

∑j=1

jijiii

Form factor

Page 20: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The radiosity matrix

� n linear equations in n unknowns Bi:

∑+=j=1

jijiii BFEB ρn

� The solution of this LSE results in Bi, which are

independent of viewer position and direction

Andrew Nealen, Rutgers, 2009 12/7/2009 20

Page 21: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

The radiosity matrixIterative solution

� The radiosity of an element is replaced by the

multiplication of a row with the current

solution vector (Gathering)

(= Gauss-Seidel iteration)(= Gauss-Seidel iteration)

Andrew Nealen, Rutgers, 2009 12/7/2009 21

Page 22: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Rendering the radiosity solution

� Bi are constant per

Element

� How to map to

graphics hardware?

� Average radiosity-

values for each

vertex

� Extrapolate for

vertices on the

boundary

12/7/2009 22Andrew Nealen, Rutgers, 2009

Page 23: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Form factors

� Fij = Part of radiance from j that reaches i

� Influenced by:

� Geometry (area, orientation, position)

� Visibility (other elements of the scene)� Visibility (other elements of the scene)

patch i patch i patch i

patch jpatch j

patch j

12/7/2009 23Andrew Nealen, Rutgers, 2009

Page 24: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

patch j

θθθθj

Form factors

� Fij = Part of radiance from j that reaches i

patch i

θi

θθθθj

r

Fij = ∫ ∫ Vij dAj dAi

cos θi cos θj

π r21Ai Ai Aj

12/7/2009 24Andrew Nealen, Rutgers, 2009

Page 25: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Form factorsRay casting

� Create n rays between 2 elements

� n typically between 4 und 32

� Determine visibility

� Integrate point-point form factors A� Integrate point-point form factors

� Determines form factors

between elements

Ai

Aj

12/7/2009 25Andrew Nealen, Rutgers, 2009

Page 26: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Form factors

A

� Nusselt analog: the form factor is equivalent

to the part of the unit circle, which the

projection of the element occupies on the unit

sphere

Aj

Aj

r = 1 FdAi,Aj

dAi

sphere

12/7/2009 26Andrew Nealen, Rutgers, 2009

Page 27: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Form factorsHemicube algorithm

� Place hemicube at element center

� Discretize the sides into pixels

� Project and rasterize other elements into cube

� Each hemicube pixel contains precomputed form � Each hemicube pixel contains precomputed form factor

� Form factor for an element is the sum of contributions

� Visibility by depth buffer

Andrew Nealen, Rutgers, 2009 12/7/2009 27

Page 28: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Solving the radiosity equation

Form factor

computation

Iterative solution

of the LSE

Geometry

Reflection

properties < 10%

> 90% O(n2) form factors

of the LSE

Visualization

(Rendering)

Camera

position &

orientation

Radiosity solution

Radiosity Image

~ 0%

12/7/2009 28Andrew Nealen, Rutgers, 2009

Page 29: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Progressive refinement

� Idea: instead of collecting radiosity from all

sources (“gathering”), rather distribute

radiosity from brightest emitters (“shooting”)

Andrew Nealen, Rutgers, 2009 12/7/2009 29

Page 30: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Progressive refinement

1 1 1 1

2 2 2 2

i

i

B B F

B B F

ρρ

M

L L

L

MM

i

n n n ni

B

B B Fρ

= +

M

M

M

M

L L

M

M

12/7/2009 30Andrew Nealen, Rutgers, 2009

Page 31: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Progressive refinement

� Each patch has remaining radiosity ∆Bi

� Start with Bi=Ei and ∆Bi = Ei

� Distribute ∆Bi to the scene

� Reciprocity:� Reciprocity:

Andrew Nealen, Rutgers, 2009 12/7/2009 31

j ji i ijA F AF=

1

nj

i i i j ji

j i

AB E r B F

A=

= + ∑

1

, für alle n

i i i j i jj

B E r B F i=

= + ∑ for all i

Page 32: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Progressive refinement

� After sending from patch j, the radiosity of

elements Ai is increased

, 1..j

i i i j ji

i

AB B r B F i n

A= + ∆ =

� The nondisributed radiosity is also increased

� The set undistributed radiosity of j to zero

Andrew Nealen, Rutgers, 2009 12/7/2009 32

iA

, 1..j

i i i j ji

i

AB B r B F i n

A∆ = ∆ + ∆ =

0iB∆ =

Page 33: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Progressive refinementAdvantages

� Each iteration only requires form factors Fij for

element i w.r.t. all other patches

� Good results after few iterations, resulting in

significantly less overhead when compared to significantly less overhead when compared to

Gauss-Seidel iterations

� Only requires storing a single column of the

form factor matrix

Andrew Nealen, Rutgers, 2009 12/7/2009 33

Page 34: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Progressive refinementWithout ambient term

12/7/2009 34Andrew Nealen, Rutgers, 2009

Page 35: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Progressive refinementWith ambient term

12/7/2009 35Andrew Nealen, Rutgers, 2009

Page 36: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Discretization into patches

� Image quality depends

on the size of patches

� Smaller patches –

smaller error

� Patches should be � Patches should be

adaptively subdivided

where large gradients in

radiosity are evident

� Start with regular grid

� Subdivide based on

quality criterion

Andrew Nealen, Rutgers, 2009 12/7/2009 36

Page 37: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Discretization into patches

12/7/2009 37Andrew Nealen, Rutgers, 2009

Page 38: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Photon MappingJensen 95

12/7/2009 38Andrew Nealen, Rutgers, 2009

Page 39: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Examples

Lightscape http://www.lightscape.com12/7/2009 39Andrew Nealen, Rutgers, 2009

Page 40: CS 428: Fall 2009 Introduction to Computer Graphics · 2009. 12. 7. · Ray casting Create nrays between 2 elements ntypically between 4 und 32 Determine visibility Integrate point-point

Examples

Mental Ray

12/7/2009 40Andrew Nealen, Rutgers, 2009