ThreeDWorldDoc.tioga
Crow, May 30, 1986 4:19:16 pm PDT
ThreeDWorldDoc
CEDAR 6.0 — FOR INTERNAL XEROX USE ONLY
ThreeDWorld
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 Dorado color displays. 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
1. Demo Package
General Features
A demonstration package is included in the release. It is started up by the command ThreeDWorld. The demo starts up the color display and displays a viewer with an array of buttons for exercising various features of the system. Two built-in scenes are provided which can be viewed from various positions and shaded in different manners. A sequence of images is provided for real-time playback.
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 "NewScene" switches between them.
The first scene demonstrates the capability for quickly rendering simple scenes. The icosahedron and soccer ball have individually colored polygons when displayed with facets. They use global colors, however 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. Subdivision is terminated when the resulting patches are supposedly indistinguishable from approximating polygons. The approximating polygons are then rendered.
Button Semantics
The menu buttons have the following meanings:
- Help - provides a miniscule amount of helpful information (suggestions for additional messages are welcome)
- NewScene - Selects one of the predefined scenes, whichever was least recently used.
- Lines - displays the current scene as a line drawing.
- Facets - displays the current scene with each polygon shaded in a constant color.
- Smooth - displays the current scene with curved surfaces simulated.
- Shiny - displays the current scene with curved surfaces simulated and highlights shown.
- Orbit - generates a sequence of double-buffered images on an elliptical path about the scene starting at the eyepoint used for the most recently generated image. It continues making images forever, not advisable for rendering modes which take more than a few seconds per frame.
- STOP - stops the current button action, useful for mistakes and to salve impatience.
- Movie - reads a sequence of AIS files from [Cyan] and displays them at a rate controlled by left mouse clicks, using large amounts of VM in the process.
- Gallery - reads a set of AIS files defined by [Cyan]<AIS>Crow>PrettyPictures.txt and displays them in response to mouse clicks, using even larger amounts of VM in the process.
- Jaggy - turns off anti-aliasing, jaggy images.
- NoJaggy - turns on anti-aliasing, no jaggies, best used with a 24-bit display. Use with the 8-bit display will force use of greyscale imagery.
- Reset - recovers from various problems, resets viewport to full screen, clears objects from scene, lighting unchanged.
All of the mouse buttons have the same effect for the menu buttons. Outside the menu buttons a left click returns an x-y position and a right click returns a height. A middle click will move the light source around in the same manner as a left click moves the eyepoint.
If a Movie action is running 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.
If the Gallery is being viewed, a left click moves ahead to the next picture, a right click moves back to the previous one. No response indicates no more pictures available in the requested direction. Pictures are cached, so that they can be run through quickly, once they are all read in.
Otherwise a left or right click causes the last scene to be rendered again seen from a new vantage point as indicated by the mouse position. The available range of values gives a space of about -20 to +20 units in all three dimensions.
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
- ThreeDMisc - A grab bag of useful procedures. Procedures are provided for manipulating the color map, writing text to the display, generating patterns to use as texture, controlling the lighting, assigning colors to objects, generating frames and controlling simple animations.
- ThreeDScenes - Defines the basic structures used to define shapes and three dimensional contexts within which shapes live. Provides basic routines for setting up three dimensional contexts, defining and altering environments, and manipulating shapes and vertices.
- ThreeDPolygons - Definitions for structures defining polygonal shapes. Procedures for reading, sorting, shading, and displaying polygonal shapes.
- Tilers - Control of scan conversion routines and code for the more elaborate tiler which handles anti-aliasing, texture, and transparent surfaces.
- 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. Expansions of point sequences to cubic curves is expected soon.
- TextureMaps - Procedures for mapping texture coordinates to regular arrays of polygons. Procedures for preparing and applying AIS files as texture.
- 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. Bezier shapes may be expanded to polygons or sudivided into larger numbers of patches. 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.
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 simplistic file format as follows (to be expanded shortly):
- Title - the first line is ignored by the code, use it for what you want.
- Number of Vertices - used to determine how many x-y-z triples to read.
- Number of polygons - used to determine how many polygon descriptions to read.
- Vertices - n triples of type REAL, each describing a vertex in three-space.
- Patches - m sets of numbers referring to the order of vertices (vertices are counted from 1).
The following describes a cube with one corner cut off (a surface of type "$ConvexPolygon") as used in the first scene from the demo program:
CutCube.txt     -- title
10 7      -- number of vertices, number of polygons
1.0 -1.0 -1.0     -- x, y, z for each vertex
-1.0 -1.0 -1.0
-1.0 -1.0 0.0
-0.0 -1.0 1.0
1.0 -1.0 1.0
-1.0  0.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
5 1 2 3 4 5  -- number of vertices, pointer for each vertex
4 8 1 5 9
4 7 8 9 10
5 2 7 10 6 3
4 8 7 2 1
5 5 4 6 10 9
3 3 6 4