DEVELOPER'S GUIDE

This guide is for developers of VRML content for use with Microsoft VRML 2.0 Viewer. It is divided into five sections:

Please be sure to consult the the Release Notes for information about known bugs and important changes.

Support for VRML 2.0

This section describes details of the MS VRML 2.0 Viewer implementation, including known bugs.

Microsoft VRML 2.0 Viewer is fully compliant with the Minimum Conformance requirements in the ISO/IEC DIS 14772-1 VRML 2.0 specification, dated 4 April 1997. Fields considered optional according to the Minimum Conformance requirements are supported unless they are specifically mentioned below.

Anchor

Only the first URL specified is used.

URLs that refer to files located on the local disk and contain viewpoint names do not work.

Collision

When the Prevent collisions user option is OFF, users will pass through geometry regardless of Collision nodes. This option is ON by default. To ensure that users are blocked by geometry, use NavigationInfo type NONE.

ColorInterpolator

The interpolation of colors is performed in RGB color space, not HSV color space.

DirectionalLight

The effect of the color field is only visible when the Viewer is in full color mode. (See Full Color Setting.)

ElevationGrid

In full color mode, vertex colors are supported, but an ElevationGrid with vertex colors is not affected by lights. When full color is off, the vertex colors are averaged to compute face colors, which are affected by lights. (See Full Color Setting.)

Fog

The fogType is ignored and always assumed to be "LINEAR". Fog is only visible when the Viewer is in full color mode. (See Full Color Setting.)

FontStyle

The family field can include the names of any installed Windows fonts, in addition to "SERIF", "SANS" and "TYPEWRITER". If none of the specified fonts are available on the viewer's system, "SERIF" is used instead.

IndexedFaceSet

In full color mode, vertex colors are supported, but an IndexedFaceSet with vertex colors is not affected by lights. When full color is off, the vertex colors are averaged to compute face colors, which are affected by lights. (See Full Color Setting.)

IndexedLineSet

Fully supported in full color mode. With full color off, the color field is ignored; the emissiveColor of the Material node is used to color the line set. (See Full Color Setting.)

ImageTexture

Supported file types are GIF, BMP, JPG, RAS, PPM and PNG.

The repeatS and repeatT fields are ignored.

Intermediate alpha opacities are not supported. Pixels with alpha less than 0.5 appear fully transparent, and pixels with alpha greater than or equal to 0.5 appear fully opaque.

Material

The ambientIntensity field is not supported.

MovieTexture

Supported file types are MPEG, AVI, and QuickTime. Audio is supported in all formats.

The repeatS and repeatT fields are ignored. Negative values in the speed field are ignored.

Intermediate alpha opacities are not supported. Pixels with alpha less than 0.5 appear fully transparent, and pixels with alpha greater than or equal to 0.5 are opaque.

NavigationInfo

The speed field is not supported.

The first value of the avatarSize field is used to determine the allowable distance between the user and geometry during collision detection. Other values in this field are ignored.

Because the Microsoft VRML 2.0 Viewer's navigation types do not map directly to those described in the VRML specification, the user's ability to change navigation modes is not restricted based on the type field, except in the case of NONE.

The NONE type disables both toolbars, the right-button pop-up menu, and the ability to navigate using the mouse.

The WALK, FLY, and EXAMINE navigation types set the initial navigation mode when the world is loaded. The Viewer does not support gravity, so type FLY is the same as WALK.

If the type is ANY, viewpoint transitions triggered by Anchor nodes or the loadURL() scripting method are animated and trigger sensors.

PixelTexture

The repeatS and repeatT fields are ignored.

Intermediate alpha opacities are not supported. Pixels with alpha less than 0.5 appear fully transparent, and pixels with alpha greater than or equal to 0.5 are opaque.

PointLight

The effect of the color field is only visible when the Viewer is in full color mode. (See Full Color Setting.)

The radius field is emulated using quadratic attenuation. If the attenuation field is set to something other than the default (1 0 0), the radius field is ignored.

PointSet

When full color is off, the color field is ignored; the emissiveColor of the Material node is used to color the point set. (See Full Color Setting.)

PointSets that contain thousands of points may not render completely.

Script

Script nodes can contain Java or Javascript. (VRMLScript is supported to the extent that it overlaps with JavaScript.) If the url field does not specify a file, it must begin with one of the following:

The "javabc:" protocol for including Java classes directly in .wrl files does not work. Use the url field to specify an external class file instead.

The JavaScript eval() function does not work.

If there is an error in a Script node, the browser sends a notification to the VRML Console. Further events to the Script node are ignored.

A line number of "0" is incorrectly reported when an error occurs on the last line of a script contained within a Script node.

The loadURL scripting method uses only the first specified URL.

See Support for JavaScript and Support for Java in Script Nodes.

Sound

The sound model is spherical rather than ellipsoidal. Values in the maxFront and maxBack fields are averaged to determine the radius of the outer sphere; minFront and minBack are averaged to determine the radius of the inner sphere.

SpotLight

The effect of the color field is only visible when the Viewer is in full color mode. (See Full Color Setting.)

Text

Extremely long text strings may not render completely.

TouchSensor

The hitTexCoord_changed eventOut outputs the average of the texture coordinates in the polygon under the pointing device.

Viewpoint

If a Viewpoint node has both

the user's position will change if he/she chooses the Viewpoint from the menu in the Viewer user interface. Changes to this Viewpoint that occur through any other mechanism will not cause the user's position to change, because jump is FALSE. To avoid this behavior, prevent the Viewpoint from appearing on the menu by not providing a description for it.

Full Color Setting

There are several features in VRML that are only visible when the Full color setting is on. Full color is off by default, but can be controlled on a per-session basis from the Graphics item on the right mouse button pop-up menu. The default can be changed permanently by choosing Options... from the right mouse button pop-up menu and changing the setting of the Full color check box in the Options dialog.

The Full color setting has a significant effect on navigation speed.

This list summarizes VRML 2.0 nodes that are affected when Full color is OFF:

These nodes and fields are fully visible when Full color is ON.

Support for JavaScript

The Microsoft VRML 2.0 Viewer's JavaScript implementation conforms to the JavaScript specification included in Annex C of the ISO/IEC DIS 14772-1 VRML 2.0 specification, dated 4 April 1997.

JavaScript and the VRML Console

JavaScript trace statements are routed to The Viewer's VRML Console. (Select Show VRML Console from the right-button Help menu.)

Variable Scoping

Variables declared with the var keyword are local to the function in which they are declared. Variables not declared with the var keyword are global to the Script node in which they are used and are visible in all functions of the Script node, but not in functions of other script nodes. Script node fields and events are in the same name space as global variables.

Type Conversion in JavaScript Expressions

JavaScript automatically converts between data types when necessary while evaluating expressions. The following table describes how the Viewer's JavaScript implementation performs conversion from each data type to each other data type.

Find the source data type in the leftmost column, then find the cell in that row whose column corresponds to the destination data type. "NS" indicates that the conversion is currently not supported by the Viewer. Conversion of any non-object into an object is not supported.

Data Type Function Number Boolean String
function   error error NS
object error error true NS
Null object NS 0 false NS
number (non-zero) error   true toString
number (0) error   false "0"
Error (NaN) error   NS NS
+ infinity error   NS NS
- infinity error   NS NS
false error 0   "false"
true error 1   "true"
string (non-null) NS numeric
representation
true  
null string error error false  

Support for the Java EAI

The Java EAI is now fully supported according to the Proposal for a VRML 2.0 Informative Annex dated 21 January 1997. It is believed compatible with the EAI classes from other browsers.

The Microsoft VRML 2.0 Viewer uses the vrml.external.* naming convention, not the old vrml.* naming convention.

Requirements for Internet Explorer

Using EAI in Internet Explorer 4.0

No special Java or JavaScript methods are required. All you need to do is use the browser.getBrowser() method.

Using EAI in Internet Explorer 3.02

The following example demonstrates using Java EAI in Microsoft Internet Explorer 3.02a. The VBScript methods "window_onLoad" and "window_onUnLoad" are required to initialize applets that use the Java EAI.

*********************************************************
*********************************************************
HTML FILE:

<HTML>
<HEAD>
<TITLE>Microsoft VRML 2.0 ActiveX Control Example</TITLE>
</HEAD>
<BODY>

<CENTER>
<HR>

<APPLET name=MyApplet code=MyApplet.class width=700 height=140 MAYSCRIPT>
<!-- for CAB users -->
<PARAM NAME="cabbase" VALUE="SmartConnectors.cab">
Cabs are NOT required but can be used
</applet>
</CENTER>

<HR>
<CENTER>
<OBJECT ID="MSVRML2C" CLASSID="clsid:90A7533D-88FE-11D0-9DBE-0000C0411FC3"
HEIGHT=400 WIDTH=500>
<PARAM NAME="World" VALUE="MyWorld.wrl">
</OBJECT>
</CENTER>

<SCRIPT language="VBScript">
<!--
sub window_onLoad
document.MyApplet.SetControl MSVRML2C
end sub
sub window_onUnLoad
document.MyApplet.FreeControls
end sub
-->
</SCRIPT>

</BODY>
</HTML>


*************************************************
*************************************************
JAVA FILE:

import java.applet.Applet;
import vrml.external.*;


/***********************************************/
public class MyClasses extends Applet {

public void SetControl(Object oc)
{
MSVRML2CControl.SetControl(oc, this);
InitVrml(); // NOW do the vrml stuff
}
public void FreeControls()
{
MSVRML2CControl.FreeControls();
}

public void init()
{

setLayout(new FlowLayout());
add(new Button("My Button"));
// other awt stuff etc...
// NO VRML STUFF! SetControl HAS NOT BEEN CALLED YET!
// BROWSER API WON'T WORK!
}

public void InitVrml()
{
Browser browser = Browser.getBrowser(this);
Node node = browser.getNode();
// etc...
}

public void run() {}

// Other Methods ..
}

Support for Java in Script Nodes

The Java in Script nodes implementation is according to Annex B of the ISO/IEC DIS 14772-1 VRML 2.0 specification, dated 4 April 1997.

System.out and System.err

Java's System.out and System.err streams are routed to the VRML Console. (Select Show VRML Console from the right-button Help menu.)

Security

For Java in Script nodes, Microsoft VRML 2.0 Viewer provides an environment similar to Internet Explorer for running Java code. Script nodes have the following restrictions, which are similar to Java applets:

Java classes loaded from the CLASSPATH are considered "trusted code" and can perform operations ordinarily not allowed by the security manager, such as reading/writing files and making access to any network host.

Using the EMBED Tag in HTML Documents

You can use the HTML EMBED tag to specify user interface settings that will be used in the Viewer when a VRML world is embedded in an HTML document. The following tags are supported:

Tag Setting Effect
VRML_POPMENU, SGI_POPMENU FALSE Disables the right mouse button menu
VRML_IMAGEQUALITY, SGI_IMAGEQUALITY BEST Sets image quality to "Smooth"
  SMOOTH Sets image quality to "Flat"
  SMOOTHEST Sets image quality to "Wireframe"
VRML_SPLASHSCREEN, SGI_SPLASHSCREEN FALSE Prevents splash screen from appearing at startup
VRML_DASHBOARD, SGI_DASHBOARD FALSE Turns off horizontal and vertical toolbars