This is a multi-part message in MIME format.
--------------451B3B3D5594CBDBB5CD8703
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello,
Just for your information - and, as usual, a feedback request - anyone
out there read it?
--
Still alive and smile stays on,
Vadim Tkachenko <VadimT@4CS.Com>
--
UNIX _is_ user friendly, he's just very picky about who his friends are
--------------451B3B3D5594CBDBB5CD8703
Content-Type: text/plain; charset=us-ascii; name="playgod.toc"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="playgod.toc"
Title: Playing God, Creating Virtual Worlds
Author: Bernie Roehl
Publisher: Waite Group Press
ISBN: 1-878739-62-X
Audience: Generally geared towards C programmers, but accessible to others
Misc: 373 pages, soft cover, $26.95
Synopsis: This book presents a number of tools and techniques for creating
virtual worlds. The basic concepts and terminology of virtual reality are
presented, with an emphasis on some of the technical limitations imposed
by current technology. A general approach to world-building is given, along
with a number of useful guidelines.
The design of virtual objects is explored, and several approaches to
their creation are presented. The use of CAD packages, object generators,
fractals, L-Systems and scripting languages are discussed, all with
practical examples. A chapter is devoted to the layout of objects in
the virtual world.
Examples of programming simple object behaviour are given, and a variety
of different ways of representing behaviour are explored. Finally, a number
of simple virtual worlds are studied, with a chapter devoted to each one.
The book includes several useful pieces of software, including NorthCAD-3D,
VRVIEW, and a number of utilities for creating objects to populate your
virtual worlds. Many of the utilities come with full C source code.
===========================================================================
Table of Contents:
Playing God: Creating Virtual Worlds
Chapter 1: Virtual Reality. . . . . . . . . . . . . . . .1
Chapter 2: What Makes a World Interesting?. . . . . . . 17
Chapter 3: World-Building from the Top Down . . . . . . 35
Chapter 4: World-Building from the Bottom Up. . . . . . 51
Chapter 5: Using VRVIEW . . . . . . . . . . . . . . . . 81
Chapter 6: Creating Objects . . . . . . . . . . . . . . 89
Chapter 7: Using NorthCAD-3D. . . . . . . . . . . . . .157
Chapter 8: Assembling Worlds. . . . . . . . . . . . . .179
Chapter 9: Programming Virtual Worlds . . . . . . . . .211
Chapter 10: The Maze . . . . . . . . . . . . . . . . . .253
Chapter 11: Tag. . . . . . . . . . . . . . . . . . . . .269
Chapter 12: The Museum . . . . . . . . . . . . . . . . .283
Chapter 13: The Haunted Mansion. . . . . . . . . . . . .297
Chapter 14: World Trade Center . . . . . . . . . . . . .309
Afterword: The Future . . . . . . . . . . . . . . . . .323
Appendix A: WLD File Syntax. . . . . . . . . . . . . . .327
Appendix B: CFG File Syntax. . . . . . . . . . . . . . .331
Appendix C: VRLIB Library. . . . . . . . . . . . . . . .333
Appendix D: Format Conversion. . . . . . . . . . . . . .347
Appendix E: NorthCAD-3D Quick Reference. . . . . . . . .350
Appendix F: State Machine Language . . . . . . . . . . .354
Appendix G: Bob Syntax . . . . . . . . . . . . . . . . .356
Appendix H: Stereoscopic Viewing . . . . . . . . . . . .358
Index. . . . . . . . . . . . . . . . . . . .362
Preface xxii
Chapter 1: Virtual Reality . . . . . . . . . . . . . . . . . . .1
History . . . . . . . . . . . . . . . . . . . . . . .2
Technology. . . . . . . . . . . . . . . . . . . . . .3
The Computer . . . . . . . . . . . . . . . . . . .3
Output Devices . . . . . . . . . . . . . . . . . .4
~Window on the World~ Displays. . . . . . . . .4
Projection Systems. . . . . . . . . . . . . . .5
Head-Mounted Displays . . . . . . . . . . . . .5
Sound . . . . . . . . . . . . . . . . . . . . .6
Haptic Feedback . . . . . . . . . . . . . . . .7
Input Devices. . . . . . . . . . . . . . . . . . .8
Bats. . . . . . . . . . . . . . . . . . . . . .8
Forceballs. . . . . . . . . . . . . . . . . . .9
Wands . . . . . . . . . . . . . . . . . . . . .9
Gloves. . . . . . . . . . . . . . . . . . . . .9
Head Trackers . . . . . . . . . . . . . . . . .9
Data Suits. . . . . . . . . . . . . . . . . . 10
2D Devices. . . . . . . . . . . . . . . . . . 10
Speech Input. . . . . . . . . . . . . . . . . 10
Tracking . . . . . . . . . . . . . . . . . . . . 10
Mechanical Tracking . . . . . . . . . . . . . 10
Ultrasonic Tracking . . . . . . . . . . . . . 11
Magnetic Tracking . . . . . . . . . . . . . . 11
Optical Tracking. . . . . . . . . . . . . . . 12
Other Tracking Techniques . . . . . . . . . . 12
Networking . . . . . . . . . . . . . . . . . . . 12
What Is a ~Protocol~? . . . . . . . . . . . . 12
Platform Independence . . . . . . . . . . . . 13
Types of Networks . . . . . . . . . . . . . . 13
A Question of Bandwidth . . . . . . . . . . . 13
What Must Be Sent . . . . . . . . . . . . . . 13
Lag . . . . . . . . . . . . . . . . . . . . . 15
New Networking Technologies . . . . . . . . . 15
Onward... . . . . . . . . . . . . . . . . . . . . . 16
Chapter 2: What Makes a World Interesting? . . . . . . . . . . 17
Realism . . . . . . . . . . . . . . . . . . . . . . 18
Visual Reality . . . . . . . . . . . . . . . . . 18
Resolution. . . . . . . . . . . . . . . . . . 18
Detail. . . . . . . . . . . . . . . . . . . . 19
Multiple Levels of Detail . . . . . . . . . . 20
Curves and Tessellation . . . . . . . . . . . 20
Texture Mapping . . . . . . . . . . . . . . . 21
Color . . . . . . . . . . . . . . . . . . . . 22
Lights and Shadows. . . . . . . . . . . . . . 24
General Architectural Design. . . . . . . . . 25
Acoustical Reality . . . . . . . . . . . . . . . 25
Music . . . . . . . . . . . . . . . . . . . . 26
Sound Effects . . . . . . . . . . . . . . . . 26
Speech. . . . . . . . . . . . . . . . . . . . 27
Haptic Realism. . . . . . . . . . . . . . . . 27
Animation . . . . . . . . . . . . . . . . . . . . . 27
Repetitive Motion. . . . . . . . . . . . . . . . 27
Newtonian Motion . . . . . . . . . . . . . . . . 27
Algorithmic Motion . . . . . . . . . . . . . . . 28
~Intelligent~ Motion . . . . . . . . . . . . . . 28
Interactivity and Responsiveness. . . . . . . . . . 30
Things to Do. . . . . . . . . . . . . . . . . . . . 31
Puzzles to Solve . . . . . . . . . . . . . . . . 31
Skills to Acquire. . . . . . . . . . . . . . . . 31
Places to Go . . . . . . . . . . . . . . . . . . 32
People to Meet . . . . . . . . . . . . . . . . . 32
Taking Risks . . . . . . . . . . . . . . . . . . 32
Making Discoveries . . . . . . . . . . . . . . . 33
Power. . . . . . . . . . . . . . . . . . . . . . 33
Combinations . . . . . . . . . . . . . . . . . . 34
Conclusions . . . . . . . . . . . . . . . . . . . . 34
Chapter 3: World-Building from the Top Down. . . . . . . . . . 35
Questions to Ask. . . . . . . . . . . . . . . . . . 35
Who Will Use the World?. . . . . . . . . . . . . 35
What Will They Do in the World?. . . . . . . . . 36
How Many Different Locations Are Needed? . . . . 36
Can the Participant Change the World?. . . . . . 36
Are Multiple Participants Allowed? . . . . . . . 37
How Realistic Must the World Be? . . . . . . . . 37
Do Any Tasks Require Assistance? . . . . . . . . 37
What Kinds of Objects Are Needed?. . . . . . . . 38
What Is the Flavor or Atmosphere of the World? . 38
What Is a ~World~ Anyway? . . . . . . . . . . . . . 39
Objects. . . . . . . . . . . . . . . . . . . . . 39
Appearance. . . . . . . . . . . . . . . . . . 39
Location and Orientation. . . . . . . . . . . 40
Attachment to Other Objects . . . . . . . . . 40
Emitted Sounds. . . . . . . . . . . . . . . . 40
Behavior . . . . . . . . . . . . . . . . . . . . 41
Intelligent Behavior. . . . . . . . . . . . . 42
The Mechanical Layer of Behavior. . . . . . . 42
The Activity Layer of Behavior. . . . . . . . 42
The Personality Layer of Behavior . . . . . . 42
Other Attributes . . . . . . . . . . . . . . . . 43
The World Itself. . . . . . . . . . . . . . . . . . 44
Layout . . . . . . . . . . . . . . . . . . . . . 44
Lighting . . . . . . . . . . . . . . . . . . . . 44
Ambient Sounds . . . . . . . . . . . . . . . . . 45
Forces and Other Properties of Space . . . . . . 45
User Interface. . . . . . . . . . . . . . . . . . . 46
Input Devices. . . . . . . . . . . . . . . . . . 46
Functions. . . . . . . . . . . . . . . . . . . . 46
Window-on-the-World, Mouse Only. . . . . . . . . 47
Window-on-the-World, Mouse and Joystick (2D or 3D)48
Immersive, HMD System with Wand. . . . . . . . . 48
Immersive, HMD System with Glove . . . . . . . . 48
General Principles . . . . . . . . . . . . . . . 49
Testing . . . . . . . . . . . . . . . . . . . . . . 49
Summary . . . . . . . . . . . . . . . . . . . . . . 50
Chapter 4: World-Building from the Bottom Up . . . . . . . . . 51
Coordinate Systems. . . . . . . . . . . . . . . . . 51
Left-Handed or Right-Handed? . . . . . . . . . . 52
Translation. . . . . . . . . . . . . . . . . . . 54
Scaling. . . . . . . . . . . . . . . . . . . . . 54
Rotation . . . . . . . . . . . . . . . . . . . . 55
Different Coordinate Systems . . . . . . . . . . 55
The Object Coordinate System. . . . . . . . . 55
The World Coordinate System . . . . . . . . . 57
The View Coordinate System. . . . . . . . . . 57
Objects . . . . . . . . . . . . . . . . . . . . . . 58
Vertices . . . . . . . . . . . . . . . . . . . . 58
Polygons . . . . . . . . . . . . . . . . . . . . 59
Planar. . . . . . . . . . . . . . . . . . . . 59
Convex. . . . . . . . . . . . . . . . . . . . 59
Number of Sides . . . . . . . . . . . . . . . 61
Holes . . . . . . . . . . . . . . . . . . . . 61
Detail Polys. . . . . . . . . . . . . . . . . 62
Double-Sided Polys. . . . . . . . . . . . . . 62
Vertex Ordering . . . . . . . . . . . . . . . 63
Where Are the Vertices Stored?. . . . . . . . 64
Designing Objects for Portability . . . . . . 64
Surface Specifiers. . . . . . . . . . . . . . . . . 65
Color Resolution . . . . . . . . . . . . . . . . 65
24-Bit Color. . . . . . . . . . . . . . . . . 65
15- or 16-Bit Color . . . . . . . . . . . . . 66
Paletted Systems. . . . . . . . . . . . . . . 66
Color Maps. . . . . . . . . . . . . . . . . . 66
Surface Types. . . . . . . . . . . . . . . . . . 66
Flat Shading. . . . . . . . . . . . . . . . . 66
Gouraud Shading . . . . . . . . . . . . . . . 66
Phong Shading . . . . . . . . . . . . . . . . 67
Transparency. . . . . . . . . . . . . . . . . 67
Special Effects . . . . . . . . . . . . . . . 67
Texture Mapping . . . . . . . . . . . . . . . 68
Lighting. . . . . . . . . . . . . . . . . . . . . . 69
Ambient Lighting . . . . . . . . . . . . . . . . 69
Directional and Point Source Lighting. . . . . . 69
Cameras . . . . . . . . . . . . . . . . . . . . . . 69
Software Organization . . . . . . . . . . . . . . . 71
The Rendering Pipeline . . . . . . . . . . . . . 72
Step 1. Object Culling. . . . . . . . . . . . 72
Step 2. Transformation. . . . . . . . . . . . 73
Step 3. Backface Removal. . . . . . . . . . . 73
Step 4. Lighting. . . . . . . . . . . . . . . 73
Step 5. z-Clipping. . . . . . . . . . . . . . 73
Step 6. Projection and Screen Scaling . . . . 74
Step 7. xy-Clipping . . . . . . . . . . . . . 75
Step 8. Scan Conversion . . . . . . . . . . . 76
Step 9. Page Flipping . . . . . . . . . . . . 76
Step 10. Hidden Surface Removal . . . . . . . 76
A Note on Optimization. . . . . . . . . . . . 76
Hidden Surface Removal . . . . . . . . . . . . . 76
Depth-Sorting Errors. . . . . . . . . . . . . 77
Sound. . . . . . . . . . . . . . . . . . . . . . 78
Digitized Audio . . . . . . . . . . . . . . . 78
FM Synthesis. . . . . . . . . . . . . . . . . 78
Wavetable Synthesis . . . . . . . . . . . . . 79
Summary . . . . . . . . . . . . . . . . . . . . . . 79
Chapter 5: Using VRVIEW. . . . . . . . . . . . . . . . . . . . 81
How to Start VRVIEW . . . . . . . . . . . . . . . . 81
The Position Display . . . . . . . . . . . . . . 82
The Compass Display. . . . . . . . . . . . . . . 82
The Frames/Second Display. . . . . . . . . . . . 82
Moving Around . . . . . . . . . . . . . . . . . . . 82
Moving Using the Keyboard. . . . . . . . . . . . 83
Moving Using the Joystick. . . . . . . . . . . . 84
Moving Using the Mouse . . . . . . . . . . . . . 84
Multiple Virtual Cameras . . . . . . . . . . . . 84
The VRVIEW Menu System. . . . . . . . . . . . . . . 84
Object Selection . . . . . . . . . . . . . . . . 84
The Main Menu. . . . . . . . . . . . . . . . . . 85
The View Menu. . . . . . . . . . . . . . . . . . 85
The Paint Menu . . . . . . . . . . . . . . . . . 86
The Display Menu . . . . . . . . . . . . . . . . 86
The Object Menu. . . . . . . . . . . . . . . . . 87
The Figure Menu. . . . . . . . . . . . . . . . . 87
The Mouse Menu . . . . . . . . . . . . . . . . . 88
The Stereo Menu. . . . . . . . . . . . . . . . . 88
Summary . . . . . . . . . . . . . . . . . . . . . . 88
Chapter 6: Creating Objects. . . . . . . . . . . . . . . . . . 89
Object Formats. . . . . . . . . . . . . . . . . . . 89
DXF. . . . . . . . . . . . . . . . . . . . . . . 90
3D Studio. . . . . . . . . . . . . . . . . . . . 90
RAW Format . . . . . . . . . . . . . . . . . . . 90
OFF. . . . . . . . . . . . . . . . . . . . . . . 91
NFF. . . . . . . . . . . . . . . . . . . . . . . 91
PLG. . . . . . . . . . . . . . . . . . . . . . . 92
PLG File Format . . . . . . . . . . . . . . . . . . 92
Vertices . . . . . . . . . . . . . . . . . . . . 92
Polygons . . . . . . . . . . . . . . . . . . . . 93
Surface Speci_ers. . . . . . . . . . . . . . . . 94
Simple Colors . . . . . . . . . . . . . . . . 95
Flat-Shaded Colors. . . . . . . . . . . . . . 95
Pseudo-Metallic Colors. . . . . . . . . . . . 95
Pseudo-Transparent Colors . . . . . . . . . . 96
Creating PLG Files by Hand. . . . . . . . . . . . . 96
Vertices and Dimensions. . . . . . . . . . . . . 96
Polygons . . . . . . . . . . . . . . . . . . . . 97
A More Complex Example: Creating a Cone. . . . . 97
Algorithmically Generated Objects . . . . . . . . .100
An Algorithmically Generated Cone. . . . . . . .100
An Algorithmic Chessboard. . . . . . . . . . . .104
Using Triangles for Flexibility. . . . . . . . .106
Getting More Adventurous: Modifying the Chessboard107
Making Mountains . . . . . . . . . . . . . . . .109
Star Light, Star Bright_ . . . . . . . . . . . .110
Improving Your Creations . . . . . . . . . . . .112
Another Object Generator: SOCCER . . . . . . . .113
Modifying Your Objects with PLGX . . . . . . . .113
Combining Objects with PLGMERGE. . . . . . . . .114
Fractals. . . . . . . . . . . . . . . . . . . . . .116
Making Mountains, Revisited. . . . . . . . . . .118
Step 1: Creating the Input File . . . . . . .118
Step 2: Running the FRGEN Command . . . . . .119
Step 3: Converting to PLG Format. . . . . . .120
Step 4: Cleaning Up and Viewing the PLG File.120
From Mountains to Plains . . . . . . . . . . . .121
Beyond the Mountains . . . . . . . . . . . . . .122
Inside FRGEN . . . . . . . . . . . . . . . . . .123
More Powerful Fractal Generators . . . . . . . .125
Lindenmayer Systems . . . . . . . . . . . . . . . .125
Trained Turtles. . . . . . . . . . . . . . . . .126
L-Systems at Work: Building a Walled City. . . .127
A Complex Plant. . . . . . . . . . . . . . . . .129
The Fibonacci Bush . . . . . . . . . . . . . . .130
A Look Inside the Generator. . . . . . . . . . .130
A Look Inside the Interpreter. . . . . . . . . .131
Roll Your Own. . . . . . . . . . . . . . . . . .133
LPARSER. . . . . . . . . . . . . . . . . . . . .134
Scripting Languages . . . . . . . . . . . . . . . .135
OGRE . . . . . . . . . . . . . . . . . . . . . .135
Object Creation and Deletion . . . . . . . . . .137
File Operations. . . . . . . . . . . . . . . . .137
Control Commands . . . . . . . . . . . . . . . .138
Object Primitives. . . . . . . . . . . . . . . .138
Transformations. . . . . . . . . . . . . . . . .142
Modifying and Combining Objects. . . . . . . . .142
More About Surfaces of Revolution. . . . . . . .142
Some More Examples in OGRE . . . . . . . . . . .142
A House . . . . . . . . . . . . . . . . . . .143
A Fir Tree. . . . . . . . . . . . . . . . . .144
A Chess Piece . . . . . . . . . . . . . . . .145
A Luxo Lamp . . . . . . . . . . . . . . . . .146
An Airplane . . . . . . . . . . . . . . . . .147
A Creepy-Crawly . . . . . . . . . . . . . . .148
A ~Nightmarish~ Creature. . . . . . . . . . .149
Combining Techniques: Algorithmic Script Generation
for OGRE. . . . . . . . . . . . . . . . . . .150
A Pleated Tube. . . . . . . . . . . . . . . .150
A Gnarled Walking Stick . . . . . . . . . . .151
CAD Programs. . . . . . . . . . . . . . . . . . . .153
3D Digitizing . . . . . . . . . . . . . . . . . . .153
Laser Scanners . . . . . . . . . . . . . . . . .153
3D Position Sensors. . . . . . . . . . . . . . .153
Photographic Systems . . . . . . . . . . . . . .154
Limitations of 3D Digitizing . . . . . . . . . .154
Choosing Your Methods . . . . . . . . . . . . . . .154
Summary . . . . . . . . . . . . . . . . . . . . . .155
Chapter 7: Using NorthCAD-3D . . . . . . . . . . . . . . . . .157
NorthCAD Concepts . . . . . . . . . . . . . . . . .157
Entities . . . . . . . . . . . . . . . . . . . .158
Revolutions. . . . . . . . . . . . . . . . . . .159
Extrusions . . . . . . . . . . . . . . . . . . .160
Using NorthCAD-3D . . . . . . . . . . . . . . . . .160
Screen Layout. . . . . . . . . . . . . . . . . .161
Setting Some Options . . . . . . . . . . . . . .162
Setting the Working Object and Pen Color . . . .162
The Coordinate System and Viewing Directions . .163
The Information Display. . . . . . . . . . . . .164
Drawing Planes . . . . . . . . . . . . . . . . .164
Your First NorthCAD-3D Drawing . . . . . . . . .165
Adding Regular Polygons. . . . . . . . . . . . .166
Drawing Arcs . . . . . . . . . . . . . . . . . .166
Moving Around in Your Drawing. . . . . . . . . .167
Using Files. . . . . . . . . . . . . . . . . . .168
Saving Your Con_guration . . . . . . . . . . . .168
Into the Third Dimension . . . . . . . . . . . .168
Fixing the Cube. . . . . . . . . . . . . . . . .169
Creating a Building from the Ground Up . . . . .170
More About Extrusions. . . . . . . . . . . . . .172
You Say You Want a Revolution... . . . . . . . .172
A Glass of Wine. . . . . . . . . . . . . . . . .174
A Heavenly Body. . . . . . . . . . . . . . . . .174
A Lighthouse . . . . . . . . . . . . . . . . . .174
Putting It All Together: A Grove of Trees. . . .175
Summary . . . . . . . . . . . . . . . . . . . . . .176
Chapter 8: Assembling Worlds . . . . . . . . . . . . . . . . .179
Loading, Placing, and Modifying Objects . . . . . .179
Scaling. . . . . . . . . . . . . . . . . . . . .179
Rotation . . . . . . . . . . . . . . . . . . . .180
Translation. . . . . . . . . . . . . . . . . . .181
Surface Mapping. . . . . . . . . . . . . . . . .181
WLD Files. . . . . . . . . . . . . . . . . . . .181
Names for Objects . . . . . . . . . . . . . .181
Applying Scaling, Rotation, and Translation .181
Depth-Sorting Type. . . . . . . . . . . . . .182
Surface Map . . . . . . . . . . . . . . . . .182
Parent. . . . . . . . . . . . . . . . . . . .182
The Complete Syntax of Object Statements . . . .182
Using a Default Surface Map. . . . . . . . . . .183
Positioning and Rotating Objects . . . . . . . .183
Changing the Depth-Sorting Type. . . . . . . . .183
Attaching and Detaching. . . . . . . . . . . . .183
Two Ways to Do the Same Thing. . . . . . . . . .184
More About Surface Maps. . . . . . . . . . . . .184
The Palette. . . . . . . . . . . . . . . . . . .185
Single-Polygon Objects . . . . . . . . . . . . .185
Multiple Representations . . . . . . . . . . . .185
The Addrep Statement. . . . . . . . . . . . .185
Multiple-Resolution PLG Files . . . . . . . .186
Segmented Figures . . . . . . . . . . . . . . . . .186
The Figure Statement . . . . . . . . . . . . . .186
FIG File Syntax. . . . . . . . . . . . . . . . .187
Lighting. . . . . . . . . . . . . . . . . . . . . .190
Ambient Light. . . . . . . . . . . . . . . . . .190
Directional Light Sources. . . . . . . . . . . .190
Cameras . . . . . . . . . . . . . . . . . . . . . .191
Miscellaneous Statements. . . . . . . . . . . . . .192
The Options Statement. . . . . . . . . . . . . .192
The Screenclear Statement. . . . . . . . . . . .193
The Screencolor Statement. . . . . . . . . . . .193
The Flymode Statement. . . . . . . . . . . . . .193
The Stepsize and Anglestep Statements. . . . . .193
The Worldscale Statement . . . . . . . . . . . .194
The Attachview Statement . . . . . . . . . . . .194
The Include Statement. . . . . . . . . . . . . .194
The Loadpath Statement . . . . . . . . . . . . .194
The Title Statement. . . . . . . . . . . . . . .195
The Window Statement . . . . . . . . . . . . . .195
Statements Related to Splits . . . . . . . . . .195
Other Statements . . . . . . . . . . . . . . . .195
Splitting Planes. . . . . . . . . . . . . . . . . .196
De_ning Planes . . . . . . . . . . . . . . . . .196
The Split Statement . . . . . . . . . . . . .196
The Splitpts Statement. . . . . . . . . . . .197
The Splitting Tree. . . . . . . . . . . . . .197
Advantages and Disadvantages. . . . . . . . .199
Creating a World. . . . . . . . . . . . . . . . . .199
World-Building by Hand. . . . . . . . . . . . . . .199
The Houses . . . . . . . . . . . . . . . . . . .199
The Trees. . . . . . . . . . . . . . . . . . . .200
The Streets. . . . . . . . . . . . . . . . . . .201
Putting It All Together. . . . . . . . . . . . .201
Algorithmic World-Building. . . . . . . . . . . . .203
A Virtual City . . . . . . . . . . . . . . . . .203
Using NorthCAD-3D to Build a World. . . . . . . . .206
The Island Itself. . . . . . . . . . . . . . . .206
Adding the Lighthouse. . . . . . . . . . . . . .207
A Small Boat . . . . . . . . . . . . . . . . . .207
Conversion . . . . . . . . . . . . . . . . . . .207
The Final Product. . . . . . . . . . . . . . . .209
Limitations of NorthCAD for Creating Worlds. . .209
Summary . . . . . . . . . . . . . . . . . . . . . .210
Chapter 9: Programming Virtual Worlds. . . . . . . . . . . . .211
A Brief Survey. . . . . . . . . . . . . . . . . . .212
Superscape . . . . . . . . . . . . . . . . . . .212
Virtual Reality Studio . . . . . . . . . . . . .212
VREAM. . . . . . . . . . . . . . . . . . . . . .212
dVise. . . . . . . . . . . . . . . . . . . . . .213
Sense8 WorldToolKit. . . . . . . . . . . . . . .213
Autodesk Cyberspace Developers Kit . . . . . . .213
VRVIEW . . . . . . . . . . . . . . . . . . . . .213
What ~Behavior~ Really Means. . . . . . . . . . . .214
Modifying the World . . . . . . . . . . . . . . . .214
Objects. . . . . . . . . . . . . . . . . . . . .214
Create and Destroy. . . . . . . . . . . . . .214
Load and Save Object Geometry . . . . . . . .215
Altering Object Visibility and Level-of-Detail215
Obtaining Information About an Object . . . .215
Object Position and Orientation . . . . . . .215
Object Attachment . . . . . . . . . . . . . .215
Light Sources. . . . . . . . . . . . . . . . . .215
Virtual Cameras. . . . . . . . . . . . . . . . .216
Sound Sources. . . . . . . . . . . . . . . . . .216
The Virtual Environment. . . . . . . . . . . . .216
Input Devices. . . . . . . . . . . . . . . . . .216
Display Devices. . . . . . . . . . . . . . . . .217
Other Functions. . . . . . . . . . . . . . . . .217
VR System Structure . . . . . . . . . . . . . . . .217
State Machine Animation . . . . . . . . . . . . . .218
Animations, States, and Statements . . . . . . .218
do and if. . . . . . . . . . . . . . . . . . . .219
Targets, Commands, and Assignment Instructions .220
Changing State . . . . . . . . . . . . . . . . .220
Conditional Assignments. . . . . . . . . . . . .221
The State Animation Commands . . . . . . . . . .221
A Simple Example: The Wall Clock . . . . . . . .222
A More Complex Example: Suburban Transit . . . .224
BOB . . . . . . . . . . . . . . . . . . . . . . . .226
BOB Syntax . . . . . . . . . . . . . . . . . . .226
Functions . . . . . . . . . . . . . . . . . .227
Classes . . . . . . . . . . . . . . . . . . .227
Flow Control . . . . . . . . . . . . . . . . . .229
Global Variables . . . . . . . . . . . . . . . .229
Expressions. . . . . . . . . . . . . . . . . . .229
BOB Built-in Variables and Functions . . . . . .230
A Short BOB Program. . . . . . . . . . . . . . .231
Interfacing Between BOB and VRVIEW . . . . . . .232
After Initialization. . . . . . . . . . . . .233
At Simulation Time. . . . . . . . . . . . . .233
After Rendering . . . . . . . . . . . . . . .233
At Shutdown Time. . . . . . . . . . . . . . .233
When a Key Is Pressed . . . . . . . . . . . .233
BOB Development with VRVIEW . . . . . . . . . . . .233
An Example: The Wall Clock, Revisited. . . . . .234
A More Complex Example: A Bunch of Things. . . .235
Programming Behavior Using C and C++. . . . . . . .240
Program Structure. . . . . . . . . . . . . . . .241
How the vr_system Functions Work . . . . . . . .242
vr_systemStartup(). . . . . . . . . . . . . .242
vr_systemCommandLine(). . . . . . . . . . . .242
vr_systemRun(). . . . . . . . . . . . . . . .243
Default Routines. . . . . . . . . . . . . . .243
Tasks. . . . . . . . . . . . . . . . . . . . . .244
A Typical Example in C . . . . . . . . . . . . .244
Choosing a Language . . . . . . . . . . . . . . . .251
Summary . . . . . . . . . . . . . . . . . . . . . .252
Chapter 10: The Maze. . . . . . . . . . . . . . . . . . . . . .253
Planning Ahead. . . . . . . . . . . . . . . . . . .253
Creating Geometry . . . . . . . . . . . . . . . . .254
Level 1. . . . . . . . . . . . . . . . . . . . .254
Level 2. . . . . . . . . . . . . . . . . . . . .255
Taking Apart and Putting Together. . . . . . . .256
Collision Detection . . . . . . . . . . . . . . . .257
Extracting the Data. . . . . . . . . . . . . . .257
The Algorithm. . . . . . . . . . . . . . . . . .260
The Ramp, Stairs, and Elevator . . . . . . . . .262
Outside or On the Stairs. . . . . . . . . . .263
First Floor and the Ramp. . . . . . . . . . .264
Second Floor and Elevator . . . . . . . . . .264
The Roof. . . . . . . . . . . . . . . . . . .264
Adjusting Height Using the Ramp and the Elevator265
The Elevator . . . . . . . . . . . . . . . . . .265
Dressing the Set. . . . . . . . . . . . . . . . . .268
Summary . . . . . . . . . . . . . . . . . . . . . .268
Chapter 11: Tag . . . . . . . . . . . . . . . . . . . . . . . .269
The Game of Tag . . . . . . . . . . . . . . . . . .269
The Playing Field . . . . . . . . . . . . . . . . .270
Generating the Vertices. . . . . . . . . . . . .271
Generating the Lines and Polygons. . . . . . . .271
The Runners . . . . . . . . . . . . . . . . . . . .272
The Obstacles . . . . . . . . . . . . . . . . . . .272
Choosing a Language . . . . . . . . . . . . . . . .273
Data Structures . . . . . . . . . . . . . . . . . .273
Obstacles. . . . . . . . . . . . . . . . . . . .273
Runners. . . . . . . . . . . . . . . . . . . . .275
Initialization and the Simulation Loop. . . . . . .276
The Algorithm . . . . . . . . . . . . . . . . . . .277
The Strategy When You~re ~It~. . . . . . . . . .277
The Strategy When You~re Not ~It~. . . . . . . .279
Collision Detection. . . . . . . . . . . . . . .280
A Final Complication . . . . . . . . . . . . . .281
Summary . . . . . . . . . . . . . . . . . . . . . .282
Chapter 12: The Museum. . . . . . . . . . . . . . . . . . . . .283
Overall Approach. . . . . . . . . . . . . . . . . .283
Creating the Museum Itself. . . . . . . . . . . . .284
The Program . . . . . . . . . . . . . . . . . . . .284
The Coil Spring . . . . . . . . . . . . . . . . . .286
The Coil . . . . . . . . . . . . . . . . . . . .286
The Base . . . . . . . . . . . . . . . . . . . .286
The Algorithm. . . . . . . . . . . . . . . . . .286
The Globe . . . . . . . . . . . . . . . . . . . . .287
The Globe and Its Pedestal . . . . . . . . . . .287
The Algorithm. . . . . . . . . . . . . . . . . .287
The Wheel of Chance . . . . . . . . . . . . . . . .288
The Wheel. . . . . . . . . . . . . . . . . . . .288
The Base . . . . . . . . . . . . . . . . . . . .288
The Algorithm. . . . . . . . . . . . . . . . . .289
The Traf_c Light. . . . . . . . . . . . . . . . . .289
The Lights . . . . . . . . . . . . . . . . . . .289
The Box and Stand. . . . . . . . . . . . . . . .290
The Algorithm. . . . . . . . . . . . . . . . . .290
The Marquee . . . . . . . . . . . . . . . . . . . .292
Creating the Marquee . . . . . . . . . . . . . .292
Color Table Animation. . . . . . . . . . . . . .293
Summary . . . . . . . . . . . . . . . . . . . . . .295
Chapter 13: The Haunted Mansion . . . . . . . . . . . . . . . .297
Building the House. . . . . . . . . . . . . . . . .297
The First Floor. . . . . . . . . . . . . . . . .297
The Ouija Board. . . . . . . . . . . . . . . . .298
The Second Floor . . . . . . . . . . . . . . . .299
The Pentagram. . . . . . . . . . . . . . . . . .299
Miscellaneous Objects. . . . . . . . . . . . . .300
Adding a Coat of Paint. . . . . . . . . . . . . . .300
Object Behavior . . . . . . . . . . . . . . . . . .301
Lightning. . . . . . . . . . . . . . . . . . . .302
Rain . . . . . . . . . . . . . . . . . . . . . .303
The Gate . . . . . . . . . . . . . . . . . . . .303
The Doors. . . . . . . . . . . . . . . . . . . .304
The Keys . . . . . . . . . . . . . . . . . . . .306
Summary . . . . . . . . . . . . . . . . . . . . . .307
Chapter 14: World Trade Center. . . . . . . . . . . . . . . . .309
The Scenario. . . . . . . . . . . . . . . . . . . .309
Object Creation . . . . . . . . . . . . . . . . . .310
The Fire Engine. . . . . . . . . . . . . . . . .310
The Axe and the Saw. . . . . . . . . . . . . . .311
The Moveable Light . . . . . . . . . . . . . . .311
The Cars . . . . . . . . . . . . . . . . . . . .312
The Simple Buildings and Roads . . . . . . . . .312
The Fire Station . . . . . . . . . . . . . . . .312
The Vista Hotel. . . . . . . . . . . . . . . . .314
The Parking Garage . . . . . . . . . . . . . . .315
Smoke. . . . . . . . . . . . . . . . . . . . . .316
The Animation . . . . . . . . . . . . . . . . . . .317
The Opening Sequence . . . . . . . . . . . . . .317
The Explosion. . . . . . . . . . . . . . . . . .319
Sawing the Door. . . . . . . . . . . . . . . . .320
The Saw . . . . . . . . . . . . . . . . . . .320
Opening the Door. . . . . . . . . . . . . . .320
The Cutting Operation . . . . . . . . . . . .321
The Smoke. . . . . . . . . . . . . . . . . . . .321
Summary . . . . . . . . . . . . . . . . . . . . . .322
Afterword: The Future. . . . . . . . . . . . . . . . . . . . .323
About REND386, VR-386, and AVRIL. . . . . . . . . .323
Other Information Sources . . . . . . . . . . . . .324
Electronic Newsgroups and Mailing Lists. . . . .324
DIASPAR. . . . . . . . . . . . . . . . . . . . .324
Printed Magazines, Books, and User Groups. . . .325
Other Books. . . . . . . . . . . . . . . . . . .325
Conferences. . . . . . . . . . . . . . . . . . .325
Appendix A: WLD File Syntax . . . . . . . . . . . . . . . . . .327
Appendix B: CFG File Syntax . . . . . . . . . . . . . . . . . .331
Appendix C: VRLIB Library . . . . . . . . . . . . . . . . . . .333
Data Types. . . . . . . . . . . . . . . . . . . . .333
Object Altering Functions . . . . . . . . . . . . .334
Vertex Functions. . . . . . . . . . . . . . . . . .336
Facet Functions . . . . . . . . . . . . . . . . . .337
Light Source Functions. . . . . . . . . . . . . . .337
Virtual Camera Functions. . . . . . . . . . . . . .338
Environmental Functions . . . . . . . . . . . . . .339
Rendering Functions . . . . . . . . . . . . . . . .339
Stereoscopic Viewing System Functions . . . . . . .340
Video Display System Functions. . . . . . . . . . .341
Input Device Functions. . . . . . . . . . . . . . .343
User-Interface Functions. . . . . . . . . . . . . .343
File Reading Functions. . . . . . . . . . . . . . .344
Tasking Functions . . . . . . . . . . . . . . . . .345
Timer-Related Functions . . . . . . . . . . . . . .345
State Machine Functions . . . . . . . . . . . . . .345
BOB Interpreter/Compiler Functions. . . . . . . . .346
BOB Routines. . . . . . . . . . . . . . . . . . . .346
Appendix D: Format Conversion . . . . . . . . . . . . . . . . .347
3DS2PLG . . . . . . . . . . . . . . . . . . . . . .347
DXF2PLG . . . . . . . . . . . . . . . . . . . . . .347
RAW2PLG . . . . . . . . . . . . . . . . . . . . . .347
OFF2PLG . . . . . . . . . . . . . . . . . . . . . .348
The .AOF File. . . . . . . . . . . . . . . . . .348
Color Handling . . . . . . . . . . . . . . . . .348
PLGFILT . . . . . . . . . . . . . . . . . . . . . .349
Appendix E: NorthCAD-3D Quick Reference . . . . . . . . . . . .350
Special Keys. . . . . . . . . . . . . . . . . . . .350
The Menus . . . . . . . . . . . . . . . . . . . . .350
Main Menu. . . . . . . . . . . . . . . . . . . .350
Model Menu . . . . . . . . . . . . . . . . . . .351
Move Menu . . . . . . . . . . . . . . . . . . .351
Scale Menu . . . . . . . . . . . . . . . . . . .351
Rotate Menu . . . . . . . . . . . . . . . . . .351
Extrude Menu . . . . . . . . . . . . . . . . . .352
Revolve Menu . . . . . . . . . . . . . . . . . .352
Copy Menu . . . . . . . . . . . . . . . . . . .352
Files Menu . . . . . . . . . . . . . . . . . . .352
Objects Menu . . . . . . . . . . . . . . . . . .353
Group Menu . . . . . . . . . . . . . . . . . . .353
Settings Menu . . . . . . . . . . . . . . . . .353
Edit Menu. . . . . . . . . . . . . . . . . . . .353
Draw Menu. . . . . . . . . . . . . . . . . . . .353
Appendix F: State Machine Language. . . . . . . . . . . . . . .354
Appendix G: Bob Syntax. . . . . . . . . . . . . . . . . . . . .356
Program Structure . . . . . . . . . . . . . . . . .356
Member De_nitions. . . . . . . . . . . . . . . .356
Statements . . . . . . . . . . . . . . . . . . .356
Expressions. . . . . . . . . . . . . . . . . . .357
Appendix H: Stereoscopic Viewing. . . . . . . . . . . . . . . .358
Stereoscopic Viewing Parameters . . . . . . . . . .358
Convergence and Focusing. . . . . . . . . . . . . .359
Field Of View . . . . . . . . . . . . . . . . . . .360
Lens Distortion . . . . . . . . . . . . . . . . . .360
Summary . . . . . . . . . . . . . . . . . . . . . .361
Index . . . . . . . . . . . . . . . . . . . . . . .362
===========================================================================
Some notes:
1. I did not create the table of contents; the publisher did.
2. The notes on the cover of the book can be *very* misleading; just
for the record, I did not write any of the text on the cover, nor
was I given a chance to look at the cover before it went to print.
Caveat Emptor. Trust this document, not the book cover.
===========================================================================
Errata:
I wasn't given a chance to proofread the final draft of the
book, so several of the figures in it contain errors.
Figure 4-9: The illustration shows the origin of the chesspiece as being
at one edge; it should be in the center of the base of the piece.
Figure 4-12: The pyramid looks like it's four sides plus a base; it should
be three sides plus the base (which is why there are 4 vertices, not
5).
Figure 4-14: The two cubes look identical in the figure; one of them, the
one on the right, is supposed to have each square face made up of two
triangles.
Figure 4-31b: This figure is just plain confusing. Ignore it.
Figure 4-32: It should be clearer that the the triangle in the upper left
is entirely visible, the one in the lower left is not visible (i.e.
it's completely Z-clipped) and the middle triangle is partially
Z-clipped.
Figure 4-33: The equation is set wrong. It should be:
Y' Y DY
--- = --- so Y' = ---
D Z Z
Figure 4-36: The artist tooks some liberties with the relative sizes of
the objects; the idea was to have been that the left- and right-hand
edges of Object B (the wall) extend past the bounds of objects A and
C (which is why there's a depth-sorting problem).
Figure 6-2: Showing a color palette in black and white doesn't make much
sense; it would be nice if the book had color plates, but it doesn't.
Figure 6-21: Not sure what's happening there at all.
Figure 7-19: Caption should read "Revolving a) A bracket shape to form
b) A cylinder shape".
Figure 7-27: Caption should read "The grove as seen in VRVIEW".
Figure 8-1: All three circular arrows are going in the wrong direction.
Figure 8-8: The caption should read "The splitting tree for Figure 8-7".
Figure 8-14: The a) and b) figures are swapped; the one on the left is
the right way, the one on the right is the wrong way (not the other
way around).
Figure 9-1: The words on the ellipsoids are "ALPHA", "BETA", and "GAMMA".
Figure 9-8: The left part of the equation should of course have a horizontal
line separating the numerator from the denominator.
Page 325: PCVR magazine is no longer being published; however, check out
Virtual Reality World (published by the Meckler organization described
under "Conferences".
Figure H-1: The diagram came out looking a little strange, and again the
line between the numerator and denominator on each side of the equation
has gone missing.
If you notice any other errors in the book, please send me email; my
address is broehl@uwaterloo.ca, and I check my mail fairly often (though
it sometimes takes me a long time to respond).
--------------451B3B3D5594CBDBB5CD8703--