VRML documentation

# Extensible Scene Graph Manager

### Features:

- Extensible scene graph maintainance library, based on VRML'97 (VRML2)
- Not a browser: but rather a software tool to build browsers (under "browser" we understand: VRML browsers in the strickt sense, but also file convertors, front-ends to global illumination programs, physically based animation software, ...).
- Not "just" VRML'97: an application is provided (nodegen, see below) for designing new nodes. Some possible applications:

- physically based material descriptions
- new geometry nodes (nurbs, subdivision surfaces, ...)
- meta-file format: speciliased VRML nodes for geometry and materials in other file formats (e.g. MGF)
- physically based animation (attach mechanical properties to geometries)
- CSG
- RenderMan shaders
- ...

### Concepts:

1) Scene graph import filters ("importer" objects)

A import filter reads a file, potentially referencing other files on the world wide web, and constructs a scene graph data structure representing the 3D model described in the file in memory. The default importer reads VRML'97 files, but additional input filters are provided for other file formats (e.g. ply). Input does not even need to come from a file, although all present filters read files or pipes.

2) Scene graph manager and event execution engine ("world" objects):

The scene graph data structure and manager are designed with a minimum of assumptions about the application in which it will be needed. The library takes care of dynamic changes and maintains flags that will tell you precisely how the scene graph changes from frame to frame in an animation or interactive application.

Dynamic behaviour is obtained as follows: during presentation (see point 3 below), a renderer generates initial events (e.g. time events) that cause data messages to be sent to nodes. The event execution engine takes care of routing these messages. Nodes react to these messages by updating their state accordingly, possibly generating new data messages to other nodes.

3) Scene graph traversal ("renderer" objects) and presentation

The library contains a scene graph iterator, that traverses the scene graph in town-down order. This iterator is typically used in order to render a snapshot of the virtual world at a given instance. During scene graph traversal, a callback routine for each type of node is called. Default callback routines are provided in a default "renderer" class. They implement often needed functionality.

Applications provide callback routines for scene graph nodes by creating a renderer sub-class in which default callback routines are superceeded. This is in the same spirit as the MGF parser library for instance.

State changes can be tracked accurately by inspecting and resetting state update flags, provided for every field of every node.

Each node also provides a "client data" member, to which application specific data can be attached.

4) Export filters ("exporter" objects):

The library also allows to save the scene graph for a given frame to a file, or to some other destination. A default export filter for the VRML'97 file format is provided in the core library. Additional export filters output the scene graph in different file formats.

More details how to import, render and export a scene graph
More details about the scene graph nodes API

### Custom Scene Graph Node Design:

This library envisages also applications for which VRML'97 was not immediately designed, such as e.g. advanced global illumination algorithms. The ability to easily extend VRML'97 with new, custom scene graph nodes for whatever purpose was our main motivation for writing this library. New nodes are hard-coded in the library, allowing highly efficient parsing and rendering of both standard and extension nodes.

In order to highly facilitate the design and implementation of new VRML-like scene graph nodes, a utility, called "nodegen" is provided. The nodegen utility takes a concise description of the interface members and the type of a new node as its input. The input scripts are very similar to the node interface specifications in the VRML standard. nodegen converts an input node description into a set of C++ files, that integrate the new node into the parser and scene graph manager. Only functionality that is specific for the new node needs to be implemented manually, in the form of utility member variables and functions of the automatically generated node class.

Most of the code in the library has been generated using nodegen node code generator.

More details about nodegen.

### Applications:

- vrmlint: VRML syntax checker
- vrmlconv: converts various 3D file formats to, from or across VRML'97.
- vrmlview: highly efficient (but currently rather quick and dirty) VRML'97 browser

Serve as examples for writing new browsers, but are useful already on their own.

Current implementation status.