spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / 3d / lesson32

Lesson 32 - VRML 97--Using Authoring Tools - Part 1

Developer News
Sir Tim Talks Up Linked Open Data Movement
From L.A. to Vegas With 100GbE
Salesforce Rolls Out Big Summer '08 Update

I've been having so much fun with the new VRML, it's scary.

Our past few lessons focusing on VRML 2 (VRML 97) technology have worked directly with the code, developed by hand. This enabled us to understand some of the basic principles and keep things as simple as possible. It also limited us to very crude models and scenes. We used default primitive shapes, like the Box and Sphere nodes, in our examples because these objects can be defined in just a few lines of code.

More sophisticated geometry requires code that explicitly defines all the points and polygons in an object. Take a cube. To define it explicitly (instead of using the Box primitive) we must use the IndexedFaceSet node. The full definition of the node is quite complex, but at a bare minimum, it contains a list of all the points that constitute the vertices of the all the polygons in the mesh and a list defining all of the polygons themselves using the vertex list.

Take a look at the following code, defining a 1 meter cube.

    #VRML V2.0 utf8 Shape { geometry IndexedFaceSet { # faces: 6 coord Coordinate { point [ -.5 -.5 .5, .5 -.5 .5, .5 .5 .5, -.5 .5 .5, .5 -.5 -.5, .5 .5 -.5, -.5 -.5 -.5, -.5 .5 -.5 ] } coordIndex [ 0, 1, 2, 3, -1, 1, 4, 5, 2, -1, 6, 0, 3, 7, -1, 4, 6, 7, 5, -1, 3, 2, 5, 7, -1, 6, 4, 1, 0, -1 ] }# End of IndexedFaceSet }#End of Shape node

The basic idea is not all that hard to understand, and is essentially the concept used in most polygonal geometry files. All the vertices are listed, defined by their x,y,z coordinates. Note that there are eight points listed, constituting the eight corners of a cube. Then these points are connected to make the rectangular faces. (Using the typical programming convention, the points in the lists are numbered 0-7, rather than 1-8) Thus the first polygon face is created by linking points 0, 1, 2 and 3 from the list. (The -1 is a delimiter, closing a face.) The second face connects points 1, 4, 5 and 2. This method of storing point and polygon information saves space because the same points are used multiple times in different polygons.

Note some classic VRML peculiarities in this code. The coordIndex field lists the polygons directly. But coord field (containing the points) is more complex. The coord field calls for a Coordinate node, which in turn contains a point field with the list of points enclosed. This allows these points to be referenced in other models. We've seen the same idea in previous lessons used to reference a single color for multiple models.

Just a quick look at this method of defining geometry should alert us to at least two important considerations. The first is that models with any degree of complexity will require many, many lines of code. Gzip compression can greatly reduce file size for modem transmission purposes, but the developer seeking to read his or her own code can face a difficult time. Even relatively simple objects can run for pages of VRML code and make the file difficult to edit and comprehend.

The second consideration follows naturally. It would obviously be impossible to create anything more than the simplest models by writing the code. We need interactive tools to create the models and scenes.

To Continue to Parts 2 and 3, Use Arrow Buttons




JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
Book Review: Head First JavaScript · Web Hosting Control Panels · Use Your Blog for Fast Search Engine Rankings
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
NetApp's Virtual Storage Strategy Crystallizes · F/MC Watch: A Cisco-Centric Approach · Olympic Time Trials Use Wi-Fi Mesh

Created: January 19, 1998
Revised: January 19, 1998

URL: http://webreference.com/3d/lesson32/