BS Contact

VRML Tips

 

Here are some ideas, tips, optimization hints and examples for VRML world builders.

Doom II worlds converted to VRML

Worlds for the DOOM II Game from ID-software are stored in a format that is convertable to VRML. In addition there are shareware and freeware tools available for editing and creating worlds for DOOM.


Original DOOM II worlds converted to VRML. The following list contains links to the original VRML file, an enhanced version using BSP tree optimizations and the multi-user version:

In BS Contact the textures will look better using "high quality" or "hardware" rendering settings. The C key toogles collision detection. the G Key gravitiy


How to build DOOM VRML worlds your self:

First you need to have DOOM II.

Get a free DOOM WAD Editor and construct your own DOOM WAD-Worlds. WAD Files and editing programs can be found on the Internet by searching for sites via keywords like "wad", "doom".

Convert the WAD File to VRML using the Doom2Wrl program.

Doom 2 wrl was created by Ken Russel, SGI. We used a modified version for converting to the proper multi-user coordinate scale, the source is available as zip-file. (Microsoft Visual C and JPEG Library required for compiliation.)

For tuned performance the generated VRML code can be BSP-Tree optimized for BS Contact.

The source of Doom2Vrml could be further enhanced to support things, monsters, teleporters and so on. Currently only some doors can be opened with a click.

Let us know if you enhanced doom2vrml.

Scripting examples:

Stacker
an active object, you can stack up and down the sphere sticks with the cone buttons. Adjust the sticks to form the number 1, 2, 3 and you will win.
Dynamic Surfaces
Want to build a dynamic waving flag or ocean waves, here is a good starting point example using an Elevation Grid and a Script (from a Netscape Demo, only converted to vrmlscript)
Slideshow
A VRML 2.0 slide show, clicking on the red cones exchanges the url field of an ImageTexture node.
Randomizing Coordinates
A sample modifying the coordinates of an IndexedFaceSet with a Script.

Building large worlds

A typical problem in 3D is how to create a large compelling environment without sacrificing the interactivity, i.e. rendering speed.

In the following are several approaches for different types of scenes.
Managing Rooms with a Proximity Sensor
A Script Node with a Proximity Sensor switches Rooms between an inside and outside view. Turn off collision detection ("C" Key in BS Contact) and move into out of the gray boxes (== outside view).
Managing Rooms with a BS Contact Occlusion Node
It's the same principle as above, but the BS Contact extension node Occlusion is being used. Occlusion would allow more complex Sensor areas composed out of primitives or even convex IndexedFaceSet's.

Scene preprocessing using the BS Contact BspTree Node

The BspTree is a performant technique to reduce the amount of geometry passed to the rendering engine. Game Engines are typically based on some BspTree's logic. The BspTree is introduced as a native implemented VRML 2.0 node, other browser can display the model by using a PROTO implementation of the node. 

Please check the BSP documentation for more technical information about the BS Contact BspTree node.

Optimizations and performance Tips

General General for BS Contact (but may also be true for other browsers) Specific to the BS Contact Direct 3D Version Specific to OpenGL

If the model is targeted to run on a software only OpenGL platform or OpenGL hardware without texture acceleration:

Other considerations

The "software only" rendering speed depends largely on the size of the rendering window. A VRML World could be presented using several viewing choices like:

Fixed size windows or fixed size embeds (without %) are limiting the user to resize the rendering area. Other elements on the HTML-Page like animated-gif's may slowdown the VRML browser.

Another aspect is how the scene is decomposed for downloading. BS Contact starts the loading of Inlines and other nodes with URL fields in the order the children of Group nodes are specified, walking into the deeper levels first. Inlines in currently not traversed parts (e.g. non-active children of a Switch/LOD node etc.) are loaded if needed. In Internet Explorer BS Contact starts the download of such in-active children if no other download activity is pending. For LOD nodes with direct Inline child nodes, BS Contact will display the lower LOD-Level if the Inline is not loaded yet. BspTree nodes are traversed by default in front to back order with respect to the viewer.
BS Contact currently does not unload nodes from memory. A script using node.addChildren /removeChildren Browser.createVrmlFromString could be used to perform scene memory management. A node is being deleted if no other reference exists to the node.

Specific to BS Contact vrmlscript/javascript interpreter speed