Graphics Reference
In-Depth Information
Photon texture for each frame
First frame photon texture
(all photons are placed on
light sources)
frame 1
frame n
frame 0
frame 2
Photon texture
for one frame
Last frame
(final photon map)
Intermediate frame
(previous texture is used
as starting point)
Position
Power
Direction
= photon
1 photon
n photons
frame 0
frame 1
frame 2
Light
source
Figure 2.16 Encoding of photon frames and texture maps in GPU rendering.
complication is that the photons in each grid cell are not stored in any particular
order—they have to be routed to the proper pixels as they are drawn. This is done
by a fragment program, which intercepts the drawing of each pixel (fragment) in
the point. The stencil buffer is used to control to what pixels a particular photon
index is written. This is best illustrated by an example ( Figure 2.18 ), in which
each point is a 2
2 square of pixels indexed by 1 through 4. The photon value
is only written where the stencil buffer is the maximum index of 4. The stencil
values are incremented each time, so the maximum value shifts backward by one.
In practice each grid cell may contain more photons than the point in the
framebuffer. The stencil-buffer scheme tracks the number of photons destined
for each grid cell point and how many were actually written. The total power in
×
Screen
Point representing one grid cell
12
54
Photon ID
Figure 2.17 A photon map in the framebuffer.
 
Search WWH ::




Custom Search