Rationale
---------

PRISMS 5.4 is pushing the limits of realism possible with SGI texture
mapping.  Multi-layer 3D solid textures (known as procedural textures),
generated from lava, can be viewed and deformed at real-time speeds on
SGI and some game hardware.

In the past, real-time hardware texture mapping allowed for 2D images
to be projected onto the polygons of any 3D geometry.  It was
impossible to apply procedurally generated textures to 3D surfaces in
real-time.

In /ufs/demo/Texture/TextureUnwrap is a demonstration of how texture
unwrapping can be used to

1.	Apply a multi-layer procedurally generated texture to SGI
	hardware texture mapped surfaces (it works on any Indigo,
	Indigo2 and Indy too!)

2.	Export a multi-layer procedurally generated texture and
	geometry to an external system such as a game system that
	supports 3D texture mapping.

Procedure
---------

First, in lava we easily pre-render a complex multi-layer texture on a
3D surface that has been automatically "flattened out".  This results
in a special texture map and a special .bpoly geometry file whose
texture UVs have been changed to match up with the texture map.

Then we load the (SGI or game) texture map memory with the pre-render
texture map.  We also display the UV-modified geometry in gouraud
display mode.

In this unwrap*.bmot, there are two geometry objects.  "input" is used
to create the .bpoly and the unwrapped texture with lava.  It is the
object from which the unwrapped texture is created.  Start lava from
"input" of the Objects Dialog List.  After clicking "Position" and
accepting the default position, we click "Unwrap".  We tell it to
create two files in the current directory, unwrapped.pic.Z and
unwrapped.bpoly.

These two files are exported to a game system, another .bmot, or in
this case, they are used to texture the object, "output" in this
.bmot.  In output, the SOP is just a read SOP of unwrapped.bpoly, and
the material is just a "Apply Coloring" of unwrapped.pic.Z.  Turning on
gouraud display mode with "output" displayed is all that is needed to
see the results.

Limits and Capabilities
-----------------------

On the Onyx and Crimson, this is played and inspected in real-time.

This affects the texture mapping of the diffuse color only.  Current
texture mapping hardware doesn't support mapping other parameters like
bump or specular reflectivity.

The pre-render stage, which takes a few minutes, needs to be performed 
multiple times if the texture is animating.  This is fine when the 
texture is a cycle that can be repeated in the hardware.

One advantage is that one texture can be locked to a bending surface,
such as the texture on a human hand..

Images in This Directory
------------------------

These images are made by picwrite in Action on unwrap1.bmot on a 24-bit
Indigo XZ.  It was done with double buffering off, and backfaces of object
"output" were turned off (in the polygon shader of the OBJECTS Dialog List).
With no anti-aliasing, it took about 1 second to shade.  With 3x3 
anti-aliasing, it took 9 seconds.  On a Reality Engine, it should be
close to 30 frames per second.
