Bit width necessary for solid texturing hardware
Masaki Kameya John C. Hart
School of Electrical Engineering and Computer Science
Washington State University
Abstract cause texture discontinuity. For example, cubic object has
6 surface patches and if each surface is texture mapped
The simulation result of the eﬀects of the coordinate tex- independently, the edge of cube shows the discontinuous
ture precision to the image for procedural texture mapping texture. The notion of solid texturing has introduced by
is presented. In our project, we are trying to implement pro- Peachey[Peachey85]. With solid texturing, the volume of an
cedural solid texture mapping by hardware. By reducing the object is taken as the input of a mapping function, not only
number of parameters for our texture mapping model and just taken the surface point of the object. This makes be un-
precision of texture coordinate, we can implement it with necessarily to consider the boundary of patches to calculate
small number of gates. We checked that how many bits the texture value. Taking the object coordinate x = (x, y, z),
were required to produce the image without degrading orig- the color of the c = (r, g, b) for the corresponding point or
inal by simulation and conﬁrmed that we could have good index to the color table is computed by the texture mapping
textured image even with small number of bit width. function.
The texture mapping function is a mapping from the mod-
eling coordinate value to the color value, i.e. The color of
1 Introduction the model c = f (x), where c is the color of object, x is the
Texture mapping is a common method to add realism to the coordinate of object, and f is a texture mapping function.
computer generated objects. Either pre-deﬁned or proce- When plot the pixel at screen coordinate (i, j), the cor-
durally deﬁned texture is mapped to the objects. In a ba- responding object coordinate x = (x, y, z)is obtained by
sic texture mapping, pre-deﬁned image has to be generated viewing transform, then corresponding texture cooridinatete
in texture coordinate, usually rectangular and the image is s = (s, t, r) is obtained. The color c or index to the color
stored in memory. Texture coordinate is associated with table of the pixel is obtained by texture mapping function.
object coordinate. Corresponding pixel in an object is re- Noise function is employed to achieve more naturalistic
placed with the value in texture coordinate. Many memory texture. The noise is known as Perlin noise[Perlin85] and
space is required to store the several kind of texture image this noise function plays a great role in procedural texture
to augment realism of images. In addition, if the scale of mapping.
the object is changed, the scale of texture has to be changed In our texture mapping model, we use the solid texturing
too. Several scale of texture image have to be prepared to function f :
support the change of image scales. However, it is imprac-
tical to store every scale of texture image for every possible f (s) = g(s + ai n(Ti (s))) (1)
scales. Another problem is bandwidth limitation. Although i
cost of memory per bit is decreasing, the band width is not
increasing as fast as costs decrease. Even there is plenty of where, g is a quadric classiﬁcation function, n is a noise
memory, we can not get the appropriate texture data to plot function, ai is scalar andTi is some transform function to
the pixel. This cause the problem for real time application. control noise frequency and phase of noise to get desirable
To overcome these diﬃculties, procedural texture map- noise value. f is R3 → R and the value of f is used as index
ping is employed and this tequnique is getting more popular to the color table. Function q is the quadric form :
recently. Instead of storing texture images in the memory, a
function to calculate texture value for speciﬁed object coor- g(s, t, r) = As2 +2Bst2 Csr+2Ds+Et2 +2F tr+2Gt+hr2 +2Ir+J
dinate is deﬁned. (2)
In our project, we are trying to implement hardware for This function can represent spherical, cylindrical, hyperbolic
procedural texture mapping with small number of gates. In and parabolic texturing, depending on the choice of param-
next section, we describe our texture mapping model and eters A, B, · · · , J.
the simpliﬁcation. Then following section, the result of sim- Wood and marble texturing on a cubic object is presented.
ulation that check the eﬀect of bit width to the image is
2 Procedural Texture Model Wood texture is achieved by using a collection of concentric
cylinders. In addition, waviness of grain is created by noise
In procedural texture mapping, texture is computed from function. Wood texturing function is deﬁned as:
pre-deﬁned function according to the model location, instead
of assign a color of pre-stored image data. Traditional map- f (s, t, r) = s2 + t2 + n(4s, 4t, r) (3)
ping is done by taking object surface coordinate as input
and output the corresponding texture color. It is simple The value of f is used inex to the color table. Color table
mapping function but some times it cause problem. If spe- consists of a linear interpolation of a light wooden grain and
cial care is not considered, the boundary of surface patch a darker wooden grain.
Table 1: Number of bits with no diﬀerence from the original
Marble texture is acheived by using linear ramp function.
Noise function is also used to distort linear ramp function. bits bits
Coordinate s 6 7
Noise N 6 7
f (s, t, r) = r + 2−i n(2i s, 2i t, 2i r) (4) (s, N ) (6,6) (7,7)
2.3 Limitation for hardware implementation
Our goal is to implement the procedural texturing in hard- jaggy lines were recognized. Fro marble texture, no diﬀer-
ware. Full implementation of classiﬁcation described in (2) is ence between 16 bits bit width and 7 bit width bits image.
required to millions of gate number. Calculation for texture Under 6 bits of bit width, we can see the diﬀerence.
mapping function rquires 15 multiplications and 9 addition Next, we changed the bit width of output of noise function
and to store 10 parametes for each textur type. However, N . For wood texture, we could not see the any diﬀerence
all of classiﬁcation function term is not alway necessarily to between 16 bit width and 6 bits width image. For marble
produce various kind of texture. We can use simpliﬁd form texture, noise value can be reduced to 7 bits.
texture mappping function and can limit the number of pre- Finally, we changed the both texture coordinate and noise
cision of input values of texture mapping function to achieve value at the same time. Even though the both bit width were
implemantation with about 100,000 gates. reduced, the result were same as the case in which the bit
The classiﬁcation funciton (2) can be modiﬁed to use less reduction for each value was done independently. Wood and
parameters. In our model, we employed only four parame- marble textured images are shown in ﬁgure 1- 12 with the
ters. The modiﬁed version of classiﬁcation function g is: width of texture coordinate s and noise function N . It shows
that we can reduce the bit width to 6 bits for wood and 7
g (s, t, r) = As2 + Et2 + Ir + J (5) bits for marble.
From the result, in our texture mapping model, we can
This form requires only ﬁve multiplications and four addi- reduce the bit width of both texture coordinate and noise
tions and four parameters to be stored. value to about 7 bits without degrading the textured image.
The noise function is commonly summed into a fractional
1/f β frequency distribution and the lacunarity of such dis-
tribution is typically two. Therefore, we model the noise 4 Antialiasing and Perspective Correction
function N :
In some application, the scale of the object is changed. In
N = an(2ks + φs , 2kt + φt , 2kr + φr ) (6) that case, texture scale also must be changed accordingly.
Procedural texture mapping is more ﬂexible compare to tra-
With this form, only three frequency component (ks , kt , kr ) ditional texture mapping. In traditional mapping, several
and three values (φs , φt , φr ) The texture image produced scale level of images. With procedural texturing, texture
with this simpliﬁed version of classiﬁcation for marble and mapping function has a certain sampling frequency. If the
wood texturing are shown in ﬁgure 1 and ﬁgure 7. With this sampling rate of texture coordinate is over that frequency,
form of texture mapping function, various types of texture there is no problem. However, in the case of that sampling
can be produced and some example are presented in [Hart]. rate is below that frequency, there could be large diﬀerence
As further step towards the gate reduction, we reduce the between the neighboring pixels. It cause the aliasing eﬀect.
precision of input value to the texture mapping function, Therefore, in the case of image miniﬁcation, anti-aliasing
i.e. the presicion of texture coordinate(s, r, t) and the out- method is utilized to avoid this eﬀect. Filtering texture
put value of noise function. The image shown in ﬁgure 1 method is used to avoid aliasing. We analyze the texturing
and ﬁgure 7 is produced with 16 bits of (s, t, r) and noise function to determine its proper sampling frequency. The
value. We check that how many bits can be reduced to ob- frequency corresponds to the box ﬁlter that eliminate the
tain reasonable image by simulation and next section show frequency cause aliasing. We apply box ﬁlter to the proce-
the result. dural texture by averaging the elements of the color table of
texture. Width of ﬁlter can be computed from the gradient
of texture mapping function f in terms of screen coordinate
3 Simulation Result i and j [Hart].
For implementing in hardware with small number of gate f= g+ ai ni (7)
count, some limitation on the number of bits for input value i
is required. We limited the precision of texture coordinate
and noise value to achieve that. To see the eﬀect of the Another problem to be consider is perspective
precision of these value, we checked the image quality by correction[Blinn, Ewins]. Suppose we provided the
changing the bit width of texture coordinate and noise value. correspondence between texture coordinate (s, t) and screen
The width of texture coordinate s and N independently, coordinate (i, j). When we plot the pixel, corresponding
whereas each of texture coordinate component s, t and r has object coordinate (x, y, z) is calculated, then calculate (s, t)
same bitwidth. Starting from 16 bits, bit width was de- by transformation T in our texturing function f . Then the
creased until we can see the any change in image. color is evaluated by f .
Simulation has done to the wood and marble texture. The When an image is draw by scan line conversion, we can
result is summarized in table 1. Firstly, the width of texture calculate s and t by incrementally with partial derivatives of
coordinate was reduced. For wood texture, we could not see s and t with respect to screen coordinate i and j. We can
the any diﬀerence until 5 bits. Under 5 bits of precision, have edge table to be drawn in the screen and corresponding
texture coordinate. We have to interpolate the texture coor- [Perlin85] Perlin, K., An Image Synthesizer, Compute
dinate to plot between vertecies. However, s and t can not Graphics 29(3), July 1985, pp.287-294.
be calculated from linear interpolation, because the trans-
formation from texture coordinate to object coordinate is [Blinn] Blinn, J., Hyperbolic Interpolation, IEEE Computer
not an aﬃne transform, but an perspective transform. With Graphics and Applications, vol.12, no.4, July 1992,
a homogeneous coordinate, the object coordinate is repre- pp.89-94.
sented with 4 component as x = (x, y, z, w). The screen
coordinate (i, j) can be calculated from (x, y) by dividing [Ewins] Ewins, J.P. et al, MIP-Map Level Selection for Tex-
w component, i. e. (i, j) = (x/w, y/w). The projection ture Mapping, IEEE Trans. on Visualization and Com-
from the texture coordinate to the object coordinate is also puter Graphics, vol.4, no. 4, Oct. 1998, pp.317-329.
a perspective projection. We have to perspective correction
to texture coordinate too. We can compute texture in terms
of screen space by (S, T, Q) and texture coordinate is com-
puted from S and T by dividing by Q[Ewins]. Q can be
represented with object coordinate i and j:
Q = di + ej + f (8)
d, e and f can be calculated the any three points inside a
plane in the object space. In addition, S and T also can be
S = ai + bj + c, T = gi + hj + k (9)
We have to compute si , sj , ti , tj , where si represents partial
derivative with respect to i, i.e. ∂s/∂i si , sj , ti , tj is calcu-
lated as follows:
af − cd + (ae − bd)j
gf − kd + (ge − hd)j
bf − ce + (bd − ae)j
hf − ke + (hd − ge)j
tj = (10)
Each time changing a scan line, we have to compute the sj
and tj . For each pixel, we have to compute the si and tj
to compute s and t for the next pixel. Because si and ti
is calculated for each pixel, it requires many computation.
To reduce computation, we have to use some estimated vale.
We are currently working on the checking if the perspective
correction is working correctly.
The eﬀect of texture coordinate precision to the image is
studied. From simulation result, we can get reasonable im-
ages in our simpliﬁed mapping model with even a small num-
ber of texture coordinate precision. As future work, we have
to check if the perspective correction is working on our pro-
gram. In addition, the other representation of texture using
our texturing model have to be considered and have to be
checked when the simpliﬁcation and the coordinate precision
[Hart] Hart, J. C., Tibbits, S. A. and Coleman T., An-
tialiased Procedural Solid Texturing Hardware, to ap-
[Peachey85] Peachey, D.R., Solid Texturing of Complex Sur-
faces, Computer Graphics 19(3), July 1985, pp.279-286.
Figure 1: Wood (s, N)=(16 bits, 16 bits) Figure 4: Wood (s, N)=(16 bits, 6 bits)
Figure 2: Wood (s, N)=(6 bits, 16 bits) Figure 5: Wood (s, N)=(15 bits, 5 bits)
Figure 3: Wood (s, N)=(5 bits, 16 bits) Figure 6: Wood (s, N)=(6 bits, 6 bits)
Figure 7: Marble (s, N)=(16 bits, 16 bits) Figure 10: Marble (s, N)=(16 bits, 7 bits)
Figure 8: Marble (s, N)=(7 bits, 16 bits) Figure 11: Marble (s, N)=(16 bits, 6 bits)
Figure 9: Marble (s, N)=(6 bits, 16 bits) Figure 12: Marble (s, N)=(7 bits, 7 bits)