Accurate Constant-z Scanline Perspective Texture Mapping

Keith H. Randall

unpublished

[Full text in Postscript, 110KB]


Abstract

Modern perspective texture mappers scan-convert polygons into horizontal scanlines and then draw each horizontal scanline in turn. Because a horizontal scanline is not uniformly distant in the field of view, its texture coordinates are a nonlinear function of the screen coordinates. Computing this nonlinear function requires an expensive divide operation or a potentially inaccurate approximation such as quadratic or piecewise linear.

A different approach to texture mapping is to use constant-z scanlines, scanlines that traverse a polygon at a fixed depth of field, allowing their texture coordinates to be computed easily and efficiently. In general, such scanlines will not be horizontal but will instead be at some arbitrary angle on the screen. Angled scanlines can only be approximated on a real display, however, because pixels must be addressed by integral coordinates. The resulting approximation leads to an image that appears "wavy".

This paper provides a new algorithm for correcting the texture coordinates of the constant-z scanline to accomodate the fact that it cannot be drawn exactly. Our algorithm computes a first-order approximation to the deviation of the texture coordinates from the constant-z scanline and gives an efficient linear recurrence for computing this deviation incrementally. With this correction, constant-z scanlines produce accurate results and require no expensive operations (multiplies and divides) in the inner loop, making constant-z scanlines practical for accurate perspective texture mapping.