Graphics Reference
In-Depth Information
Exercise 32.5: (a) We merged the photon map with a ray tracer. Can you think
of how to merge it with a path tracer instead?
(b) The photon mapper stops pushing around photons after some maximum depth;
that introduces a bias. How? For a photon map that allows only n bounces, con-
struct a scene where the resultant radiance estimate is drastically wrong, no matter
how many photons you send into the scene.
(c) Can you take the idea from the path tracer—“just continue tracing until things
stop”—and use it in the propagation of photons? Will it solve the problem with
the scene you constructed in part (b)?
Exercise 32.6: (a) Given a random number generator that produces values
uniformly in the interval [ 0, 1 ] , describe how to generate uniform random points
in the unit square.
(b) If you generate the point ( x , y ) with x
y , you can replace it with ( y , x ) , and
otherwise leave it unchanged. Show that this generates points uniformly in the
triangle with vertices ( 0, 0 ) , ( 1, 0 ) , ( 1, 1 ) .
(c) Let u = 1
<
( u + v ) . Show that applying this
transformation to the results of part (b) generates points uniformly at random in
barycentric coordinates on the triangle u + v + w = 1, 0
x , v = 1
y , and w = 1
1.
(d) Show that for any triangle PQR , the points uP + vQ + wR are distributed
uniformly at random in the triangle, when uvw are generated according to part (c).
Exercise 32.7: (a) Write a WPF program that uses the method in Exercise 32.6
to generate points in a triangle. The user should be able to drag the three triangle
vertices, and press buttons to generate either a single point or 100 points, each of
which should be displayed as a colored dot within the triangle. Another button
should clear the points.
(b) Extend your program to handle meshes. Generate a 2D mesh (perhaps the
Delaunay triangulation for a random set of points), and then improve your pro-
gram to pick a point (or 100 points) in the mesh uniformly at random. Do so
by precomputing the triangle areas, summing them, and then assigning each
triangle a probability given by its area divided by the total area. Put the trian-
gles in some order, and compute probability sums s [ 0 ]= p [ 0 ] , s [ 1 ]= p [ 0 ]+ p [ 1 ] ,
s [ 2 ]= p [ 0 ]+ p [ 1 ]+ p [ 2 ] , etc. Given a uniform random variable u , you can now
identify the largest index i with u
u , v , w ,
s [ i ] . To generate a random mesh point, you
can pick a uniform random number u , identify the last triangle i with u
s [ i ] , and
then generate a random point in that triangle (see Exercise 32.6).
(c) Briefly discuss how to make the triangle-selection process faster than O ( n ) ,
where n is the number of triangles in the mesh.
(d) Suppose that in ordering the triangles, we place the largest ones first. Then
in a search of the list, we're likely to examine relatively few triangles to find the
“right” one. Would you, in working with a typical graphics model, expect this to
have a large impact on the sampling time? Why or why not?
Exercise 32.8: We've argued that an eye ray hitting a point source is a
probability-zero event, so we can ignore point sources. But since a point source
is generally used to represent a limit of ever-tinier spherical sources, and for any
such spherical source there's a nonzero probability of an eye ray hitting it, the
“can ignore” argument depends on what happens in these approximating cases.
The radiance emitted by such a small approximating sphere is proportional to the
inverse square of its radius (to maintain constant power); the probability of an eye
ray hitting it is proportional to its squared radius; hence, the expected contribution
to the pixel (once it's small enough for its image to be completely contained in
Search WWH ::




Custom Search