VRML File Format

VRML File Format

You need not have any substantial knowledge of the VRML format to use the VRML authoring tools to create virtual worlds. However, it is useful to have a basic knowledge of VRML scene description. This helps you to create virtual worlds more effectively, and gives you a good understanding of how the virtual world elements can be controlled using the Virtual Reality Toolbox.

This section is an introduction to VRML. For more information, refer to the VRML97 Reference. This reference is available online at http://www.web3d.org.

In VRML, a 3-D scene is described by a hierarchical tree structure of objects (nodes). Every node in the tree represents some functionality of the scene. There are 54 different types of nodes. Some of them are shape nodes (representing real 3-D objects), and some of them are grouping nodes used for holding child nodes. Here are some examples:

  • Box node — Represents a box in a scene.
  • Transform node — Defines position, scale, scale orientation, rotation, translation, and children of its subtree (grouping node).
  • Material node — Corresponds to material in a scene.
  • DirectionalLight node — Represents lighting in a scene.
  • Fog node — Allows you to modify the environment optical properties.
  • ProximitySensor node — Brings interactivity to VRML97. This node generates events when the user enters, exits, and moves within the defined region in space.

Each node contains a list of fields that hold values defining parameters for its function.

Nodes can be placed in the top level of a tree or as children of other nodes in the tree hierarchy. When you change a value in the field of a certain node, all nodes in its subtree are affected. This feature allows you to define relative positions inside complicated compound objects.

You can mark every node with a specific name by using the keyword DEF in the VRML scene syntax. For example, the statement DEF MyNodeName Box sets the name for this box node to MyNodeName. You can only access the fields of those nodes that you name in a virtual world.

In the following example of a simple VRML file, two graphical objects are modeled in a 3-D scene: A floor is represented by a flat box with a red ball above it. Note that VRML file is a readable text file that you can write in any text editor.

  • #VRML V2.0 utf8
    # This is a comment line
    WorldInfo {
      title "Bouncing Ball" 
    }
    Viewpoint {
      position 0 5 30
      description"Side View"
    }
    DEF Floor Box {
      size 6 0.2 6
    }
    DEF Ball Transform {
      translation 0 10 0
      children Shape {
        appearance Appearance {
          material Material {
            diffuseColor 1 0 0
          }
        }
        geometry Sphere {
        }
      }
    }

The first line is the VRML header line. Every VRML file must start with this header line. It indicates that this is a VRML 2 file and that the text objects in the file are encoded according to the UTF8 standard. You use the number sign (#) to comment VRML worlds. Everything on a line after the # sign is ignored by a VRML viewer, with the exception of the first header line.

Most of the box properties are left at their default values — distance from the center of coordinate system, material, color, and so on. Only the name Floor and the dimensions are assigned to the box. To be able to control the position and other properties of the ball, it is defined as a child node of a Transform type node. Here, the default unit sphere is assigned a red color and a position 10 m above the floor. In addition, the virtual world title is used by VRML viewers to distinguish between virtual worlds. A suitable initial viewpoint is defined in the virtual world VRML file.

When displayed in V-Realm builder, the floor and red ball look like

0 Responses to “VRML File Format”



  1. Laisser un commentaire

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s




I MOVED THIS BLOG FROM WORDPRESS TO BLOGGER. Ce blog est à
ex-ample.blogspot.com

Blog Stats

  • 206,708 hits

localization

Flickr Photos

It is the Bokeh Time of Year :)

Plus de photos
juillet 2008
L M M J V S D
« Juin   Août »
 123456
78910111213
14151617181920
21222324252627
28293031  

%d blogueurs aiment cette page :