16.2.5 Sampling Frequency

There are a number of factors to consider when choosing the number of slices (data polygons) to use when rendering your volume:

**Performance**- It's often convenient to have separate ``interactive'' and ``detail'' modes
for viewing volumes. The interactive mode can render the volume with a
smaller number of slices, improving the interactivity at the expense of
image quality. Detail mode - rendering with more slices - can be
invoked when the volume being manipulated slows or stops.
**Cubical Voxels**- The data slice spacing should be chosen so that the texture sampling rate
from slice to slice is equal to the texture sampling rate within each slice.
Uniform sampling rate treats 3D texture texels as cubical voxels, which
minimizes resampling artifacts.
For a cubical data volume, the number of slices through the volume should roughly match the resolution in texels of the slices. When the viewing direction is not along a major axis, the number of sample texels changes from plane to plane. Choosing the number of texels along each side is usually a good approximation.

**Non-linear blending**- The over operator is not linear, so adding more slices
doesn't just make the image more detailed. It also increases the overall
attenuation, making it harder to see density details at the ``back'' of the
volume. Strictly speaking, if you change the number of slices used to
render the volume, the alpha values of the data should be rescaled. There
is only one correct sample spacing for a given data set's alpha values.
Generally, it doesn't buy you anything to have more slices than you
have voxels in your 3D data.
**Perspective**- When viewing a volume in perspective, the density of slices
should increase with distance from the viewer. The data in the
back of the volume should appear denser as a result of perspective distortion.
If the volume isn't being viewed in perspective, then uniformly spaced
data slices are usually the best approach.
**Flat vs. Spherical Slices**- If you are using spherical slices to get good close-ups of the data, then
the slice spacing should be handled in the same way as for flat slices.
The spheres making up the slices should be tessellated finely enough to
avoid concentric shells from touching each other.
**2D vs. 3D Textures**- 3D textures can sample the data in the , , or directions freely. 2D textures are constrained to and . 2D texture slices correspond exactly to texel slices of the volume data. To create a slice at an arbitrary point would require resampling the volume data.

Theoretically, the minimum data slice spacing is computed by finding the longest ray cast through the volume in the view direction, transforming the texel values found along that ray using the transfer function (if there is one), then finding the highest frequency component of the transformed texels, and using double that number for the minimum number of data slices for that view direction.

This can lead to a large number of slices. For a data cube 512 texels on a side, the worst case would be at least slices, or about 1774 slices. In practice, however, the volume data tends to be bandwidth limited; and in many cases choosing the number of data slices to be equal to the volume's dimensions, measured in texels, works well. In this example, you may get satisfactory results with 512 slices, rather than 1774. If the data is very blurry, or image quality is not paramount (for example, in ``interactive mode''), this value could be reduced by a factor of two or four.