AGOCG logo
Graphics Multimedia VR Visualisation Contents
Training Reports Workshops Briefings Index
 Part One: A Guide to VRML 2.0 previouscontentsstartnext

5. Publishing Worlds on the Web


5.1 MIME type

When a Web server sends a document to a browser, it includes the data's MIME (Multipurpose Internet Mail Extensions) type in the header information. This enables the browser to determine how to display the document correctly, for example, by starting a helper application or plug-in.

The official MIME type for VRML files is:

model/vrml

Where model is the MIME major type for 3D data descriptions and vrml is the minor type for VRML documents.

For compatibility with the earlier VRML 1.0 specification, most browsers also accept the experimental VRML MIME type, x-world/x-vrml.

A web server needs to be able to recognize VRML files, in order for it to send the correct MIME type. It does this by associating the .wrl file extension with the VRML MIME type. This may require the Web Master to add the MIME type to one of the server's configuration files. However, more recent versions of the server software are likely to be already configured with the VRML MIME type and no changes will be necessary. For example, the Apache 1.2.5 recognises the VRML MIME type.

The Web browser must be also configured so that it associates the installed VRML browser or plugin with the VRML MIME type. Normally, this is done automatically when a VRML browser application is installed, however sometimes it may be necessary to configure the browser manually. This will usually be described in VRML browser installation instructions.

5.2 Integrating VRML with HTML

The availability of plug-in type VRML browsers enables content creators to combine both HTML and VRML elements into a multimedia document, by the use of frames and the EMBED tag. As demonstrated in Figures 1-1 and 2-3.

The EMBED element is a Netscape extension to HTML, that allows objects, such as video, sound, as well as VRML, to be incorporated within a HTML page and displayed by the appropiate plug-in application. For example, the following markup in a HTML document will cause a VRML world called model.wrl to be embedded within the document, with the size of the plug-in set at 400 by 300 pixels.

<EMBED src="model.wrl" WIDTH=400 HEIGHT=300>

Sometimes it is useful to have the VRML browser plug-in display the 3D scene without also showing its navigation user interface. This can be achieved with the Cosmo Player 2.1 or WorldView plug-in, by adding the attribute VRML-DASHBOARD="FALSE" to the EMBED element. A similar affect can also be produced by adding the NavigationInfo {type "NONE"} node to the original VRML file.

The EMBED element is supported by the latest versions of both Netscape Navigator and Microsoft Internet Explorer. The new HTML 4.0 standard introduces a more sophisticated OBJECT element as a replacement for the EMBED element.

There is a practical, as well as aesthetic, reason for embedding a VRML world within a HTML document. The size of the VRML browser window is a factor in the time it takes for it to render the 3D scene. Therefore, making the VRML window smaller may make movement through the scene noticeably smoother, especially for more complex worlds.

Frames

Another Netscape extension to HTML, now widely supported and used, are frames. This enables the main Web browser window to be divided into a number of smaller windows or frames, each containing its own unique document. Frames usually contain HTML documents, but they can equally be used to display VRML worlds.

To create a HTML document containing frames, the FRAMESET and FRAME elements are used. The FRAMESET element defines the layout of the frames and the FRAME element specifies the URL of the document that each frame should contain. The FRAME element also includes a NAME attribute, which uniquely identifies each frame window. This enables a document to be displayed within a specific named frame when a HTML hyperlink is activated, by using the TARGET attribute:

<A href="doc.html" TARGET="frame_name"> ... </A>


VRML hyperlinks can also be targeted to particular frames, using the parameter field of the Anchor node. The VRML equivalent of the above would be:

Anchor {
	url		"doc.html"
	parameter	"target=frame_name"
	children [
		# ..hyperlinked objects
	]
}


It is also possible with some VRML browsers, to change or set the current viewpoint using the <A> HTML element. For example, if a HTML document contains the following hyperlink:

<A href="model.wrl#view1"> ... </A>


And model.wrl contains a Viewpoint node named VIEW1 using the DEF syntax. The VRML browser will display the scene from that viewpoint, when the HTML hyperlink is activated. If this technique is used with frames, then the VRML browser may change the viewpoint, without reloading the whole .wrl file.

5.3 File Optimization

If you want your VRML world to be viewed by as many people as possible, then you need to consider the size and complexity of your .wrl file. Large VRML files take longer to download, so discouraging users with low speed internet connections. Complex worlds usually create extra processing demands on a computer, so users with less powerful machines may find interacting and moving through these worlds, slow and unresponsive. However, this does not necessarily mean that user-friendly worlds must be simple. This section will describe some of the various techniques that can be used to optimize the VRML file, so allowing the virtual world to be both engaging and feature-rich, but also efficient in the use of computer and network resources.

Reduce Detail

Try to avoid unneccessary detailing when creating objects. More geometric detailing means more polyons which in turn means slower rendering by the browser. The skill is deciding exactly what is the right amount of detail. Using less than a 1000 polygons in the model will ensure that your world can be viewed by a wide audience, but you may feel that it inadequately represents your design, so some experimentation may be necessary.

Problems often arise when using models originally created for other CAD or rendering packages. These applications generally use models with high levels of detail, since geometric accuracy is more important than real-time rendering. Therefore, worlds directly converted from other 3D file formats can sometimes be quite large and difficult to view interactively with a VRML browser.

Texture mapping provides a useful and efficient way of indicating complexity, without explictly modelling the geometry. For example, a building can be created by applying images of windows and doors to the faces of a box shape. However, care should be taken to reduce the size of the image files to a minimum by reducing the resolution, colour depth or using compression.

The number of polygons can also be further reduced by using the Billboard node wherever possible. Since a billboard object always faces the viewer, only one side needs to be modelled or texture mapped. Ideal for representing objects such as trees and street signs.

Level-of-Detail and Inlines

The LOD node utilizes the fact that objects farther away from the viewer do not need to be drawn with as much detail as those closer to the viewer. By defining alternative representations of the same object with different levels of detail, the world builder can help the VRML browser display the scene efficiently. The amount of detail displayed at a time can also be controlled by using the VisibilitySensor node or by defining a visibility limit in the NavigationInfo node.

Many VRML browsers implement delayed loading of VRML files referenced by Inline nodes. This means that the user can start viewing and interacting with the base scene whilst the inlined objects are being fetched. Once the inlined objects have been retrieved they are added to the scene. Therefore, using inlines in a VRML file can help reduce the time taken for the browser to start displaying a world, even though the scene may be initially incomplete.

Optimization of VRML Code

A VRML file can be made more efficient by ensuring that:

VRML worlds generated from other 3D file formats, using geometry translator utilities, can often produce inefficiently written VRML files. So in addition:

Chisel is a free command-line java application for optimizing VRML 2.0 files, from the Trapezium Development Company. They claim it can reduce the size of VRML files generated using 3D Studio MAX by upto 40%, by removing unnecessary digits, white spaces, polygons, redundant fields and extraneous nesting levels. The program was not yet available at the time of writing. See http://www.trapezium.com/chisel.html for more details.

File Compression

The easiest way to significantly reduce the size of a VRML file (although not its complexity) is to compress it. Gzip compression is the technique most widely used for VRML files. When compressed, the VRML files are given the extension .wrl.gz or .wrz. Most VRML browsers will automatically uncompress these files when they are loaded. The GNU gzip command-line compression program is freely available for most computer platforms from http://www.gzip.org and many other sites such as HENSA (www.hensa.ac.uk).

A binary version of VRML will also reduce the size of the file. But this format is still under development (see section 6.1) and is not widely supported.

  previouscontentsstartnext

Graphics     Multimedia      Virtual Environments      Visualisation      Contents