ThreeDRenderDoc.tioga
Crow, September 2, 1987 5:40:59 pm PDT
ThreeDRenderDoc
CEDAR 6.1 — FOR INTERNAL XEROX USE ONLY
ThreeDRender
3-D Shapes Rendered on Cedar Displays
Frank Crow
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: This package provides shaded renditions of numerically-described three dimensional shapes on Cedar displays (LF, Dorado Color display) or Interpress devices. Quick display for line drawings and faceted objects allows near-real-time display of simple shapes. For more complex scenes or more expensive shading techniques, a short sequence of images may be computed and then played back at real-time rates. More elaborate shading techniques include: smoothly varying shading for curved surfaces, highlights, simulated transparency, mapped and space-filling textures, and antialiasing. Currently, this package supports only shapes approximated by polygons and Bezier patches.
Created by: Frank Crow
Maintained by: Frank Crow <Crow.pa>
Keywords: 3-D, antialiasing, shading, highlights, image synthesis, texture, transparency
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
0. Command files
ThreeDDemo.load - starts everything including the demo package.
ThreeDImager.install - runs imager-based code for faceted shading and interpress output.
ThreeDWorld.install - runs all code underlying the demo.
1. Demo Package
General Features
A demonstration package is included in the release. It is started up by the command ThreeDDemo. The demo starts up the color display and displays a viewer with an array of buttons for exercising various features of the system. Three built-in scenes are provided which can be viewed from various positions and shaded in different manners. Sequences of images are provided for real-time playback. Pop-up buttons provide a terse explanation of the available features.
Built-in Scenes
Three scenes are provided: The first consists of an icosahedron, a cube with a cut corner, and a soccer ball-like shape above a checkerboard, the second shows an egg shape, a banana shape and a piece of stemware, the third shows the famous Newell teapot as a demonstration of Bezier patches. The button labeled "Select Scene" chooses among them.
The first scene demonstrates the capability for quickly rendering simple scenes. The icosahedron and soccer ball have individually colored polygons. The cube with a cut corner has individually colored vertices when smooth shaded.
The second scene demonstrates the approximation of curved surfaces using polygons. The images cannot be generated as quickly, but provide more interesting shapes. The piece of stemware is transparent, as can be seen when an antialiased rendition is requested ("NoJaggy" mode).
The third scene demonstrates rendition of directly defined curved surfaces. Line drawings show just the patch boundaries. Shaded images are rendered by successive subdivision of the patches. When the patch edges become straight to within a pixel or so, the resulting collection of patches is rendered as polygons.
Button and Mouse Semantics
The menu buttons have the following meanings:
- Select Scene - Selects one of the predefined scenes.
- Shading Style - applies the chosen shading style to all objects in the current scene. Most of these options should be self-evident. Try it, if not.
- Rendering Style - chooses the display type and various options such as antialiasing, double-buffering and depth-buffering. Some options will cause the display to turn itself off and come up in a different mode.
- DoIt - makes/stores images, left button generates an image, middle button stores current image in a file named by the current selection, right button generates an interpress description of the current scene (faceted shading and lines only) and writes it to a file named by the current selection.
- Animation - "Orbit" generates a sequence of images on an elliptical path about the scene starting at the eyepoint used for the most recently generated image. It continues making images until the STOP! button is used. Other options play back precomputed image sequences. These sequences are stored on various servers and take a fair amount of time to load. The playback frame rate is controlled by the x-coordinate of left mouse clicks.
- Gallery - Chooses among a collection of AIS files produced by ThreeDWorld. These take a little time to load. Patience is a virtue.
- STOP! - stops the current button action, useful for mistakes and to salve impatience.
- Reset - recovers from various problems, resets viewport to full screen, clears objects from scene. Lighting, shading and rendering styles unchanged.
Mouse buttons and control and shift keys can be used to make button selections as indicated by the pop-up buttons. Outside the menu, mouse clicks cause a new image to be computed. A left click changes the x-y position of the eyepoint (click at middle bottom of screen for default view) and a right click changes its height. A middle click will move the light source around in the same manner as a left click moves the eyepoint. The available range of values gives a space of about -20 to +20 units in all three dimensions.
If an animation is being played back, the x position is used to control the frame rate from approximately -30 fps at the left of the screen to approximately +30fps at the right.
2. Major Interfaces and Example Programs
Examples
- ThreeDTest.cm - Contains procedure call scripts which may be stuffed to the interpreter for richer exercise of the available functions. The command file and the code for the demonstration program provide examples to follow in assembling further applications of the package.
- ThreeDDemoImpl - Provides the functions described above under section 1. Routines may be investigated by browsing the code.
- ShadingProcs - Gives examples of texturing techniques which may be applied to a scan-converted surface. Its probably best to discuss this with an implementer before trying to use it.
Interfaces
- ThreeDBasics - Defines the basic structures used to define shapes and three dimensional contexts within which shapes live.
- SceneUtilities - Provides basic routines for setting up three dimensional contexts, defining and altering environments, and manipulating shapes and vertices.
- SurfaceRender - Procedures for sorting, shading, and displaying shapes.
- ShapeUtilities - Procedures for reading, writing shapes, transforming, clipping, etc. and registering new types of shapes.
- RenderWithImager - Procedures for calling the imager to do scan conversion
- RenderWithPixels - Procedures for doing more elaborate scan conversion, antialiasing tiler
- ColorDisplayRender - Procedures for controlling interaction with viewers, color display and procedures in RenderWithPixels
- MappedAndSolidTexture - Procedures implementing mapped textures, bump mapping, standard space-filling textures and controlling multiple textures
- ImageTwiddle - Procedures for fiddling with color maps and doing image dithering, scaling, etc.
- DistributedRender - Procedures for distributing image calculations over many Dorados
- AISAnimation - Contains procedures for reading and writing AIS files from three dimensional contexts and for controlling playback of images cached from AIS files. Additional routines aid in naming sequences of files for use in animation
- Animation3D - Simple routines for generating a sequence of positions from descriptors for lines and tilted orbits and expanding point sequences to cubic curves.
- EdgeBlt - Basic procedures for walking across rasters and changing pixel values
- ScanConvert - Scan conversion routines for lines and convex polygons.
- ShapeTwiddle - Procedures for cleaning up and editing shape files. New shapes may be written out after modifications are made.
- StandardPatches - Procedures for operating on Bezier patches and expanded polygons. Bezier shapes may be expanded to polygons or sudivided into larger numbers of patches. Polygons may be expanded into curved surfaces approximated by many smaller polygons. Display routines show Bezier patches by rendering curved patch boundaries for line drawings and by subdividing to effectively straight boundaries for shaded renderings. Similar procedures for other patch formulations are planned.
- ThreeDViewer - Procedures for building and controlling viewers with pop-up buttons
3. Shape and Image Description Formats
Patches (Surface types $ConvexPolygon, $Lines, $Bezier)
A surface compose of patches may be either closed (cannot be seen from the inside) or open. Where there is a notion of "outside" (as in a "closed" surface) the vertices of a patch are assumed to be taken in clockwise order as seen from the outside.
Shapes are described using a file format as follows:
- Keywords are used to indicate formatting. Currently used keywords are "SurfaceType", "Vertices", "Polygons", "Patches". Keywords are followed by a "~".
- The keyword "SurfaceType" is followed by a rope containing surface descriptors. Current descriptors include: "ConvexPolygon", Bezier", "InsideVisible", etc.
- The keyword "Vertices" is followed by a series of descriptors of the lines containing vertex data. Descriptors are colon-separated pairs including a field name and a type. Understood field names include "index", "xyzCoords", "normalVec", "rgbColor", "textureCoords", "transmittance". Understood types include: "integer", "real", "triple". Vertex coordinates are assumed in a right handed space (x, y, z ~ longitude, latitude, altitude in the Eastern hemisphere).
- The keywords "Polygons" or "Patches" are followed by a series of descriptors of the lines containing surface data. Descriptors are colon-separated pairs including a field name and a type. Understood field names include "index", "normalVec", "rgbColor", "transmittance". Understood types include: "integer", "real", "triple" and, "nats". "Nats" indicates a field containing a sequence of NAT, used to describe a surface element by enumerating its vertices. Other fields names (but not other types) may be added. Nonstandard names will cause the corresponding data to be stored on the shape's property list, where it may later be used.
Comments may be included as whole lines or at the end of lines (and possibly elsewhere).
The following describes a box with the top removed:
OpenBox.shape
SurfaceType ~ ConvexPolygon, InsideVisible
Vertices ~ xyzCoords: triple      -- 8 vertices, 5 polygons

1.0  -1.0 -1.0
-1.0 -1.0 -1.0
-1.0  1.0 -1.0
1.0   1.0 -1.0
 1.0  -1.0  1.0
-1.0 -1.0  1.0
-1.0  1.0  1.0
1.0   1.0  1.0

Polygons ~ vertices: nats

 3 2 1 0     -- bottom
 1 5 4 0     -- front (as seen from negative y-axis)
 1 2 6 5     -- left side
 3 0 4 7     -- right side
 3 7 6 2     -- back