Graphics Reference
In-Depth Information
the value at the sample nearest to P . For a continuous density, this converges to
the correct value as the number of samples gets large, but the convergence is not
exactly the kind we'd like: For any fixed set of samples, the nearest-neighbor esti-
mate of density is piecewise-constant. (On a plane, the regions of constancy are
the Voronoi cells associated to the samples.) This leads to a great many discon-
tinuities. On the other hand, as the number of samples increases, the values in
adjacent cells get closer and closer, so while the set of discontinuities grows, the
magnitude of the discontinuities decreases [WHSG97].
There are many other forms of density estimation aside from nearest-neighbor
interpolation. Weighted averaging by some filter kernel is one; Jensen's method of
gathering a fixed number of samples and then dividing by a value that depends on
those samples is another. Whole topics have been written on density estimation,
and the statistics and mathematics quickly become increasingly complex as the
sophistication of the methods increases.
32.6.2 Further Photon Mapping
The hybrid ray-tracing-photon-mapper approach described above is very basic.
Just as we factored out direct lighting, computing it with ray-tracing rather than
the photon map, it's possible to build special photon maps that contain only
photons that have passed through particular sequences of scattering, such as
caustics and shadows (carefully omitting these photons from the generic pho-
ton map so that they're not double-counted). Such specialized maps can be used
to more accurately generate such phenomena, at the cost of ever-growing code
complexity.
There is one technique, however, that applies not just to photon mapping,
but to many algorithms: a final gather step, in which the incoming radiance at
the eye-ray/scene-intersection point is estimated by tracing several rays from that
intersection and using some estimation technique at the secondary intersections to
determine the radiance along those rays; these secondary estimates are then com-
bined to form an estimate along the eye ray. For instance, if the eye ray meets the
world at P , we trace 20 rays from P that meet the world at locations Q 1 ,
, Q 20 .
At each Q i , we can use our photon map to estimate the radiance leaving Q i in
the direction toward P , and then combine these 20 samples of arriving radiance at
P to get the radiance exiting from P toward the eye. By carefully selecting the
directions along which to sample, we can produce an estimate of the outgoing
radiance at P that has far fewer artifacts than would arise from the direct photon-
map estimate. For instance, if the photon map is using a disk-shaped reconstruc-
tion filter, and not very many photons, there will be many sharp discontinuities
in the reconstructed radiance estimates used at the points Q i . But when these are
averaged by the reflectance equation at P to produce the outgoing radiance there,
the result is far fewer artifacts in the final rendering.
The alteration in the code is quite minor, as shown in Listing 32.19: The
code for estimating the diffusely reflected indirect light at the point P gets a new
argument— useGather —that is set to true for primary rays but false for all sub-
sequent ones. When it's false, we use the photon map as above. But when it's true,
we essentially perform one-level ray tracing, with a large number of secondary
rays, using photonRender to estimate the incoming radiance along these.
...
 
 
Search WWH ::




Custom Search