The use of multiple levels of texture may lead to better rendering performance and give a
more pleasant textured object in the 3D world as the distance between the object and the
viewer is changed. Usually, this is done by loading a series of texture images at different
resolutions and selecting the most appropriate one that match the size of the visual object
on the screen. The latter will of course change depending on how far the viewer is from
the object or as the user navigate through the virtual universe.
Using multilevel texturing is thus the same as using a DistanceLOD object. However,
with the former, the visual object will be textured, whereas with the latter, the object may
become untextured at certain distance.
Figure 11 shows an example of using multilevel texturing, activated with using the
argument Texture.MULTI_LEVEL_MIPMAP for MIPmap in line 12. Under this mode,
the series of texture images have sizes that decrease by a factor of 2 or areas that reduce
by a factor of 4 for adjacent images, with the smallest size being 1x1.
In this example, the base level or level 0 of the image series is given by color256.gif, the
minification filter is set to MULTI_LEVEL_POINT, and there are a total of 9 texture levels,
each loaded individually. Note, also, that the example does not correspond to the normal
usage of MIPmap, as each texture image actually corresponds to using a different color
instead of having a realistic texture image at different resolution. However, as illustrated
from the results obtained, this is for the purpose of illustrating how MIPmap works.
With Multitexturing, different textures can be applied to a geometrical object, or more
strictly to an appearance object, in a selective or combinational manner to create interesting
visual effects (Engel, Hastreiter, Tomandl, Eberhardt, & Ertl, 2000). When we have only
one texture, the appearance object will reference Texture, TextureAttributes and Texture-
CoordGeneration directly. However, when there is more than one texture, the appearance
object will reference these three texturing objects indirectly through a TextureUnitState
object instead. This blending mechanism is illustrated in Figure 12.
From a programming point of view, all the TextureUnitStates can be grouped together
to form a TextureUnitState array for passing to the appearance object. Note that the texture
coordinates, which can be automatically generated as discussed in previous sections using
TexCoordGeneration, for each texture may be different and must be explicitly specified.
Figures 13 and 14 give an example of using two textures, deck.jpg and lightmap.jpg,
for a quadratic array object, in lines 9 and 10. The argument 1 in line 10 signifies that there
will be only one set of texture coordinates, set 0. The next argument setmap is a 2-element