Download presentation source

Download Report

Transcript Download presentation source

CS 551 / 645:
Introductory Computer Graphics
David Luebke
[email protected]
http://www.cs.virginia.edu/~cs551
David Luebke
7/27/2016
Radiosity Introduction

First lighting model: Phong
– Still used in interactive graphics
– Major shortcoming: local illumination!

Two post-Phong approaches:
– Ray tracing
– Radiosity
David Luebke
7/27/2016
Radiosity Introduction

Ray tracing: ad hoc approach to simulating
optics
– Deals well with specular reflection
– Trouble with diffuse illumination

Radiosity: theoretically rigorous simulation of
light transfer
– Very realistic images
– But makes simplifying assumption: only diffuse
interaction!
David Luebke
7/27/2016
Radiosity Introduction

Ray-tracing:
– Computes a view-dependent solution
– End result: a picture

Radiosity:
– Models only diffuse interaction, so can compute a
view-independent solution
– End result: a 3-D model
David Luebke
7/27/2016
Radiosity


Basic idea: represent surfaces in
environment as many discrete patches
A patch, or element, is a polygon over which
light intensity is constant
David Luebke
7/27/2016
Radiosity




Model light transfer between patches as a
system of linear equations
Solving this system gives the intensity at
each patch
Solve for R, G, B intensities and get color at
each patch
Render patches as colored polygons in
OpenGL. Voila!
David Luebke
7/27/2016
Fundamentals



Theoretical foundation: heat transfer
Need system of equations that describes
surface interreflections
Simplifying assumptions:
– Environment is closed
– All surfaces are Lambertian reflectors
David Luebke
7/27/2016
Definitions

Recall that Lambertian surfaces are
“perfectly diffuse”; they reflect incident light in
all directions equally
– Do Lambertian surfaces really exist?

The radiosity of a surface is the rate at which
energy leaves the surface
David Luebke
7/27/2016
Radiosity

Radiosity = rate at which the surface emits
energy + rate at which the surface reflects
energy
– Notice: previous methods distinguish light sources
from surfaces
– In radiosity all surfaces can emit light
– Thus: all emitters inherently have area
David Luebke
7/27/2016
Radiosity

Break environment up into a finite number n
of discrete patches
– Patches are opaque Lambertian surfaces of finite
size
– Patches emit and reflect light uniformly over their
entire surface


Q: What’s wrong with this model?
Q: What can we do about it?
David Luebke
7/27/2016
Radiosity

Then for each surface i:
Bi = Ei + i
 Bj Fji (Aj / Ai)
where
Bi, Bj= radiosity of patch i, j
Ai, Aj= area of patch i, j
Ei = energy/area/time emitted by i
i = reflectivity of patch i
Fji = Form factor from j to i
David Luebke
7/27/2016
Form Factors

Form factor: fraction of energy leaving the
entirety of patch i that arrives at patch j,
accounting for:
– The shape of both patches
– The relative orientation of both patches
– Occlusion by other patches
David Luebke
7/27/2016
Form Factors

Some examples…
Form factor:
nearly 100%
David Luebke
7/27/2016
Form Factors

Some examples…
Form factor:
roughly 50%
David Luebke
7/27/2016
Form Factors

Some examples…
Form factor:
roughly 10%
David Luebke
7/27/2016
Form Factors

Some examples…
Form factor:
roughly 5%
David Luebke
7/27/2016
Form Factors

Some examples…
Form factor:
roughly 30%
David Luebke
7/27/2016
Form Factors

Some examples…
Form factor:
roughly 2%
David Luebke
7/27/2016
Form Factors

In diffuse environments, form factors obey
a simple reciprocity relationship:
Ai Fij = Ai Fji

Which simplifies our equation:
Bi = Ei + i

Rearranging to:
Bi - i
David Luebke
 Bj Fij
 Bj Fij = Ei
7/27/2016
Form Factors

So…light exchange between all patches
becomes a matrix:
1 - 1F11
- 2F21
.
.
.
- pnFn1

David Luebke
- 1F12
1 - 2F22
.
.
.
- nFn2
… - 1F1n
… - 2F2n
…
.
…
.
…
.
… 1 - nFnn
B1
B2
.
.
.
Bn
E1
E2
.
.
.
En
Q: What do the various terms mean?
7/27/2016
Form Factors
1 - 1F11
- 2F21
.
.
.
- pnFn1




David Luebke
- 1F12
1 - 2F22
.
.
.
- nFn2
… - 1F1n
… - 2F2n
…
.
…
.
…
.
… 1 - nFnn
B1
B2
.
.
.
Bn
E1
E2
.
.
.
En
Note: Ei values zero except at emitters
Note: Fii is zero for convex or planar patches
Note: sum of form factors in any row = 1 (Why?)
Note: n equations, n unknowns!
7/27/2016
Radiosity

Now “just” need to solve the matrix!
– W&W: matrix is “diagonally dominant”
– Thus Guass-Siedel iteration must converge



End result: radiosities for all patches
Solve RGB radiosities separately, color each
patch, and render!
Caveat: actually, color vertices, not patches
(see F&vD p 795)
David Luebke
7/27/2016
Radiosity




Q: How many form factors must be
computed?
A: O(n2)
Q: What primarily limits the accuracy of the
solution?
A: The number of patches
David Luebke
7/27/2016
Evaluating Form Factors

Recall definition: the form factor between
patch i and patch j is the fraction of the
energy leaving the entirety of patch i’s
surface that reaches patch j.
–
–
–
–
David Luebke
Distance
Shape
Orientation
Occlusion
7/27/2016
Form Factors

Calculating form factors is hard
– Analytic form factor between two polygons in
general case: open problem till last few years

So how might we go about it?
– Hint: Clearly form factors are related to visibility:
how much of patch j can patch i “see”?
David Luebke
7/27/2016
Form Factors: Hemicubes

Hemicube algorithm: Think Z-buffer
– Render the model onto a hemicube as seen from
the center of patch i
– Store item IDs instead of color
– Use Z-buffer to resolve visibility

Advantages of hemicubes
– Solves shape, size, orientation, and occlusion
problems in one framework
– Can use hardware Z-buffers to speed up form
factor determination (How?)
David Luebke
7/27/2016
Form Factors: Hemicubes

What are some disadvantages of
hemicubes?
– Aliasing! Low resolution buffer can’t capture
actual polygon contributions very exactly

Causes “banding” near lights (plate 41)
– Actual form factor is over area of patch; hemicube
samples visibility at only center point on patch
(So?)
David Luebke
7/27/2016
Form Factors: Ray Casting

Idea: shoot rays from center of patch in
hemispherical pattern
David Luebke
7/27/2016
Form Factors: Ray Casting

Advantages:
– Hemisphere better approximation than hemicube

More even sampling reduces aliasing
– Don’t need to keep item buffer
– Slightly simpler to calculate coverage
David Luebke
7/27/2016
Form Factors: Ray Casting

Disadvantages:
– Regular sampling still invites aliasing
– Visibility at patch center still isn’t quite the same
as form factor
– Ray tracing is generally slower than
Z-buffer-like hemicube algorithms


David Luebke
Depends on scene, though
What kind of scene might ray tracing actually be faster
on?
7/27/2016
Form Factors

Source-to-vertex form factors
– Calculating form factors at the patch vertices
helps address some problems:
for every patch vertex
for every source patch
sample source evenly with rays
visibility = % rays that hit
– What are the problems with this approach?
David Luebke
7/27/2016
Form Factors

Summary of form factor computation
– Analytical:

Expensive or impossible (in general case)
– Hemicube


Fast, especially using graphics hardware
Not very accurate; aliasing problems
– Ray casting


David Luebke
Conceptually cleaner than hemicube
Usually slower; aliasing still possible
7/27/2016
Radiosity

More on radiosity:
– Progressive radiosity: viewing an approximate
solution early
– Hierarchical radiosity: increasing patch resolution
on an as-needed basis
David Luebke
7/27/2016