L   A   U   R   A        L   E   M   A   Y 'S

W E B   W O R K S H O P

3 D   G R A P H I C S   &  V R M L  2.0

by Laura Lemay
    Justin Couch
    Kelly Murdock

C  O  N  T  E  N  T  S


Chapter 1  Building a 3D Enhanced Web Site

Chapter 2  Up and Running: First VRML Creation

Chapter 3  Adding Simple 3D Elements to Your Web Page

Chapter 4  Creating and Embedding 3D Rendered Images

Chapter 5  Creating and Embedding Simple 3D Animations

Chapter 6  Using Animation Plug-Ins in Your Web Page

Chapter 7  Product Design on a Corporate Intranet: Advanced Telescope Design Corporation

Chapter 8  Creating Advanced 3D Rendered Images for Your Web Page

Chapter 9  Creating Advanced 3D Animations for the Web

Chapter 10  Using Apple's QuickTime VR

Chapter 11  Using Microsoft's ActiveVRML

Chapter 12  Creating a MYST-like Adventure on the Web

Chapter 13  Exploring VRML Browsers and Development Tools

Chapter 14  Starting with Models

Chapter 15  Sprucing Up Models withTextures and Materials

Chapter 16  Adding a Dash of Reality

Chapter 17  The VRML Art Gallery: A VRML World by Hand

Chapter 18  Tricks to Optimize Your VRML Worlds for the Web

Chapter 19  Using Built-in Animation Techniques

Chapter 20  Interfacing VRML Worlds with Scripts

Chapter 21  Using Java to Add Behaviors to VRML

Chapter 22  Adding Interactivity: The Future of VRML

Chapter 23  A 3D Gallery: An Advanced VRML World

appendix A  3D Software Resource Guide

appendix B  VRML 2.0 Node Specifications

appendix C  VRML Resource Guide

appendix D  ActiveVRML Resources

appendix E  HTML Quick Reference


Copyright © 1996 by Sams.net Publishing


All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. For information, address Sams.net Publishing, 201 W. 103rd St., Indianapolis, IN 46290.

International Standard Book Number: 0-672-143-2

HTML conversion by :
    M/s. LeafWriters (India) Pvt. Ltd.
    Website : http://leaf.stpn.soft.net
    e-mail : leafwriters@leaf.stpn.soft.net
President, Sams Publishing: Richard K. Swadley
Publishing Manager: Mark Taber
Managing Editor: Cindy Morrow
Marketing Manager: John Pierce
Assistant Marketing Managers: Kristina Perry, Rachel Wolfe

Acquisitions Editor Beverly Eppink Development Editor Fran Hatton
Software Development Specialist Bob Correll Production Editor Lisa M. Lord
Copy Editor Howard A. Jones IndexerCheryl Dietsch
Technical Reviewers Sue Charlesworth, Alfonso Hermida Editorial Coordinator Bill Whitmer
Technical Edit Coordinator Lorraine Schaffer Resource Coordinator Deborah Frisby
FormatterFrank Sinclair Editorial Assistants Carol Ackerman, Andi Richter, Rhonda Tinch-Mize
Cover Illustration Eric Lindley Cover DesignerAlyssa Yesh
Book Designer Alyssa YeshCopy Writer Peter Fuller
Production Team Supervisor Brad Chinn
ProductionStephen Adams, Debra Bolhuis, Mona Brown, Jason Hand, Daniel Harris, Mike Henry, Ayanna Lacey, Casey Price, Laura Robbins, Bobbi Satterfield, Mark Walchle


To my dear wife, Angela, for everything.
-Kelly Murdock
To Imagica, CYBERLady, Reflection, and Nemesis, friends from the heart of cyberspace.
-Justin Couch


Thanks to the many software companies who were so gracious in supporting this project. To my friends at Viewpoint, who remembered me after all these years. To all my friends at Sams who showed interest in this project, especially the Emerging Technologies team, and to Richard for letting me have a chance to write.

To my family, especially Mom and Mike. I don't know if I am the first to be published, but this book definitely has the prettiest cover. Dad, we're still waiting for your first book. To Eric and Thomas, the two cutest boys ever, be nice to one another.

-Kelly Murdock

Apart from the lack of sleep, I would like to thank the people from Sams.net for letting an Aussie write a book for them. Living on the right side of the globe makes life interesting when trying to communicate ideas and thoughts to Kelly (my co-author) and the editors. This has been a true adventure in using the Internet for global communications.

Many contributed to the content. First, to Cindy Reed-thanks for the cutest VRML pig around; keep hanging in there and you'll get the hang of scripting one day. Gavin Bell, Rikk Carey, and Chris Marrin, as well as the countless thousands on the VRML development list-thanks for putting up with incessant questions on a specification that wasn't finished. And thanks to my mate, Mark Webb, an Aussie feeling very lost in the United States; he spends his time reading the drafts and picking up those fine little corrections and clarifications.

The final acknowledgement must go to my friends from Terra Vista, a real virtual community built in the spirit of cyberspace. Regardless of ability or technical clout, they have pushed the electronic frontiers further in the past four months than any other community I have ever been involved in-real or virtual. Keep going and never give up the dream.

"Cyberspace. A consensual hallucination experienced daily by billions of legitimate operators, in every nation, by children being taught mathematical concepts…. A graphic representation of data abstracted from the banks of every computer in the human system. Unthinkable complexity. Lines of light ranged in the nonspace of the mind, clusters and constellations of data. Like city lights, receding."

(William Gibson, Neuromancer, p. 103)

-Justin Couch

About the Author

Kelly Murdock has led many different lives before this book, including as a missionary in Japan, a champion collegiate hurdler and decathlete, and a professional engineer, but none was as challenging as his current profession-being a husband and father. When not with his family (or in front of his computer), he can be found at Sams.net buried in his office, reading and developing computer books.

Kelly contributed to Web Page Wizardry and has written several articles on virtual reality. He graduated from Brigham Young University with a degree in mechanical engineering and has founded a multimedia production company named Tulip Multimedia with his wife. In his spare time, he likes to attend concerts and movies with his wife. He can be reached at kmurdock@sams.mcp.com.

Justin Couch (justin@vlc.com.au) works as a software engineer for ADI Ltd. When not working there, he also runs The Virtual Light Company, a small VRML and Java Web publishing company in Sydney, Australia. He is an active member of both the VRML standards and Java-VRML mailing lists. Currently, he's involved in research on using VRML to create seamless worlds on the Internet. When not pushing the limits, he relaxes by playing bassoon and clarinet and going gliding.

Justin can be found most days in the CyberGate community Point World under the name Mithrandir or can be reached through the Web at http://www.vlc.com.au/~justin.

Tell Us What You Think!

As a reader, you're the most important critic and commentator of our books. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way. You can help us make strong books that meet your needs and give you the computer guidance you require.

Do you have access to CompuServe or the World Wide Web? Then check out our CompuServe forum by typing GO SAMS at any prompt. If you prefer the World Wide Web, check out our site at http://www.mcp.com.

If you have a technical question about this book, call the technical support line at (800) 571-5840, ext. 3668.

As the team leader of the group that created this book, I welcome your comments. You can fax, e-mail, or write me directly to let me know what you did or didn't like about this book-as well as what we can do to make our books stronger. Here's the information:

Mail:Mark Taber
Comments Department
Sams Publishing
201 W. 103rd Street
Indianapolis, IN 46290


As you can see from the title, this book really has a split personality-the first half is about 3D graphics and the second is about VRML. However, these two topics are very closely related. VRML scenes are 3D graphics, and 3D graphics are used in VRML scenes.

3D graphics on the Web are pervasive because they are graphics. VRML on the Web is a hot new technology that enables real-time 3D. By covering both, you get a broader look at how to enhance your site with many facets of 3D graphics, instead of just one.

In the past, we've all marveled at this technology from a distance. We've seen it in movies, in arcades, and in some of the latest research environments; now we're seeing it on our home pcs. The power of current processors coupled with 3D acceleration cards are making it possible to experience advanced 3D graphics everywhere, especially on the Web.

To begin, we will introduce this unique series, 3D graphics on the Web, and VRML 2.0. A lot is included, and there's a lot you can get out of it.

The Web Workshop Series

Back in 1994, Laura Lemay wrote a little book that changed a lot of people's lives-Teach Yourself Web Publishing with HTML in a Week. It taught everyday people how to present and publish their ideas on the Web. The results have been revolutionary.

Laura's book was popular with many people because of its simple, direct language and engaging, easy-to-understand examples. Laura followed up her best-selling book with several enhanced editions and another best-seller, Teach Yourself Java in 21 Days. It was clear to the publisher that Laura had developed a style people could relate to.

In the meantime, simple Web publishing with HTML has moved forward on many different fronts. You can publish on the Web by using one of many HTML editors, such as Microsoft's FrontPage and Netscape's Navigator Gold; you can enhance your site with audio, video, ActiveX controls, 3D VRML worlds, and specialized plug-ins, like Shockwave; you can program on the Web with powerful languages like Java or scripting languages, such as JavaScript and VBScript.

With all this happening, it became obvious that Laura would have her hands full trying to instruct her readers in all these new developments, so the Web Workshop series was born.

This series is directed toward readers who have mastered the basics of HTML and are now ready to move to the next level of Web development-to experiment with all the new technologies that are making the Web interactive, easier to use, and exciting.

This particular book focuses on 3D graphics and VRML 2.0. It doesn't assume you're familiar with either of these areas, but it guides you through the details of creating 3D content for your Web pages in that familiar, comfortable Laura Lemay style.

This book is a "do" book. The Workshop name means there are no fluff chapters on historical background, marketing hype, or conceptual discussions. Each chapter is full of hands-on examples that teach you, step-by-step, how to use these technologies.

In addition to the examples, several chapters have real-life examples. These workshops are found in the first two chapters of the book and at the end of each part.

3D Graphics on the Web

3D graphics on the Web typically show up in two forms-images and animations. As an HTML pro, you will have no trouble using either in your Web pages, but creating them is where the challenge lies.

The first half of this book teaches, by example, how to create these 3D images with 2D and 3D tools. It also covers creating animations using the latest mid-range 3D tools. The workshops show you how 3D graphics can enhance your site and keep people coming back.

In covering 3D graphics, many different tools are used to create 3D content. By focusing on several tools, the book isn't a guide to learning one package, but a broader look at the types of tools you're likely to use. It also lets you see some unique functions that aren't exclusive to each package. Here's a list of some of the packages used in these examples:

Chapter 1, "Building a 3D Enhanced Web Site," is the fast track. It takes you through developing a site enhanced by 3D graphics and shows you the possibilities of what's covered in the rest of the chapters.

Chapter 3, "Adding Simple 3D Elements to Your Web Page," shows you how traditional 2D tools, such as image-editing programs and plug-in filters, can be used to create 3D effects.

Chapter 4, "Creating and Embedding 3D Rendered Images," gets into the basics of 3D image creation. It shows you how to build scenes by using models and how to apply textures and materials; it also gives you a basic overview of 3D graphics technology through simple examples.

Chapter 5, "Creating and Embedding Simple 3D Animations," introduces 3D animation and explains how to generate animations by moving the camera and moving the models.

Chapter 6, "Using Animation Plug-Ins in Your Web Page," covers animation plug-ins that help you display the 3D animations you've just created.

Chapter 7, "Real-Life Examples: Product Design on a Corporate Intranet: Advanced Telescope Design Corporation," is the real-life example for this part of the book. It illustrates using 3D enhanced graphics over an intranet to explain the latest product designs.

Chapter 8, "Creating Advanced 3D Rendered Images for Your Web Page," gets into advanced issues of creating 3D images for the Web, including complex modeling and rendering issues.

Chapter 9, "Creating Advanced 3D Animations for the Web," offers many advanced techniques of 3D animation creation, including character animation.

Chapter 10, "Using Apple's QuickTime VR," delves into a new technology for the Web developed by Apple-QuickTime VR. This chapter explains what it is and gives some examples of it.

Chapter 11,"Using Microsoft's ActiveVRML," previews Microsoft's ActiveVRML technology. Uniquely different from VRML, ActiveVRML offers some similarities to VRML and some not-so-similar options.

Chapter 12, "Real-Life Examples: Creating a MYST-like Adventure on the Web," is the real-life example for the third part of the book. You'll see how to create an adventure game with 3D graphics played over the Web.

VRML 2.0 on the Web

VRML is a new technology that's similar to HTML in many ways, but the end results are very different. VRML files are created by writing text files that define 3D worlds. These worlds can then be loaded into your favorite browser by using a VRML browser or a VRML plug-in. Within a VRML browser, you can move around these worlds in three dimensions, and the view updates in real-time. Imagine going inside the 3D images you create in the first part of the book and flying around the objects-that's what VRML can do.

VRML 2.0 offers more than just worlds you can roam about. With the 2.0 version, you can add behaviors to your objects that make them move and react to the world around them. This capability and many other improvements make VRML 2.0 a technology you really should learn to use in your Web sites. This book explains how it's done.

Although you'll be using a simple text editor to create most of the VRML worlds in the book, several VRML tools are presented, also:

At the time this book was going to press, Sony was in the process of changing the name CyberPassage to Community Place. Check the Sony site at vsl.sony.co.jsp for updates.

Chapter 2, "Up and Running: First VRML Creation," is a quick-start example using VRML; it extends Chapter 1 by adding a VRML showroom.

Chapter 13, "Exploring VRML Browsers and Development Tools," explores the VRML browsers you need to view VRML files. It also takes a look at several development tools that help you create VRML worlds easily.

Chapter 14, "Starting with Models," introduces how models are defined in the VRML world. Using basic shapes and models, you can start to lay out your VRML world.

Chapter 15, "Sprucing Up Models with Textures and Materials," teaches you how to enhance and manipulate your models by using textures and materials.

Chapter 16, "Adding a Dash of Reality," adds lights and viewpoints to your VRML world.

Chapter 17, "Real-Life Examples: The VRML Art Gallery: A VRML World by Hand," is a real-life example of a VRML world in action. The example creates an art gallery that's worth visiting.

Chapter 18, "Tricks to Optimize Your VRML Worlds for the Web," offers tricks to help you reduce the file sizes of your worlds and optimize them for the Web.

Chapter 19, "Using Built-in Animation Techniques," gives you your first look at animating objects within your world.

Chapter 20, "Interfacing VRML Worlds with Scripts," introduces you to scripting interaction with JavaScript.

Chapter 21, "Using Java to Add Behaviors to VRML," shows you how you can use Java to program specialized behaviors into your world's objects.

Chapter 22, "Adding Interactivity: The Future of VRML," explains where VRML is headed and covers some of the 3D chat environments that are beginning to appear.

Chapter 23, "Real-Life Examples: A 3D Gallery: An Advanced VRML World," concludes the book with a final VRML workshop. This real-life example extends the art gallery by using all these advanced techniques.

Get Ready…

The book is designed to present example after example of good ideas to enhance your Web pages, so it doesn't need to be read in order. If you're anxious to get into the VRML stuff, then jump straight to Chapter 13.

Every chapter ends with Workshop Wrap-up, Next Steps, and Q&A sections. The Next Steps section is designed to offer you information on where you might like to go to next.

Get Set…

A valuable resource that shouldn't be overlooked is the CD-ROM that comes with the book. We've put a lot of effort into finding many resources that will help you as you read the book. Many of the software packages covered in the book have a demo version available on the CD-ROM. These demo versions let you play around with the program to see whether it fits your needs before you buy it.

The CD-ROM also has a friendly HTML interface with all the book examples and an extensive resource guide with plenty of links.


We really hope you get a lot out of this book. 3D graphics can be a lot of fun; by using them, you can create some compelling Web sites. So without further hand-waving, read on! Good luck-and when you succeed, we'd love to hear about it.

--Kelly Murdock kmurdock@sams.mcp.com

--Justin Couch justin@vlc.com.au