BS Contact VRML

Tips & Tricks

 


Introduction

This document provides information about Contact - VRML related tips

Node specific hints

ImageTexture

For faster loading of files, images should be prescaled to a power of 2 size ( 64, 128, 256, 512, 1024). The images need not to be square. Non-Power of 2 images need to be re-scaled to the nearest power, which is slower and might loose image quality.

For non-repeated textures, i.e. a Box or rectangle showing a complete image it is recommended to set repeatS FALSE repeatT FALSE in order to avoid the border scaling artifacts with bilinear texture filtering.

For texture heavy / non-Web applications the DDS texture format might be better, because the image can be stored in the compressed hardware formats (DXTX) and Mip-Map levels can be pre-authored.

As a general rule minimize texture switching improves throughput. Please note that several un-tiled images might be combined into one texture. The needed image part can be cut out using texture coordinates or texture coordinate transform.

 

MovieTexture

It is extremely important to set repeats FALSE repeatT FALSE in-order to avoid Movie image re-scaling to the nearest power of 2 size.

 

Appearance

If applicable its recommend to use DEF/USE as much as possible to reduce file size and run-time memory usage. For Appearance Material ImageTexture MovieTexture etc. its recommended at first.

A special optimization is used if subsequent rendering of geometry is using the same Appearance, ImageTexture etc. node.

Although not standard such resource could be predefine at the beginning of a file e.g. like

Group {

children [ DEF A1 Appearance { } DEF A2 Appearance { ...}

.... ]

}

Shape { appearance USE A1 }

As a sideffect in contact this influences also the order of texture downloading, first encountered - first loaded.

 

IndexedFaceSet

In Contact there are several code paths for handling IndexedFaceSet.

The ideal (close to the hardware path), is specifying only the coordIndex field and creaseAngle 3.14, leaving normalIndex texCoordIndex and colorIndex empty or default.

Adding these index fields or setting a creaseAngle below 3.14 or leaving the creaseAngle at the default value 0 results in a mesh, where vertex information need to be duplicated because a vertex may need separate per vertex normal, color or texCoord information.

As a general rule, the more faces per IndexedFaceSet the better for more hardware throughput. This could even mean batching a set of polygonal trees into one IndexedFaceSet instead of using multiple instances of a Textured Quad with extra Transform nodes.

Having very many IndexedFaceSet with few faces gives very bad throughput.

For large IndexedFaceSet however, where the user views parts of the mesh very close, or is inside, it is better for culling and selection processing to cut the dataset in spatially disjoint pieces.

solid TRUE is a recommend setting, solid FALSE should only be used if really need for open / two-sided objects.

Note: Contact computes vertex sharing for vertex normals (creaseAngle) by the index of the coordinate, Cosmo Player uses the actual coordinate values.

Note: Contact requires convex FALSE for non-convex faces, Cosmo Player always triangulates faces regardless of the convex setting.

It is wise to properly model geometry without coplanar faces. A rectangle inside a rectangle need to be modeled by subtracting the inner from the outer in a modeling tool. Simply stacking two faces on top of each other in the same plane results in z-buffer tearing due to the discrete sampling and checking of depth values among the triangles.

Contact renders geometry nodes if visited during rendering. Other implementations may ignore nodes like Appearance and geometry if they are not visited via a Shape node.

 

Grouping nodes

Geometry objects are tested for visibility against the view frustum. If the author specifies a bboxSize>=0 at a Group node level, a bounding box culling check is done for rendering, selection, terrain following and collision detection. Wrong bounding box values will result in wrong calculations, BS Contact currently does not update, checks or re-compute the bounding boxes. The CullGroup Group extension node automatically computes internally a bounding box for the children scene graph. For other culling support nodes see Cells & Portals and OctTree.

For Group nodes with complex content it is recommended to set the bboxSize. Also for Inline nodes it is strongly recommended, because culled Inlines are not loaded by default.

 

Navigation

If the user should walk trough geometry (like billboarded alpha textured grass) a Collision node with collide FALSE could be wrapped around.

Likewise if items should not be selected with the mouse a Selection node with select FALSE could be used.

For complex meshes selection and collision processing takes a serious amount of time. A proxy Object (coarse mesh, a bounding sphere etc.) could be set in the proxy fields of the Selection/Collision node to process such object more quickly.

Likewise a bigger proxy object could be used to make geometry more easier collidable or selectable.

User Interface

A classic method is to use a ProximitySensor and a Transform (Heads Up Display) to position user interface elements relative to the viewer. This method has several drawbacks, one important is that the z-buffer resolution is decreased, because the HUD geometry is normally very close to the viewer, but the scene geometry may start at a far distance. Another drawback is that the automatic computation of the center of rotation for the EXAMINE navigation mode gets enclosed the HUD geometry, what is confusing for the user.

For content targeted for Contact or MPEG-4 the Layer2D Layer3D nodes are recommend. Using these node the UI geometry are placed in independent overlayed screen rectangles.

For the classic VRML 2.0 approach its recommended to place the ProximitySensor before the Transform affected by the ProximitySensor, otherwise some slightly movement of the HUD geometry may be observed. Contact allows multi-instanced ProximitySensor, where this node placement is current needed. There is also the HUD Contact extension nodes, simplifying the classical HUD implementation.

Other notes

ProximitySensor and VisibilitySensor can be used to enable/disable costly Animations (TimeSensor.enabled) on the fly.

More costly animations are Scripts computing complex task per time step / fraction or CoordinateInterpolators.

NavigationInfo.visibilityLimit together with Fog can be used to adapt the performance by limiting the view.

For far a way views of scenes with a large extent NavigationInfo.avatarSize[0] need to be increased in-order to shift the z-near clipping plane towards the scene. This could be done by binding different NavigationInfo node for different view. The Direct X driver defaults to a 16-Bit Z-Buffer where z-tearing happens more quickly. In OpenGL 24-Bit Z-Buffer can be enabled.

In the fields NavigationInfo.avatarSize[3..5] a center of rotation for the examine mode can be provided.

 

Tools

Optimizing VRML content

The Chisel tool can optimize VRML files.
neeneenee maintains a good information site.

Parallelgraphics VRML Pad

Cosmo Worlds

Troubleshooting Direct X

Most problems related to Direct X are caused by outdated drivers. We recommend to download the latest drivers for the graphicsboard.

1) Using dxdiag:

From the Windows Desktop Start menu click run and enter DXDIAG, test all tabs of the dialog. On the Display tabs make sure to click on the DirectDraw and Direct 3D Test button.

2) Using dxcapsviewer

In case of major problems run the Direct X Capsviewer.

Here is a copy from the Microsoft Direct X7 SDK DXCAPSVIEWER7. You can save the diagnostic output and send it to Bitmanagement for troubleshouting.

 


© 2005 Bitmanagement Software - All rights reserved.