OutputVRML

image\vrmlmod.jpg

General Module Function

The OutputVRML module uses a VRML renderer stream device that captures the view and writes graphics primitives to a VRML-formatted file.

VRML is a network transparent protocol for communicating 3D graphics over the World Wide Web. VRML files are bound with an identifying MIME type and transported using standard HTTP services on a web server. Your basic HTML web browser processes VRML files with special purpose 3D viewers, called VRML browsers. Your VRML browser may be supplied with your HTML browser, but it is usually downloaded separately, perhaps from a third party vendor. The VRML browser can either be a stand-alone browser or a plug-in component that can be embedded in frames or within HTML pages displayed in the main HTML browser.

The EVS VRML renderer supports two versions of the VRML standard.

*  The VRML 1 format is specified in the VRML 1.0c standard (details below).

*  The VRML 2 format is specified in the VRML 2.0 standard, ISO/IEC CD 14772 (details below).

Known Issues

Turn on the "Use Unlocked Background" option in the Viewer->Background editor when writing VRML files, since the background is otherwise rendered as a small square at the origin.  

Known Problems

At this time there are no known freeware VRML viewers which support the full spectrum of EVS output.  Furthermore, none of the other players available for purchase perform up to the standards that we expect.  For this reason, we generally recommend the use of the 4DIM format for vector 3D model output.

However, VRML is also used for the creation of 3D physical models (www.zprint.com) and this module works great for this application.

Module Input Ports

OutputVRML has two input ports. The first connects to the viewer. The input is captured and written to the specified file. The second port is the VRML (.wrl) file name.

Module Output Ports

None

image\vrmlpanel.jpg

Module Control Panel

The OutputVRML module captures the contents of the view and writes graphics primitives to a VRML-formatted file. The module contains a user interface shown above. A description of the various options follows:

The VRML File type-in specifies the name of the output file that is created. The user may browse to the desired path and/or file via a browse button. The default value is: ..\..\data\evs_vrml.wrl

The Dynamic toggle determines whether a new VRML file is output each time the input view is rendered (ON), or whether the user must explicitly request a new file (OFF). The default value is FALSE.

The next toggle provides a choice of VRML protocol that writes the output file. The Type 2 toggle ON specifies writing a VRML type 2, while off specifies VRML type 1 see below for info on each:

*  VRML1 (default) A clear text ASCII encoding of the VRML 1.0c standard (29 January 1996).

*  VRML2 A clear text UTF8 encoding of the VRML 2.0 standard, ISO/IEC CD 14772 (4 August 1996).

The third toggle provides a GNU-ZIPped compressed option. GNU Zip is compatible with the Cosmo VRML Viewer. Files that are zipped are 1/10th to 1/4th as large and are read directly by some VRML players and decompressed automatically. If you're going to put VRML models on the web, GNU Zip compression is highly recommended, however this choice makes the file unreadable in an editor (non-ASCII). Thus if you plan to edit the ASCII text in your VRML file, you cannot choose this option.

The Write VRML button (when the dynamic toggle is OFF) triggers the generation of a VRML output file. When the dynamic toggle is ON, the user interface for this parameter is removed. As shown in the user interface, the user must put the .wrl suffix in the file, since EVS/MVS will not add this for you. However, if you specify the name of an EXISTING file, then EVS/MVS will NOT overwrite the file, but will create an uncompressed file WITHOUT the .wrl extension.

 

image\grybtn.jpg VRML Hints and Discussion Provides a useful discussion of VRML output settings, web site references, available browsers, and the supported EVS features.

 

Discussion of VRML Output

Virtual Reality Modeling Language (VRML) Output

VRML is a network transparent protocol for communicating 3D graphics over the World Wide Web. VRML files are bound with an identifying MIME type and transported using standard HTTP services on a web server. Your basic HTML web browser processes VRML files with special purpose 3D viewers, called VRML browsers. Your VRML browser may be supplied with your HTML browser, but it is usually downloaded separately, perhaps from a third party vendor. The VRML browser can either be a stand-alone browser or a plug-in component that can be embedded in frames or within HTML pages displayed in the main HTML browser.

The EVS VRML renderer supports two versions of the VRML standard.

*  VRML1 (default) A clear text ASCII encoding of the VRML 1.0c standard (29 January 1996).

*  VRML2 A clear text UTF8 encoding of the VRML 2.0 standard, ISO/IEC CD 14772 (4 August 1996).

Anchors

The OutputVRML module can create anchors in the output scene. An anchor is the head of a hyperlink within a web document. In HTML the anchor is implemented using the following syntax (with an optional TITLE attribute):

<A HREF="url" TITLE="label"> anchor text </A>

When the pointer is placed over the anchor text in the browser, the label, or destination URL, may be displayed in the status bar. If the anchor text is selected by clicking with a mouse button, the hyperlink is activated and the destination URL becomes the current document in the browser.

A similar hyperlink paradigm is supported in VRML. There is a 3D anchor object which has URL and label attributes. When the pointer is placed over the 3D object within the VRML scene, the label, or destination URL, may be displayed in the browser. When the 3D anchor object is selected by clicking a mouse button, the destination URL becomes the current target of the browser. The destination URL can be an HTML text document or another 3D VRML world.

The VRML output from EVS has two new string sub-objects to support the creation of anchors in VRML output. The new sub-objects are:

*  string WWW_url

The string specifies the destination URL for the hyperlink. For example, "http://www.ctech.com"

*  string WWW_label

The string specifies the hyperlink label. For example, "AVS Home Page"

When the VRML renderer encounters a GDobject with non-empty WWW_url value, it creates the appropriate anchor syntax for the object's geometry. That object will become the anchor for a hyperlink in the VRML output.

Note: VRML 2 has optional support for a frame target attribute, which allows VRML anchors to operate in a framed web environment. This feature is not supported in this EVS release.

Here are some examples of EVS visualizations using anchors:

Example 1

An orthoslice through a uniform field is written as a JPEG image. A 3D scene containing the orthoslice mesh is written in VRML with the slice object hyperlinked to the image. Selecting the 3D slice in the VRML browser loads the 2D slice image into the browser.

Example 2

Two versions of the orthoslice scene are created using a downsize module, one at high resolution and one at low resolution. The two scenes are written to separate VRML files. The slice object in each scene is the anchor for a hyperlink to the other scene. The slices are given labels "high-resolution version" and "low-resolution version". In this scenario, the low-resolution scene is used as a 3D thumbnail for the more detailed visualization. In other words, clicking on the low-resolution slice displays the higher quality rendering.

Example 3

The orthoslice is animated through the dataset using the Loop module. A sequence of n VRML scenes is written using dynamic mode in the OutputVRML module. The output filenames are generated by concatenating the loop counter to a fixed filename. Each scene also contains a user interface to control the animation with reset/next/previous actions that have the appropriate URLs set in their WWW_url attributes. For example, a non-cyclic algorithm might be:

*  reset always refers to frame 1

*  next for frame i refers to frame MIN(n,i+1)

*  previous for frame i refers to frame MAX(1,i-1)

Node Names

Node names are added to VRML 2 output using the DEF syntax. A named node can be queried from a Java application, and its attributes can be modified. A name is added to the transform group node containing primitives, and also the appearance node which contains material and texture nodes.

The DEF name is derived from the name of the corresponding EVS data object, but underscores ("_") are added to generate a legal VRML name. The rules for adding the underscore are:

*  a leading digit is prefixed by an underscore

*  invalid VRML characters are replaced by an underscore

Multiple primitive groups can correspond to a single GDobject name. If these are derived from additional render modes, then the non-default groups are given an additional suffix as described below:

*  lines mode _outline

*  points mode _points

*  bounds mode _bounds

*  surface mode background _background

For example, if the math surface has lines mode Regular, then the outline object in VRML 2 output will be called math_obj1_outline, and the appearance node for the lines will be called math_obj1_outline_app.

There can still be multiple occurrences of a DEF node name, either multiple primitive groups per object, or multiple primitive appearances per group. Any Java application manipulating these nodes should make sure it loops over repeated names.

World Wide Language Support

The VRML 2 standard supports a UTF8 encoding of the Unicode character set. This is a special encoding that leaves ASCII values unchanged and requires only one byte per character. Other languages, including the ISO8859 family of 8-bit European character sets, must use two or more bytes per character. See http://vag.vrml.org/VRML2.0/FINAL/spec/part1/nodesRef.html#Text.

Several components of VRML 2 output can be internationalized. These components include:

*  scene title

*  viewpoint name

*  node names

*  annotation text

Stroke text is converted to line primitives by EVS and it cannot be internationalized in EVS viewers or in VRML output.

The scene title and viewpoint name are translated using the standard EVS dictionary mechanism. The dictionary mechanism is used for English names in the default C locale. The keywords VRML_TITLE and VRML_VIEWPOINT are translated using the vrml.dct dictionary file under the current project.

For example, the full filename on a UNIX system would be:

<project>/runtime/nls/<locale>/vrml.dct

where:

project is the project directory

locale is the EVS locale name for the current session

Node names are derived from the EVS object names as they appear in the EVS viewers. Annotation text labels are standard text objects from EVS. Both the object names and the text labels are EVS string objects that can hold internationalized text in the usual way.

Supported Features

These EVS features are supported by the OutputVRML macro:

*  Cameras

*  3D Cameras

*  perspective projection

*  orthographic projection (emulated in VRML 2, see Known Problems)

*  depth cueing (VRML 2 only)

*  view background color (VRML 2 only)

*  Lights

*  ambient light

*  directional light

*  point light

*  spot light

*  Primitives and Modes

*  3D points

*  directed points (normals)

*  3D polylines

*  3D disjoint lines

*  3D surfaces (no light, background, Gouraud)

*  spheres

*  2D textures

*  bounds

*  stroke text

*  annotation text (VRML 2 only)

*  Properties

*  cull (backface, frontface, flip normals)

*  jitter [not supported in this alpha release]

*  object color

*  diffuse and ambient coefficients

*  specular coefficient and shininess

*  transparency

*  Texture properties

*  alpha modulate

*  tile repeat

*  tile boundary

*  WWW properties

*  anchors

Unsupported Features

The VRML standards provide different levels of support for capturing the contents of complex EVS scenes, so the following EVS features are not supported in VRML 1 or VRML 2.

*  Cameras

*  2D cameras

*  Primitives

*  2D primitives

*  volumes

*  3D textures

*  Properties

*  line width

*  line style

*  line anti-aliasing

*  draw mode XOR

*  specular color

*  sphere subdivision

*  jitter in viewing coordinates (for outlines, etc.)

*  Texture properties

*  texture interpolation

*  mip-map texture

*  decal texture

*  clamp texture

The EVS viewer module has some restrictions, so the following feature is not supported in this release:

*  internationalization of stroke text

The implementation of OutputVRML has some restrictions, so the following EVS features are not supported in this release:

*  jitter emulation using world coordinate offsets (for outlines, etc.)

*  texture transform

*  cell data

*  3D surfaces (flat shading)

*  annotation text attributes: offset, leadline, radial, underline, bounds and drop shadow (only relevant for VRML 2 output)

*  internationalization of annotation text primitive, scene title, and viewpoint name (only relevant for VRML 2 output)

The following features are not supported in the VRML 1 standard:

*  annotation text

*  depth cueing

*  view background color

*  control of browser features, such as navigation mode

*  navigation speed and headlight switch

*  internationalization

Orthographic camera projections are not supported in the VRML 2 standard.

VRML 1 Browser Requirements

The list below outlines the generic features that are required for VRML 1 browsers:

*  whole scene enclosed within a Separator root node

*  scene title using an Info node

*  cameras using OrthographicCamera and PerspectiveCamera nodes

*  lights using the DirectionalLight, PointLight and SpotLight nodes

*  basic primitives using IndexFaceSet, IndexedLineSet, PointSet and Sphere

*  primitive data in Coordinate3, Normal, Color and TextureCoordinate2 nodes

*  properties using the Material node

*  smooth color interpolation for lines and surfaces with per-vertex color using PER_VERTEX MaterialBinding and NormalBinding for indexed primitive nodes

*  face culling and flipping normals using ShapeHints node

*  transforms using the MatrixTransform node

*  textures using Texture2 with in-lined SFImage data

*  DEF/USE of Texture2 nodes

*  hyperlinks using the WWWAnchor node

VRML 2 Browser Requirements

The OutputVRML module does not use PROTO, EXTERNPROTO, ROUTE or the Script node in VRML 2. The list below outlines the generic features that are required for VRML 2 browsers:

*  scene title using a WorldInfo node

*  control navigation mode, navigation speed and headlight switch using NavigationInfo node

*  cameras using Viewpoint node

*  lights using the DirectionalLight, PointLight and SpotLight nodes

*  basic primitives using IndexFaceSet, IndexedLineSet, PointSet and Sphere within Shape nodes

*  primitive data in Coordinate, Color, Normal and TextureCoordinate nodes

*  smooth color interpolation for lines and surfaces with per-vertex color using colorPerVertex and normalPerVertex for indexed primitive nodes

*  face culling and flipping normals using the solid and ccw fields of the IndexedFaceSet node

*  surface properties using Appearance and Material nodes

*  transforms using the Transform group node

*  textures using PixelTexture node, including DEF/USE of PixelTexture

*  depth cueing using Fog node

*  view background color using Background node

*  hyperlinks using the Anchor node

*  annotation text using the Text, FontStyle and Billboard nodes with the Billboard axisOfRotation field set to {0,0,0} to force the text to face the user

Known Problems with VRML Support

There are several known problems with VRML 1 and VRML 2 support in this release. Some of the problems are limitations on the OutputVRML module, others are limitations with the various browsers.

OutputVRML module

*  Orthographic projections

Orthographic projections are not supported in the VRML 2 standard, but the OutputVRML module emulates the appearance of a parallel projection by moving the camera position away from the object and narrowing the field of view. This implementation may have side-effects on navigation in some browsers, so it is recommended that you use perspective projections in EVS to have accurate control over the final appearance of the scene and natural navigation.

*  Multiple cameras

This release does not support multiple cameras. You should not try to use the OutputVRML module for views that have more than one camera.

*  Multiple instances of the OutputVRML module

This release does not support multiple instances of OutputVRML. Only one instance of OutputVRML can exist at any one time.

*  Point and Spot lights

Some position and direction attributes are not displayed in the correct coordinate system.

Cosmo Player 1.0 beta 2a

*  SGI Cosmo Player supports VRML 2.0 and loads VRML 1.0 files by internally converting them to VRML 2.0 format.

*  Cosmo Player does not support the following VRML 2.0 features:

*  smooth interpolated vertex color for lines and surfaces

*  ambientIntensity field for light nodes

*  Text node for annotation text

*  Fog node for depth cueing

*  Anchor label is not displayed

The following items are known problems with Cosmo Player:

*  embedding more than one plug-in in the same HTML document causes problems

*  horizontal and vertical lines are not rendered

*  the headlight switched on by default for VRML 1 scenes