# Texture Mapping in Scan Line Graphics

## 2D Texture Domain

Each pair of u, v uniquely corresponds to a point on the surface. We define the pattern as m (u, v) value = "color" so each point in pattern corresponds to a point on the object. The pattern can be a rectangular function but the object can be any shape that can be parametrically defined. (General discussion of 2D Texture Domain texture mapping).

First method (Forward Pixel Mapping)

go through parameters with small steps in u, v
for each u, v pair
get mapping color <= m (u, v)
compute x, y, z <= f (u, v)
project x, y, z onto screen and set pixel to color m (u, v)

Problem: what is good step size?
If it is too large in u, v, then it will skip pixels in PDC.
If it is too small in u, v, then it will be recomputing many pixels in PDC.
If it is too small in u, v, then we will have aliasing problem since we will recompute color but resultant color will only be last one computed but should be an average of all pattern values that map onto pixel.

Second method - reverse of the first method (called inverse pixel mapping)

go through pixels on the screen
for each pixel (on the surface), compute x, y, z => u, v
then set pixel color <= m (u, v)

Problem: sampling the map only at pixel centers causes aliasing i.e. Two adjacent pixel centers corresponding to widely separated areas on map correspond to sharp boundaries with intermediate regions skipped.A better method is do not compute point u, v in map corresponding to x, y, z of pixel centers but compute area in u, v range covered by pixel.

Another problem is finding u, v given x, y. For a simple surface (e.g., sphere, torus) with x = X(u, v), etc. u, v can be expressed in closed form (analytical solution) and computed. For a general surface we may not have closed form, so we must use iteration method
(e.g. Newton - Raphson) to solve system of 2 non-linear equations ¬
computationally expensive.

If surfaces are defined as parametric bicubic patches, e.g. Bezier or B-Spline
then we can use cheaper method like surface subdivision (amounts to replacing
original grid of control points with sets of finer points until only cover a
pixel ¾ more later)
Look at example of mapping bit map onto a portion of sphere

Last changed July 4, 1996, G. Scott Owen, owen@siggraph.org