Graphics Reference
In-Depth Information
p0
p0
Vertex program
p0
p0
(a)
p0
p0
Stencil buffer
(b)
p0
34
12
p1
p0
(c)
p1
45
23
Figure 2.18 GPU photon map creation by fragment shader application. (After [Purcell et al. 03].)
the grid can be distributed (approximately) over the stored photons by scaling the
power of each by the ratio of stored photons to actual grid photons. Computing
the radiance from only the stored photons thus gives the true strength, although
the accuracy depends on the assumption that all grid photons have approximately
the same power.
As described above, the radiance estimate in photon mapping is done by aver-
aging the k nearest neighboring photons at the shading point. An approximation to
this is employed in the hardware implementation; Jensen's k d-tree representation
is too complicated. In any case, the search has to be performed in the framebuffer.
The method queries the grid by starting at the pixel in the framebuffer containing
the shading point, following pixels in concentric “circles” centered at this point
until at least k photons are found. Again, an example is the best way to describe
the method. In this example, illustrated in Figure 2.19, k
4. The algorithm em-
ploys a maximum search radius to limit the search, and a running search radius
bounding all the photons discovered so far. The general steps are as follows.
=
1. The maximum lookup radius is set, corresponding to the maximum radius
of the search sphere (this is the radius of the circle shown in Figure 2.19(a)).
2. The radiance of up to k photons inside the grid cell containing the query
point are added to the radiance sum. As each photon is added, the search
 
Search WWH ::




Custom Search