XML.com: XML From the Inside Out
oreilly.comSafari Bookshelf.Conferences.

advertisement

Extensible 3D: XML Meets VRML

August 06, 2003

"VRML was born dead. It never solved any real problems. Good riddance." -- from the wwwac mailing list Thursday, February 25, 1999

Remember VRML?

The remark quoted above, to paraphrase Mark Twain, is an example of "what we know that just ain't so". The Virtual Reality Modeling Language is very much alive and being used to solve real problems. In this article, we will examine the new VRML standard, Extensible 3D (X3D), as well as software and other resources available to support it. Examples and a short tutorial on the new X3D XML-format are provided.

Why Do They Say Such Things?

Ever since the meteoric rise of HTML, the dot-com explosion and then implosion, a criterion for success on the Web has been speed of adoption. Some say that open standards are critical to success; others claim that proprietary systems do well if supported by lots of marketing cash and free products. Some say it simply comes down to the View Source test. It is evident that the success of a product or standard on the Web is just as complicated as in any other market and depends on many factors of which these are just more extreme positions. VRML never died or went away; yet it's clearly not the juggernaut that XML or HTML are. Why not?

  • 3D is hard work though generally easier than 2D for the same results. A 3D model can be manipulated easily to get multiple views and to animate realistic motion. Doing this in 2D is quite hard, requires deep technical knowledge of perspective, and lots of practice. On the other hand, a child can animate a VRML 3D world and several have and do.

  • VRML is used for real time 3D simulation. There is much more to do when modeling an object as opposed to drawing it when one considers collisions, moving viewpoints, and so on.

  • Validity counts. VRML is not tag soup. While it passes the View Source test, working with it on a regular basis means acquiring tools. High end professional tools for 3D animation are orders of magnitude more expensive than the same order of tool for HTML.

  • Real-time 3D animation pushes a processor hard. Much of the discipline required to build in this language is centered around learning how to optimize, but the performance needed to properly render many VRML97 worlds built eight years ago is now common from home desktop systems. The challenge is to get full interoperability among the 3D applications and this is the goal of VRML/X3D.


Contents

Remember VRML?

Why Do They Say Such Things?

Who is Using VRML Today

What Is New With VRML? X3D

Why XML?

Why Binary?

MIME Type Support

X3D Resources

X3D By Example

X3D: Root Element

Animation With Transforms, Sensors, Interpolators and ROUTEs

Conclusion

Related Articles


A real-time, 3D multimedia language is not meant to be ubiquitous in the sense that all web designers will learn and apply it. VRML is a language for animators and modellers who are specialists. VRML is meant to be perform well. If that requirement had been made of HTML, HTML would be Postscript. Even in the fields it is designed for, more optimum languages exist for more narrow applications, but VRML nicely hits the sweetspot of complexity, capability, and performance. And for those who value standards, it is standard. To those who say it is a dead language, has no real use, or solves no real problems, they're simply wrong. With VRML the artistry of 3D animation and the disciplines of software programming and object-oriented design merge in a multimedia/hypermedia modeling language to enable some of the most compelling and useful content on the Web.

Who is Using VRML Today

The use of the VRML97 standard has been steadily increasing ever since the first beta VRML browsers were introduced. These are published to the Web or closed systems where they serve multiple purposes such as education, training, or entertainment. Universities, architectural design firms, emergency management training firms, engineering firms, and others have discovered that VRML really is the cheap, ubiquitous way to rapidly simulate things like

Companies like Bitmanagement Software GmbH, which supports the Contact VRML97 browser, and Parallel Graphics, which develops Cortona VRML97 browser have steadily improved their browsers: increased rendering speed, smaller downloads, and language extensions (many of which are now in the new X3D standard). These are a few examples that illustrate the intense commitment VRML artists and engineers have to their work and the language.

What Is New With VRML? X3D

The new web 3D standard is X3D/ Extensible 3D. Open source libraries and commercial plugins have already been released in beta for this new standard. Exporters from commercial editors and dedicated editors are in development. Freeware editors are already available.

What features of X3D distinguish it from VRML97? According to Tony Parisi, from Media Machines Inc., the most important new features are the following.

  • Multiple data encodings (XML, VRML "classic", Binary)
  • New graphics features (NURBs, Humanoid Animation, Multitexturing, Triangle primitives, 2D shapes inside 3D)
  • New networking features (LoadSensor, improved Inline)
  • Improved APIs, more language/object model bindings (e.g. DOM) and many clarifications to event model for better conformance
  • Modularity (the standard is broken up into profiles and components so it can be supported at many levels)
  • MPEG-4 has streaming interactive 3D using VRML

Another important goal was to create specification which would allow the widest possible interoperability; that the worlds created would render and behave identically in different implementations. VRML97 makes it 80% of the way to this goal, but that isn't good enough in a graphics app. For the VRML97 authors, getting identical rendering fidelity and behavioral fidelilty from multiple browsers for the same world was difficult. Has this goal been met in X3D? Tony Parisi says that

We need to be careful: "identical" is a relative term. And the tolerances people have will vary greatly depending upon the target application. In a real-time game "identical" visuals may be less important than consistent behavior. In a CAD viewer the emphasis may be on pixel identity. etc.

Given the early tests, it appears that this goal is close to being achieved, but it will take more time and practice to determine how close is close enough.

Work on the standard at the Web3D Consortium in partnership with ISO is ongoing. This relationship between ISO and the Web3D Consortium is one of the most successful and open of any involving ISO and a web standard. Richard Puk, the ISO/IEC JTC1/SC24 Liaison to the Web3D Consortium, says that

the ISO and the Web3D Consortium have had a mutually successful relationship since the publication of the first Web3D-originated standard, VRML 97 (ISO/IEC 14772). This relationship is based on a formal Cooperative Agreement that satisfies the requirements and responsibilities of both organizations while ensuring timely standardization of Web3D Consortium specifications. The two organizations are in the final stages of standardizing X3D, a second generation of three-dimensional functionality for the...Web.

Why XML?

The original syntax for VRML 1.0 and VRML97 is the so-called curly bracket syntax familiar to C and C++ programmers. It is compact, has very fast parsing speed, and is context free. The following is an X3D example of a red sphere and a blue box lit by a directional light. This is an example of the new VRML Classic syntax.

#X3D V3.0 utf8
PROFILE IMMERSIVE
META "filename" "RedSphereBlueBox.wrl"

Transform {
  children [
    NavigationInfo {
      headlight FALSE
      avatarSize [ 0.25 1.6 0.75 ]
      type [ "EXAMINE" ]
    }
    DirectionalLight {
    }
    Transform {
      translation 3.0 0.0 1.0
      children [
	Shape {
	  geometry Sphere { radius 2.3
	  }
	  appearance Appearance {
	    material Material { diffuseColor 1.0 0.0 0.0
	    }
	  }
	}
      ]
    }
    Transform {
      translation -2.4 0.2 1.0
      rotation 0.0 0.707 0.707 0.9
      children [
	Shape {
	  geometry Box {
	  }
	  appearance Appearance {
	    material Material { diffuseColor 0.0 0.0 1.0
	    }
	  }
	}
      ]
    }
  ]
}

Parsing speed was very important to early VRML work because performance is the sine qua non of real time animation. Given that RelaxNG sports a similar compact syntax, having syntax alternatives isn't that controversial in the XML world. While the decision to provide an XML syntax was quite controversial in the early days of designing the successor to VRML97, few dispute the wisdom of that decision today. According to Yumetech President, Alan Hudson, who is chair of the Web3D Open Source Working Group, the reasons are that

  1. We need XML to interoperate with the Web
  2. We need to incorporate new graphics technologies in a standardized way
  3. We need VRML content to run the same across browsers
  4. We need a standard which can evolve faster then every 5 years

While sharp eyed XML veterans will quickly note that XML cannot guarantee item three, the application of other XML application languages such as XSLT are considered sufficient reason to demand an XML encoding. The example above when encoded as XML looks like this:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"
  "http://www.web3d.org/specifications/x3d-3.0.dtd">

<X3D profile="IMMERSIVE" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" 
    xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.0.xsd">
  <head>
    <meta name='filename' content='RedSphereBlueBox.x3d'/>
  </head>
   <Scene>
     <Transform>
       <NavigationInfo headlight='false' 
         avatarSize='0.25 1.6 0.75' type='EXAMINE'/>
       <DirectionalLight/>
       <Transform translation='3.0 0.0 1.0'>
         <Shape>
           <Sphere radius='2.3'/>
           <Appearance>
             <Material diffuseColor='1.0 0.0 0.0'/>
           </Appearance>
         </Shape>
       </Transform>
       <Transform translation='-2.4 0.2 1.0' rotation='0.0 0.707 0.707 0.9'>
         <Shape>
           <Box/>
           <Appearance>
             <Material diffuseColor='0.0 0.0 1.0'/>
           </Appearance>
         </Shape>
       </Transform>
     </Transform>
   </Scene>
</X3D>

The rendering for the XML encoding looks like the following image:

Red Sphere Blue Box X3D Example.

Note that a VRML Classic encoded world will not render in a VRML97 browser. Although the two browsers cited in this article both render VRML97, that is not an X3D standard requirement, though many consider it a market requirement. Those that want to experiment with the examples in this article should download one or both of the browsers described here.

Pages: 1, 2, 3, 4

Next Pagearrow