Creating Large Optimized VRML Worlds

Victor N.Tolstykh, Igor V.Shturz

 

Applied Mathematics Department. St.Petersburg State Technical University.

Polytechnicheskaya 29, StPetersburg, 195251, Russia,

e-mail: tolstykh@iname.com, igor@e-spaces.com

 

ABSTRACT

 

            Virtual Reality Modeling Language (VRML) is a standard tool for interactive 3D graphics content of WWW pages, like HTML is for 2D pages. The main problem restricting use of this tool is a low performance rate: too long downloading VRML models through low bandwidth channels and slow rendering on personal computers. The paper summarizes our techniques to cope with the problem.

 

  1. INTRODUCTION

 

Virtual cities are widespread samples of VRML worlds presented in the web sites devoted to educational, cultural or tourist goals (see for example www.planet9.com).  They represent computer-generated copies of real buildings, streets and places that usually belong to architectural heritage. The user, visiting the site is offered to walk through 3D environment for sightseeing. He or she is present at the world as an “avatar”. In third person view mode the camera position is outside the avatar which is displayed as a puppet. In first person view mode the camera position coincides with the avatar’s eyes, and the avatar’s body is usually approximated with its boundary cylinder for collision detection.

 

 

Fig1. Virtual historical center of Antwerpen (fragment)

 

The main challenge of these worlds is their huge size in terms of polygons and textures needed for high visual quality. This results in poor performance: long downloading the VRML file of a big size and low frame rate when rendering. For example, the model of historical center of Antwerpen (see Fig.1), which represents about a hundred houses, has the file size of 1MB, including 800KB of texture files.  Downloading the whole file takes about ten minutes through a modem connection with the transfer rate of 28.8 Kbit per second. When this non-optimized model is running, the frame rate of Pentium-166 is not more then 5-7 frames per second, while 20 fps is a minimum for smooth visualization.

 

This paper is devoted to optimization techniques aimed and improving the mentioned VRML world features as well as their visual quality. We used the techniques when building large VRML worlds, including the historical center of Antwerpen. The principal technique for increasing frame rate is to reduce the number of polygons rendered at each frame, i.e. visible by the user at the same time without significant loss of visual quality. We describe some ways to achieve this in the section 2. To speed up downloading, it is necessary first of all to shrink the VRML file size. The section 3 discusses ways to reach that as well as managing downloading sequence for faster downloading.

 

  1. REDUCING VISIBLE NUMBER OF POLYGONS

 

2.1  Avatar movement limitations

 

The main idea is to restrict your freedom to go anywhere within the city so that the positions where too many objects are visible from would be forbidden. Collision detection mechanism of VRML 2.0 is helpful here: transparent walls serve as invisible boundaries of allowed area. The special walkthrough mode known as a “guided tour” is helpful also: the avatar is forced to move along a predefined trace. It is available due to camera movement facility. This mode well fits the sightseeing purpose of the virtual world. Though following the fixed route, the user still has some freedom: to change view direction to left or to right, to stop the movement, etc.

 

2.2  Visibility restriction

 

A straightforward solution is a limited view distance for the user. All objects located more far then some threshold distance not rendered – this is available due to the VRML feature: the VisibilitySensor node. When your avatar approaches these objects close then the threshold distance, they suddenly appear (or disappear in the reverse case). To smooth this undesirable effect, we apply special programming for the VRML nodes Color and Material so that distant buildings have neutral, suppressed coloring which becomes brighter when you approaching them. By the way, this looks naturally since fairly corresponds to the human visual perception: the color saturation for remote objects drops down. For hiding distant objects is helpful here also. However, not all VRML-viewers allow fog effect.

 

2.3  Using levels of detail

 

Logical sequel of the previous idea is to replace distant objects by their simplified models composed of less number of polygons. This is available due to: LOD and ProximitySensor nodes. Several instances of the same object may exist in the scene, each with its own texture, to be visualized at the distance in the specified range: the more distance from the avatar, the simpler model represents the object. Usually it is to have no more then three levels of detail: V1, V2, V3.

 

From a far distance (level 1) the observer sees only most common view V1 of the object with the minimum set of details and low contrast colors of separate details. Its model has the minimum numbers of polygons and low influence on frame rate.

 

From a medium distance (level 2), after transition of the threshold value, there is a change of a level of detail: replacement of elementary model V1 to more detailed V2. In this model the separate details of structures are absent, and others are replaced by textures. Basically, in most cases it is possible to achieve normal quality of model, replacing the whole wall of building by one face with detailed texture.

 

From a close distance (level3) intermediate model V2 is replaced by fully detailed V3. For hiding the moment of the model replacement the view of V2 should be as much as possible similar to the view of V3 at the moment of transition. For this purpose in some cases a set of medium models V21, V22, …, V2n which differ only with textures is useful. It allows us to organize their smooth replacement when approaching to the object from different directions. These textures can be obtained as screenshots of V3 from different points of transition.

 

Thus the scheme of substitution will look as follows:

V1®( V21, V22, …, V2n)® V3

 

The change of levels of detail is very useful because it solves at the same time two tasks: reduction of polygon number processed the browser simultaneously and improvement of the visual quality of object seen from different distances and different directions.

 

 

 

Fig.2. Virtual place of meetings: a view from afar to the central platform Two objects: the girl-guide and inquire desk are represented as V1 – with simple textured faces.

 

  

 

Fig.3 Virtual place of meetings: a close view. The girl-guide if full detailed avatar (V3). The inquiry desk is medium detailed (V2).

 

 2.4. BSP subdivision

 

The binary space-partitioning(BSP) three algorithm (3) is an extremely efficient method for calculating the visibility relationships  among a static group of 3D polynomials as seen from an arbitrary viewpoint. This is well-known technique for visible-surface determination. Applying this method for our case, we can divide the groups of static objects by vertical partitioning planes in a hierarchical order so that the whole scene space is split onto regions – leaves of the BSP tree in which the avatar may be located. Each region has a unique displaying priority for the groups of objects located in other regions, so we can sacrifice rendering objects in the regions of low priority. The invisible regions may even be absent in main memory and loaded only when the avatar intersects the partitioning plane (the loading results in some delay of rendering process). The cost of this approach is an initial preprocessing step – building the BSP tree. Unfortunately, the only known VRML viewer supports this useful facility: Blaxxun’s Community Client.

 

  1. SPEEDING UP DOWLOADING

 

3.1. Compression

 

VRML files are transferred through Internet in compressed (zipped) format: WRZ, and all VRML viewers have a build-in facility to decompress them while downloading. The text part of the file – the VRML code itself – is usually shrunk 20 times or more, as mainly consists of numbers. But texture part of the file is already represented in compressed format: GIF or JPEG and so it is not shrunk anymore. So, the more share of the file size take textures, the less compression rate is achieved. But both text and texture parts of VRML file can be additionally shorten with the techniques described in the following two subsections.

 

3.2. Cloning

 

Reuse of objects (DEF and USE keywords) is a powerful facility for reducing the source text of VRML program. Once specified, the similar objects can reuse the same code for each instance. There are usually many similar objects in the model of a building: columns, façade blocks, porches, etc. Moreover, even whole buildings that have no historical or cultural value may be cloned. Thus it is possible to reduce several times the size of the source text. This technique is apparently quite efficient for VRML worlds where flat-shaded models dominate.

 

3.3. Reducung texture size

 

Building VRML worlds of high visual quality requires texturing rather then flat shading, so the designers have to reduce the size of GIF or JPEG texture files as much as possible. First, this can be achieved by the reducing color depth in GIF format down to 4 bits (16 colors) or below. Low detailed textures, distinct contours and plane colors of surfaces (indexed palette) improve compressing power of GIF-format. As for LPEG format, it is preferable to use the smoothed images that are compressed better then ones with sharp details assuming the same information loss. For example, an image preprocessed with Blur filter, may be shrunk by JPEG compressor to twice shorter file, while its visual characteristics when viewing can even be improved.

 

Note that the texture size in pixels faintly has a weak influence on the size of the file. At the same time the browser may incorrectly display tinny, 1-2 pixel details of image. So, as example, too small texture size in pixels of fonts results in absolutely illegible text. It is enough to increase in 2-3 times the image size to solve this problem, while the size of the file increases insignificantly.

 

3.4. Managing loading sequence

 

VRML file to be downloaded is a collection text-coded nodes, mainly defining objects, and related texture files. By default the browser tries to download all objects and textures, which it finds in the project at once. In their number ones which are not needed for us at first and may be not needed at all although their loading takes too much time. In this connection the duty of programmer is providing the proper loading order: to load the object according as they needed only. It can be reached by use of Inline node with the value of url field, which value is defined dynamically from script.

 

  1. CONCLUSION: VRML PROGRAMMER’S ROLE

 

Usually initial 3D modeling is fulfilled by designers/artists with the aid of 3D editors, for example 3Dstudioo Max, which can export VRML format. Then the duty of a VRML programmer is to improve the resulting scene geometry and code all functionalities related to optimization of the scene and adding interactivity to it.

            Improving the scene geometry includes first of all careful removal all invisible faces from models. This evidently reduces the number of polygons and in addition, allows us to avoid artifacts related to blinking close planes with different colors. It is also necessary to calculate accurately bboxsize bboxcenter values of Group node for all composite objects. This will speed up rendering these objects. Management headlight and collision detection sometimes is expedient also. They should be dynamically switched on only as required. The frame rate strongly depends on these fields of NavigationInfo node.

            All optimization techniques described in the section 1-3 are surely duties of VRML programmer. It is reasonable to apply these ways jointly for building lifelike worlds. The main gain can be obtain by management with the number of polygons in the frame, mainly by restriction of visibility zone and by accurate use of levels of detail for all complex objects of scene. The consolidated gain in terms frame rate may be as much as 1.5-3 times.

 

  1. REFERENCE

 

1.      J.Hartman, Wernecke. The VRML 2.0 Handbook. Building Moving Worlds on the Web, Silicon Graphics Inc. 1996

 

More screenshots

ttp://www.e-spaces.com/lbw/Portfolio