3D graphics eBook - Course Materials Repository
3D graphics eBook - Course Materials Repository
3D graphics eBook - Course Materials Repository
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Bilinear filtering 15<br />
Limitations<br />
Bilinear filtering is rather accurate until the scaling of the texture gets below half or above double the original size of<br />
the texture - that is, if the texture was 256 pixels in each direction, scaling it to below 128 or above 512 pixels can<br />
make the texture look bad, because of missing pixels or too much smoothness. Often, mipmapping is used to provide<br />
a scaled-down version of the texture for better performance; however, the transition between two differently-sized<br />
mipmaps on a texture in perspective using bilinear filtering can be very abrupt. Trilinear filtering, though somewhat<br />
more complex, can make this transition smooth throughout.<br />
For a quick demonstration of how a texel can be missing from a filtered texture, here's a list of numbers representing<br />
the centers of boxes from an 8-texel-wide texture (in red and black), intermingled with the numbers from the centers<br />
of boxes from a 3-texel-wide down-sampled texture (in blue). The red numbers represent texels that would not be<br />
used in calculating the 3-texel texture at all.<br />
0.0625, 0.1667, 0.1875, 0.3125, 0.4375, 0.5000, 0.5625, 0.6875, 0.8125, 0.8333, 0.9375<br />
Special cases<br />
Textures aren't infinite, in general, and sometimes one ends up with a pixel coordinate that lies outside the grid of<br />
texel coordinates. There are a few ways to handle this:<br />
• Wrap the texture, so that the last texel in a row also comes right before the first, and the last texel in a column also<br />
comes right above the first. This works best when the texture is being tiled.<br />
• Make the area outside the texture all one color. This may be of use for a texture designed to be laid over a solid<br />
background or to be transparent.<br />
• Repeat the edge texels out to infinity. This works best if the texture is not designed to be repeated.<br />
Binary space partitioning<br />
In computer science, binary space partitioning (BSP) is a method for recursively subdividing a space into convex<br />
sets by hyperplanes. This subdivision gives rise to a representation of the scene by means of a tree data structure<br />
known as a BSP tree.<br />
Originally, this approach was proposed in <strong>3D</strong> computer <strong>graphics</strong> to increase the rendering efficiency by<br />
precomputing the BSP tree prior to low-level rendering operations. Some other applications include performing<br />
geometrical operations with shapes (constructive solid geometry) in CAD, collision detection in robotics and <strong>3D</strong><br />
computer games, and other computer applications that involve handling of complex spatial scenes.<br />
Overview<br />
In computer <strong>graphics</strong> it is desirable that the drawing of a scene be done both correctly and quickly. A simple way to<br />
draw a scene is the painter's algorithm: draw it from back to front painting over the background with each closer<br />
object. However, that approach is quite limited, since time is wasted drawing objects that will be overdrawn later,<br />
and not all objects will be drawn correctly.<br />
Z-buffering can ensure that scenes are drawn correctly and eliminate the ordering step of the painter's algorithm, but<br />
it is expensive in terms of memory use. BSP trees will split up objects so that the painter's algorithm will draw them<br />
correctly without need of a Z-buffer and eliminate the need to sort the objects; as a simple tree traversal will yield<br />
them in the correct order. It also serves as a basis for other algorithms, such as visibility lists, which attempt to<br />
reduce overdraw.<br />
The downside is the requirement for a time consuming pre-processing of the scene, which makes it difficult and<br />
inefficient to directly implement moving objects into a BSP tree. This is often overcome by using the BSP tree