X3D file structure

The educational technology and digital learning wiki
Jump to navigation Jump to search

Draft

This article or section is currently under construction

In principle, someone is working on it and there should be a better version in a not so distant future.
If you want to modify this page, please discuss it with the person working on it (see the "history")

Introduction

X3D scene files have a common file structure:

  • File header (XML, ClassicVRML, Compressed Binary)
  • X3D header statement
  • Profile statement
  • A head section with Component and Meta statements (both optional)
  • X3D root node
  • X3D scene graph child nodes

We shall shortly describe these elements below. But before, let's have a look at the code of a simple exemple scene, inserted XML comments identify the elements:

<?xml version="1.0" encoding="UTF-8"?>

<!-- -------------------- X3D header and X3D root with profile declaration -->
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN"
                     "http://www.web3d.org/specifications/x3d-3.2.dtd">
<X3D profile='Immersive' version='3.2' 
     xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance'
     xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.2.xsd'>

<!-- -------------------- head section with included meta data -->
  <head>
    <meta content='HelloWorld.x3d' name='title'/>
    <meta content='Simple X3D example' name='description'/>
    <meta content='30 October 2000' name='created'/>
    <meta content='7 August 2010' name='modified'/>
    <meta content='Don Brutzman' name='creator'/>
    <meta content='http://www.web3D.org' name='reference'/>
    <meta content='http://x3dGraphics.com' name='reference'/>
    <meta content='http://www.web3d.org/x3d/content/examples/HelloWorld.x3d' name='identifier'/>
    <meta content='http://www.web3d.org/x3d/content/examples/HelloWorldTall.png' name='image'/>
    <meta content='http://www.web3d.org/x3d/content/examples/license.html' name='license'/>
    <meta content='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit' name='generator'/>
  </head>

<!-- -------------------- the X3D scene -->
  <Scene>
    <!-- Example scene to illustrate X3D nodes and fields (XML elements and attributes) -->
    <Group>
      <Viewpoint centerOfRotation='0 -1 0' description='Hello world!' position='0 -1 7'/>
      <Transform rotation='0 1 0 3'>
        <Shape>
          <Sphere/>
          <Appearance>
            <Material diffuseColor='0 0.5 1'/>
            <ImageTexture url='"earth-topo.png" "earth-topo.jpg" "earth-topo-small.gif" "http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png" "http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg" "http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif"'/>
          </Appearance>
        </Shape>
      </Transform>
      <Transform translation='0 -2 0'>
        <Shape>
          <Text string='"Hello" "world!"'>
            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
          </Text>
          <Appearance>
            <Material diffuseColor='0.1 0.5 1'/>
          </Appearance>
        </Shape>
      </Transform>
    </Group>
  </Scene>

<!-- -------------------- footer, closing X3D toot element -->
</X3D>

File and X3D header

Since X3D has grown out of VRML it has both an XML and a VRML syntax. In addition, both formats can be delivered in compressed format.

Profiles, components

X3D X3D has a modular architecture that includes four baseline profiles which are are predefined collections of components.

In addition, within the head section, authors can specify more precisely what components are needed. Components are predefined collections of nodes and match chapters in the specification. Each profile can be augmented by adding other components

Both the mandatory profile definition and the optional components statements tells the X3D browser what level of support is needed for run-time operation.

The specification includes four profiles:

  • Interchange is the basic profile for communicating between applications. It supports geometry, texturing, basic lighting, and animation
  • Interactive enables basic interaction with a 3D environment by adding various sensor nodes for user navigation and interaction (e.g., PlanseSensor, TouchSensor, etc.), enhanced timing, and additional lighting (Spotlight, PointLight).
  • Immersive enables full 3D graphics and interaction, including audio support, collision, fog, and scripting.
  • Full includes all defined nodes including NURBS, H-Anim (animated interactive Avatars) and GeoSpatial components.
X3D Baseline Profiles: Source: What is X3D?, retrieved 11:53, 26 August 2010 (UTC)

Meta statements

Meta statements provide information about the X3D scene as a whole

Information is provided as name-value pairs, for example

 <meta name='created' value='1 January 2008'/>

This approach is thus very general and a wide variety of metadata can be represented. The X3D approach matches same approach used by HTML for regular hypertext web pages.

The X3D scene graph

Each X3D file only can include one X3D scene according to XML principles. In other words there must be a single root element.


Links

Credits and Copyright modificiation