cs 428: fall 2009 introduction to computer graphics · 2009. 12. 7. · ray casting create nrays...
TRANSCRIPT
CS 428: Fall 2009
Introduction to
Computer GraphicsComputer Graphics
Radiosity
12/7/2009 1Andrew Nealen, Rutgers, 2009
Problems with diffuse lighting
A Daylight Experiment, John FerrenA Daylight Experiment, John Ferren
12/7/2009 2Andrew Nealen, Rutgers, 2009
Problems with diffuse lighting
12/7/2009 3Andrew Nealen, Rutgers, 2009
Direct lighting
12/7/2009 4Andrew Nealen, Rutgers, 2009
Global lighting
12/7/2009 5Andrew Nealen, Rutgers, 2009
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
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
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
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
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
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
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
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
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
G(x,x')?
� Which constellation leads to a large exchange
of light and why?
Andrew Nealen, Rutgers, 2009 12/7/2009 15
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'
ω'
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')
� 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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∆ =
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
Progressive refinementWithout ambient term
12/7/2009 34Andrew Nealen, Rutgers, 2009
Progressive refinementWith ambient term
12/7/2009 35Andrew Nealen, Rutgers, 2009
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
Discretization into patches
12/7/2009 37Andrew Nealen, Rutgers, 2009
Photon MappingJensen 95
12/7/2009 38Andrew Nealen, Rutgers, 2009
Examples
Lightscape http://www.lightscape.com12/7/2009 39Andrew Nealen, Rutgers, 2009
Examples
Mental Ray
12/7/2009 40Andrew Nealen, Rutgers, 2009