One of NuGraf's greatest strengths is its texture mapping
capabilities. Two variants are provided: 2D image mapping and 3D
procedural texture mapping.
2D image mapping allows bitmap images to be applied
to a surface under the control of (u,v) texture coordinates that are
associated with the polygon vertices, whereas,
3D procedural texture mapping 'creates' a virtual
texture on-the-fly by using a small procedural program applied at each pixel.
The following two images clearly illustrate the difference between
2D and 3D texture mapping. The left image shows the effect of wrapping a checkerboard
bitmap image around a sphere using 2D image texture mapping; the bitmap acts like a
"rubber sheet" that is stretched or compressed to conform to the shape of the
sphere. The right image demonstrates 3D procedural texture mapping. In this example the
sphere has been "carved" out of procedurally-generated black & white cubes.
2D texture mapping, as its name implies, consists
of mapping a flat 2D bitmap image onto a flat or curved 3D surface. This process is
illustrated in the following diagram. The left diagram represents a 512x512 resolution
bitmap image which contains a digitized image of the letters '2D' whereas the right
diagram contains 3 polygons to which have been assigned (u,v) texture coordinates at their
four corners. The 2D texture mapping process consists of mapping the bitmap pixels of the
left diagram to the 3D surface of the polygons on the right diagram.
On the other hand, 3D procedural texture mapping
compute the texture color by mapping the object's 3D location in space directly into a
color using a small C language procedure. This provides for great generality since a
single point can be mapped to millions of different colors. The NuGraf toolkit includes a
wide variety of 3D procedural texture functions, some of which are illustrated below (fBm,
waves, checkerboard, black marble and wood):
Each 3D procedural texture function includes from one to six
user-definable parameters, Perlin noise generator controls, 'space distortion' controls
and base-color parameters. To evaluate this functionality it is recommended that the '3D
Procedural Texture Editor' be used within Okino's "NuGraf", as shown below:
Figure 3: NuGraf's
"3D Procedural Texture Editor"
Different implementations of 2D texture mapping can often be
distinguished from the method used to filter the texture, if such filtering is done at
all. Since a 2D texture image must be shrunk or enlarged to match the dimensions of its
projected area on a textured object, texture filtering is required so that no unusual
artifacts are introduced into the final image (aliasing artifacts). Low-end
rendering systems typically do not perform texture filtering at all since the operation is
complex to implement and costly to perform. However, at the core of the NuGraf 2D
texturing system is a complete implementation of the industry standard MIP map
filtering technique. This provides for high-quality texture mapping with minimal time and
memory overhead. By interpolating the (u,v) texture coordinates at the four corners of a
pixel the NuGraf renderer can produce perfect texture filtering (without user
intervention) by projecting the square pixel region out onto the texture bitmap in 3D
space; this projected texture area determines how much of the texture the pixel 'sees' and
thus determines the degree of texture filtering required.
The 2D texture mapping implementation in the NuGraf Toolkit has many features:
Import of 2/4/8/16/24 and 32 bit bitmap image files,
Complete alpha channel support. Alpha channels can be extracted from
the bitmap images or can be computed using one of 8 algorithms based on an image's
intensity or its R/G/B channels,
Handles non-square texture images (most rendering systems cannot),
Control over wrap-around toggles, filtering method, blur control and
image cropping,
If multiple materials reference the same 2d bitmap then only one copy
of the bitmap will be stored in memory,
Planar, spherical and cylindrical projections allow texture to be
added to any shape or form of geometry,
Unlike most rendering systems, NuGraf accurately computes the true
area on the texture requiring filtering. Other systems 'oversample' by guessing, producing
blurry images.
The user can choose between different filtering methods.
2D texture may be scaled and translated to place it anywhere on the
object.
Each level of the MIPmap pyramid is computed on-the-fly and only when
required to reduce memory usage and to speed up the overall texture mapping process.
Texture images are properly foreshortened for perspective projections
so that they do not appear to "swim" across a surface in an animation. The left
image below shows what a checker-textured polygon looks like without this feature enabled
and the right image shows the texture-foreshortened version:
In addition, for the 3D procedural textures, a fast fixed-point
implementation of the perlin noise routine leads to efficient computation of
otherwise compute-intensive procedural textures. 3D textures may also be locally and
globally transformed just as with cameras and basic geometry.