Looking at X3D and VRML | |
|
|||||||||||||||
Dateline: 11/29/00
X3D the much heralded future of VRML is actually moving along quite nicely! While many people
have contributed to various aspects of X3D, Don Brutzman a key member of the Web3D Consortium's Board of Directors for
several years, has managed to cajole, bully and persevere through
a lot of issues to produce a workable XMLization of VRML. Let's just look at what's here now.
One of the terrific resources now available is a set automatically produced translation of VRML97 files to
X3D files. The entire set of VRML97 files used in the fabulous book "VRML2.0 Sourcebook" by Ames, Nadeau, and Moreland was translated
and is available in set of handy dandy pages at:
Let's examine a couple of these examples a little closer to try to get
a better feel for the corresponding nature of the two syntaxes involved. First
a little clarification on terminology. We are dealing with two encodings of
a scene graph. One encoding the new one called X3D is an XML encoding. The old
encoding really had no name it was just good ole' fashined VRML, so in lieu
of some other name I'll simply call it the GOFVE (Good Ole' Fashioned VRML Encoding).
Let's look in detail at Figure 3.09 a 3D Plus Sign.
Nothing complicated, very straightforward three boxes with a few some DEF/USE of a color and not a transform in site.
The X3D of the same VRML files is as follows: (I've stripped out comments and extra meta information from
the original which you can see at the source location URL stated above)
http://web3d.org/TaskGroups/x3d/translation/examples/Vrml2.0Sourcebook/toc.html
This is truly a great resource that Don completed in the not too distant past.
#VRML V2.0 utf8
Group {
children [
Shape {
appearance Appearance {
material DEF WHITE Material {
diffuseColor 1 1 1
}
}
geometry Box {
size 25 2 2
}
}
Shape {
appearance Appearance {
material USE WHITE
}
geometry Box {
size 2 25 2
}
}
Shape {
appearance Appearance {
material USE WHITE
}
geometry Box {
size 2 2 25
}
}
]
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "http://www.web3D.org/TaskGroups/x3d/translation/x3d-compromise.dtd"
"file://localhost/C:/www.web3D.org/TaskGroups/x3d/translation/x3d-compromise.dtd">
<X3D>
<Header>
</Header>
<Scene>
<Group>
</Scene>
</X3D>
<children>
</Group>
<Shape>
</children>
<appearance>
</Shape>
<Shape>
<Appearance>
</appearance>
<geometry><material>
</Appearance>
<Material
DEF='WHITE'
diffuseColor='1 1 1'/>
</material>
<Box size='25 2 2'/>
</geometry>
<appearance>
</Shape>
<Shape>
<Appearance>
</appearance>
<geometry><material>
</Appearance>
<Material
USE='WHITE'/>
</material>
<Box size='2 25 2'/>
</geometry>
<appearance>
</Shape>
<Appearance>
</appearance>
<geometry><material>
</Appearance>
<Material
USE='WHITE'/>
</material>
<Box size='2 2 25'/>
</geometry>
Each VRML node has a corresponding XML entity. Clearly the X3D is more verbose and somewhat more difficult to read but not unreasonably so. In addition I'd expect that for any substantial hand editing an editor that understands the structure of XML would be used. Similarly editors that understand VRML are used now, such as for example VRMLPad from ParallalGraphics.
Let's make this more interesting and look in more detail at a subsection of the files. One of the Shapes in VRML is:
Shape { appearance Appearance { material USE WHITE } geometry Box { size 2 25 2 } }
The corresponding X3D file fragment is:
<Shape><appearance></Shape><Appearance></appearance> <geometry><material></Appearance><Material USE='WHITE'/></material><Box size='2 25 2'/></geometry>
The rules for the XML are spelled out in the DTD which defines X3D located at:
http://www.web3D.org/TaskGroups/x3d/translation/x3d-compromise.dtd
There's obviously a lot more that's gone into the design of X3D. This will hopefully get you interested and gives you a little taste. The future of the Web is XML and the future for 3D on the Web is X3D. The potential for 3D as a first class citizen of the Web is almost here.