This document provides information about implementation notes for specific VRML 97, supported nodes from MPEG-4, and Bitmanagment/blaxxun extensions nodes.
For compatibility with the VRML97 specification Annex F these extensions should not be used until really required for a specific problem solution. Often scripting code can be made compatible by using extensions only in javascript code branches checking first for Browser.getName() & parseFloat(Browser.getVersion()).
Extensions nodes are native implemented EXTERNPROTO's. For VRML 97 conformance, a PROTO definition for the extension node should be added in the following way (using the MenuSensor node as an example):
EXTERNPROTO MenuSensor[
exposedField SFBool enabled
exposedField SFString title
exposedField MFInt32 choices
exposedField MFString descriptions
exposedField SFString position
eventOut SFBool isActive
eventOut SFInt32 choice ] ["urn:inet:bitmanagement.de:node:MenuSensor",
"http://www.bitmanagement.de/vrml/protos/nodes.wrl#MenuSensor"]
If possible most nodes have an usefull fallback implementation. Also writing a custom fallback proto is possible.
All built-in nodes can be referenced using the EXTERNPROTO URN syntax "urn:inet:bitmanagement.de:node:NodeType", the interface of the native node is used, not the interface of the EXTERNPROTO statement. For compatibilty with BS Contact 4 and 5, the urn prefix urn:inet:blaxxun.com:node: is also recognized and supported.
Resources
Per default BS Contact computes a 3D representation for VRML Text nodes by getting True-Type outlines for each character and tessellates these into a set of triangles. This gives high quality text, but performance suffers due to the tessellation step and the high amount of triangles produced. VRML authors expressed the need for more flexible Font performance handling.
In BS Contact 4.3 there is the option of creating a textured rectangle for each character. The user first must supply a special Font texture in an ImageTexture node and sets the fontstyle family attribute to "TEXTURE".
In BS Contact 6.0 such a texture can be rendered on the fly. This way the texture is no more limitted to fixed width fonts and there is done some anialiasing to improve readability.
Using an ImageTexture for the font:
Shape { appearance Appearance { texture DEF FONTT ImageTexture { url "font512tr.gif" repeatS FALSE repeatT FALSE } material Material { diffuseColor 1 1 1 } } geometry Text { string [ "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ] fontStyle FontStyle { family ["TEXTURE"] justify "LEFT } } }
The Text attributes length and maxExtent, the FontStyle attributes size, spacing, leftToRight, topToBottom, justify and style = PLANE or ITALIC are implemented for TEXTURE text. The square texture map is divided into 16*16 cells for 256 different characters, the character 0 start in the upper left corner of the pixel image. The character width is scaled by 0.8. The Appearance node or Texture node should be reused between different text strings for speed. For special effects or fonts the texture map can be tuned. Using textures with alpha (or a transparent GIF) can give a transparent background. Using grayscale or black & white textures allows color changes using the Material diffuseColor.
Test Examples:
To further optimize the Text texture resolution and layout custom layout settings can be specified with up to 7 numbers after the family "TEXTURE" string. The format is "TEXTURE minChar maxChar cols rows aspect extraSpace shift"
minChar | minimal character code - default 0 |
maxChar | maximal character code - default 255 |
cols | number of characters per texture horizontal - 16 |
rows | number of character rows vertical - 16 |
aspect | float, default 0.8 - width scaling factor |
extraSpace | float, default 0.0 extra spacing between characters |
shift | float default 0, italic shift factor for top of character box |
If an application only needs a certain continous range of characters, the texture can be optimized for higher resolution characters (or sprites).
The standard polygonal Text has been changed in the following ways: The default resolution for Text size 1.0 has been reduced. Text size 0.1 produces a coarse Font contour approximation, 10.0 a higher approximation.
The FontStyle attribute "OUTLINE" produces only fast lineset outline characters. This option can be only enabled for BS Contact 4.3 and might cause an exception in Versions prior to BS Contact 4.3.
The FontStyle attribute "EXTRUDE" produces extruded 3D Text with a depth of 1.0. Please beware of the high Triangle count possibly produced. (e.g. use the size 0.1 option for a coarser outline tesselation.)
It is also possible to provide a Windows True Type font name in the family setting.
In BS Contact 6 text node strings need to be encoded in UTF8.
In BS Contact 4.4 the following Windows specific language codes are recognized : ANSI, DEFAULT, SYMBOL, SHIFTJIS, HANGEUL, HANGUL, GB2312, CHINESEBIG, OEM, JOHAB, HEBREW, ARABIC, GREEK, TURKISH, VIETNAMESE, THAI, EASTEUROPE, RUSSIAN, MAC, BALTIC
The FontStyle attribute "WEIGHT#number" allows to fine tune the font weight, typical values are 0.. 1000 where bold is 700.
Using on the fly rendering of the texture
When on-the-fly generation of the font texture is turned on, BS Contact creates an alpha channel texture that contains a bitmap of each possible letter. Each letter is represented by a rectangular face that references the characters cell in the texture. Besides the gain in performance and readability compared to polygonal text rendering, clicking the text becomes easier because of the rectangular cell for each letter. Nevertheless, due to the use of an alpha channel the background scene can be seen between the letters.
To activate on-the-fly texture generation as a world author, append "USE_TEXTURE" to the style field of the FontStyle node.
Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry Text { string [ "abcdefghijklmnopqrstuvwxyz" ] fontStyle FontStyle { family ["Verdana" "Helvetica" "SANS"] justify "LEFT" style "PLAIN USE_TEXTURE" } } }
The user can activate this feature as a default for all FontStyle nodes by checking "Use Textures for Text" in the "Performance options" tab of the Preferences dialog.
Example Scene
Select a font and a style on the left side. Use the mouse to rotate the
text in the center and the mouse wheel to zoom in and out. The page up and
page down keys select between predefined viewpoints.
Material transparency is blended with transparent textures or transparent gif's. This is not VRML compliant, but was a demand from content developers. See also the MultiTexture node for the option of blending Material color with Textures.
eventOut SFTime mediaTime - reports the current media time play time
eventOut SFVec2f imageSize - reports the current media video image size
Additonal fields for low level access :
Inline {
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField MFString url []
.. extended fields :
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
eventOut SFBool isLoaded # TRUE if loaded & parsed sucessfully
eventIn SFBool set_unload # send TRUE to unload Inline from memory
}
ImageTexture {
... standard fields
eventOut SFBool isLoaded # TRUE if media loaded, FALSE if can't be loaded
eventIn SFBool set_unload # , send TRUE to unload from memory
exposedField MFString
parameter [] # optional format conversion parameters. (6.0)
}
PixelTexture {
... standard fields
exposedField MFString parameter [] # optional format conversion parameters.
(6.0)
}
see scripting.
{
... standard fields
.. extended fields :
exposedField MFFloat avatarSize [0.25, 1.6, 0.75] # optionally append the center of rotation for EXAMINE mode. (6.0)
}
When avatarSize contains at least 6 numbers, the 4th, 5th and 6th of them specify the center of rotation of the EXAMINE navigation mode. As with all other parameters of the NavigationInfo node, they are interpreted in the coordinate system of the currently bound Viewpoint node.
If no center of rotation is specified in the avatarSize field, BS Contact uses its default strategy to find a center of rotation. This is the center of the worlds bounding box if the current viewpoint is outside of that bounding box and is the point on the geometry where the user clicked at when he/she began a movement.
Layer3D enables to render subscene in a rectangular area. The background can be a solid color or transparent.
Layer3D is usefull for scene composition and VRML user interfaces. Many problems with the current HUD practice are solved with Layer3D.
More discussion and examples are provided here.
A set of 2D MPEG-4 nodes provides easier UI design.
Layer2D, Transform2D, Bitmap, Rectangle, Material2D, CoordinateInterpolator2D, PositionInterpolator2D
CompositeTexture3D
Contact parses PROTO ROUTES EXTERNPROTO in all places a node value is expected.
IS mapping rules are relaxed, e.g. you can IS map from an exposedField to a field.
As part of our development efforts for Pentium?/sup> III support, we
have implemented NURBS technology in BS Contact 4.1. With NURBS, complex
3D curves can be represented with a minimum of data, allowing a new level of
visual display and animation quality for Internet-delivered 3D graphics.
To learn about Contact's NURBS development, including NURBS-related settings
in Contact, sample content, project results and our proposed NURBS extension
for VRML97, see the NURBS project overview
and the VRML NURBS proposal.
Trimmed NURBS extension nodes : Contour, Polyline2D, NurbsCurve2D, TrimmedSurface,
Conversion utility from OpenIventor NURBS format to VRML, see NURBS project
page for details. Trimmed NURBS support is not available in BS Contact 5.0. The Nurbs extension are added to a VRML 97 amendment.
With most modern 3D boards 2 textures can be combined per object in a single
path.
Particle Systems are allowing to create a variety of high polygonal rendering
effects specified & controlled using a few parameters.
Cells & Portals allows the visibility management of complex indoor enviroonments.
With a set of new nodes the world builder can handle device events from mouse,
keyboard, drag & drop. With the help of these nodes and an extended Viewpoint
control node a world builder can implement customized navigation and user interface.
Beginning with Contact 4.1, raw mouse and keyboard input can be intercepted
from javascript or an EAI eventOutObserver. In Contact 5.0 this functionalitz is supperceeded with the DeviceSensor and
KeyboardSensor. Events are reported via an SFNode Event node. This extension is modeled after the W3C
DOM Events. Setting an observer requires the addition of a route or an eventOutObserver
to the browser's SFNode eventOut event_changed. This is a code fragment for
adding the event observer: The following are the supported mask values: mousedown = 1 All input event properties are reported using only one Event node. The default
Browser eventHandling for that event can be turned off by setting the returnValue
to 0. The event types keypress, click, mouseover, and mouseout are currently
not supported. Test Example: Mouse /
Keyboard Input Test
Loading of Textures in the appearance node of a shape max be delayed until
the shape's geometry becomes visible.
In order to preload currently unneeded objects, ImageTexture / MovieTexture
/ AudioClip nodes can be directly specified as children of Groups. The ordering
of the nodes with url controls the download sequencing of the assets. The Appearance
/ Sound node references the asset by USE.
The BspTree or BspGroup node traverses child nodes nearer to the viewer first.
This would mean Inline parts nearer to the viewer are earlier loaded then further
away parts. Bsp - tree Parts outside the visibilityLimit (the viewing pyramid)
are not fetched. The drawback is that once a new section of the world becomes
visible there is some halting due to the decoding of image texture from harddisk
to video memory.
The LOD node display lower levels if the requested level is an Inline node,
currently not loaded.
A common request from content developers is to have more control over Resource
loading notification and unloading capabilities.
The inline nodes behaves as a group-node, the children field is exposed to
access the nodes of the inline. By observing children_changed a notification
is sent, once an Inline node is loaded and processed. This extened Inline version is described by the following prototype :
Inline { eventIn SFBool set_unload # new in 4.1, send TRUE to unload Inline
from memory ImageTexture { ... standard fields eventOut SFBool isLoaded # new in 4.1
This node extension is not VRML97 compatbile, so it should be used with care.
EXTERNPROTO Inline2[ ] ["urn:inet:bitmanagement.de:node:Inline","nodes.wrl#Inline2"]
For textures one method is to use a MovieTexture and observe the duration_changed
eventOut. Oberving the "last" asset, in file order can give a hint
of a world completely loaded event. A new method in Version 4.1 is the additional
eventOut SFBool isLoaded for ImageTexture. See also the new Browser.prefetch
function in the Script section.
Extension Nodes Protos:
List of Nodes:
Discussed in BspTree section :
BspGroup { # new BS Contact 3.051 Occlusion { Inclusion { MenuSensor displays a VRML defined Menu in the BS Contact right mouse button
popup menu MenuSensor { Example : menutest.wrl
New Nodes in version 3.051
Cullgroup is a group with an automatic bounding box computation for the children
scene graph. Usefull for early render culling of complex scene graphs (e.g.
Avatars)
CullGroup { Fog2
Fog2 is like fog with the additional parameter visiblityStart for linear fog.
Direct3D can not do exponential fog, linear fog starts per default at 0 in VRML
causing often a too early blending with the fog color.
Fog2 { HUD
HUD { This node equivalent to a VRML HUD construct using a Transform, ProximitySensor,
and Collision { collide FALSE }. Similar to a Collision node this node allows to give a mouse selection proxy
(e.g. large Rectangle for Text, bigger box for a fine detailed geometry) or
to turn off selection completely (e.g. in order to pick through transparent
shapes).
Layer3D
See Layer pages for details.
Instructs browser to do a cull checking operation on the scene graph, the
bounding box will be computed from children. Optionally if lod = TRUE lod levels
can be given, lod geometry is automatically scaled to the proper bounding box
of children. 4.4 Nodes DrawGroup DrawGroup is way for the content author to influence transparency processing.
Wrapping a set of geometry into DrawGroup { sortedAlpha FALSE children ...}
will process any geometry even transparent ones in the exact order given by
children. This can be used for mirror like effects or turn off delayed alpha
blending for sets of geometry with f bi-level transparency only. drawOp is not
yet supported and is intended in the future for certain drawing effects. Cell & Portals see Cell & Portal proposal Particles see see particles system page
Multi Texturing
Particle Systems
BSP Tree (Binary Space Partitioning Tree)
BS Contact supports a BspTree node for optimal rendering performance
of large worlds. For technical information see the BSP-Tree
information.
Cell & Portals
Generic Input handling
Raw Mouse & Keyboard input
Event
{
eventOut SFString type
eventOut SFBool cancelBubble
eventOut SFBool returnValue
eventOut SFVec2f screen
eventOut SFVec2f client
eventOut SFVec2f position
eventOut SFBool altKey
eventOut SFBool ctrlKey
eventOut SFBool shiftKey
eventOut SFInt32 keyCode
eventOut SFInt32 button
}
type
type
property
represents the event name as a string property.
cancelBubble
cancelBubble
property is used to control the bubbling phase of event flow. If the
property is set to true, the event will cease bubbling at the current level.
If the property is set to false, the event will bubble up to its parent. The
default value of this property is determined by the event type.
returnValue
returnValue
property is
checked by the DOM implementation after the event has been processed by
its event handlers. If the returnValue
is false, the DOM
implementation does not execute any default actions associated with the
event.
screen
screen.x
indicates the horizontal coordinate at which
the event occurred relative to the origin of the screen coordinate system.
screen.
y
indicates the vertical coordinate at which the event occurred relative to
the origin of the screen coordinate system.
client
client.x
indicates the horizontal coordinate at which the
event occurred relative to the DOM implementation's client area.
client.y
indicates the vertical coordinate at
which the event occurred relative to the DOM implementation's client area.
position
position
.x
indicates the
horizontal coordinate at which the event occurred relative to the DOM
implementation's normalized client area.
position
.y
indicates the vertical coordinate at which the event occurred relative to
the DOM implementation's normalized client area.
altKey
altKey
indicates
whether the 'Alt' key was depressed during the firing of the event.
ctrlKey
ctrlKey
indicates
whether the 'Ctrl' key was depressed during the firing of the event.
shiftKey
shiftKey
indicates
whether the shift key was depressed during the firing of the event.
keyCode
keyCode
holds the virtual key code value of the
key which was depressed if the event is a key event. Otherwise, the value is
zero. Currently the raw Win32 keycode is reported.
button
button
is used to indicate which mouse button changed state.
This is a bitmask with the values 1 for left button, 2 for right and 4
for middle. During a buttonup event, the mask of the button causing the
event is reported.
function initialize() {
// tell what events
m=Browser.eventMask;
oldMask=m;
m = m |(1<<4) | 1; // mouse up & down
Browser.eventMask = m;
// add event observer
Browser.addRoute(Browser,'event_changed',inputHandler,'onEvent');
}
mousemove =
1<<1
mouseout = 1<<2
mouseover = 1<<3
mouseup =
1<<4
keydown = 1<<5
keyup = 1<<6
keypress =
1<<7
click = 1<<8,
dblclick = 1<<9
This is a code fragment for the event callback handler:DEF inputHandler Script {
eventIn SFNode onEvent
url "javascript:
function onEvent(e,t) {
if (e.type == 'mousemove' && e.button == 0) {
return; // to many prints
}
print('Event type='+e.type+' at='+t);
print(' button='+e.button+' shiftKey='+e.shiftKey+' ctrlKey='+e.ctrlKey+' altKey='+e.altKey);
print(' position='+e.position+' keyCode='+e.keyCode+' ctrlKey='+e.ctrlKey+' altKey='+e.altKey);
if (e.type == 'mouseup' && e.button == 2) { // test we want to handle rbutton menu
e.returnValue = 0;
}
} "
}
Controlling download
BS Contact fetches URL objects and EXTERNPROTO's in the order encountered
during scene graph traversal, in the order top to bottom of file, depth first.
Currently not needed objects, because not "visible" due to a Switch, LOD or
BspTree node are only retreived if they become part of the visible scene graph.
The additional eventOut SFBool isLoaded indicates loading success, TRUE is sent
if the inline node is loaded and children are loaded, FALSE is sent if the inline
node's url couldn't be retreived or there was some other problem with the data.
In addition set_unload can be used to unload an Node from memory, however the
application should normally use this if its shure that the node is currentlly
not part of the visible node subsets (i.e. out of viewfrustrum, not in traversed
scene graph etc.)
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField MFString url []
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
eventOut SFBool isLoaded # TRUE if loaded & parsed sucessfully
}
eventIn SFBool set_unload # new in 4.1, send TRUE to unload from memory
}
It is possible to add an proper Externproto definition or using script code
checking the browser version :
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField MFString url []
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
eventOut SFBool isLoaded
eventIn SFBool set_unload
BspTree {
exposedField SFRotation plane 0 0 1 0
field SFNode front NULL
field SFNode overlap NULL
field SFNode back NULL
}
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
eventOut SFNode bspTree
}
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField SFBool enabled TRUE
exposedField SFNode proxy NULL
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
eventOut SFBool isActive
eventOut SFTime enterTime
eventOut SFTime exitTime
}
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField SFBool enabled TRUE
exposedField SFNode proxy NULL
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
eventOut SFBool isActive
eventOut SFTime enterTime
eventOut SFTime exitTime
}
on activation of a menu entry, the corresponding choice value will be sent as
eventOut choice
a choices value of -1 indicated a menu separator
exposedField SFBool enabled TRUE # TRUE menu enabled,
FALSE disabled
exposedField SFString title "" # title
for submenu entry
exposedField MFInt32 choices [] # list of
numbers
exposedField MFString descriptions [] # description
for each menu entry
exposedField SFString position "" # "TOP" menu appears at the
top of the BS Contact menu
eventOut SFBool isActive
eventOut SFInt32 choice #
associated choices number for user selected menu entry
}
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
}
exposedField SFColor color 1 1 1
exposedField SFString fogType "LINEAR"
exposedField SFFloat visibilityRange 0
exposedField SFFloat visibilityStart 0
exposedField SFFloat density 1
eventIn SFBool set_bind
eventOut SFBool isBound
}
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
}
Children are displayed relative to the viewer and not relative to the avatar
position in 3rd person viewing mode.
Selection {
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField SFBool collide TRUE # as in Collision node
exposedField SFBool select TRUE # if false, children are not existing for Anchor / dragsensor selection
exposedField SFNode proxy NULL # proxy used for selection processing as well
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
}
Layer3D {
exposedField SFVec3f bboxSize -1 -1 -1
exposedField SFVec3f bboxCenter 0 0 0
eventIn MFNode addChildrenLayer
eventIn MFNode removeChildrenLayer
exposedField MFNode childrenLayer []
exposedField SFVec2f translation 0 0
exposedField SFInt32 depth 0
exposedField SFVec2f size -1 -1
exposedField SFNode background NULL
exposedField SFNode fog NULL
exposedField SFNode navigationInfo NULL
exposedField SFNode viewpoint NULL
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
}
CullGroup{
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
# 4.3
exposedField SFBool lod FALSE
exposedField MFNode level [] #unlike LOD level 0 is already the children content
exposedField MFFloat range [] # same length as level
}
DrawGroup[
exposedField SFVec3f bboxSize -1 -1 -1
exposedField SFVec3f bboxCenter 0 0 0
exposedField SFBool sortedAlpha TRUE
exposedField MFNode drawOp []
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
]
Cell {
exposedField SFVec3f bboxSize -1 -1 -1
exposedField SFVec3f bboxCenter 0 0 0
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
exposedField MFNode portals []
}
Portal {
exposedField SFBool enabled TRUE
exposedField SFBool ccw TRUE
exposedField SFNode coord NULL
exposedField SFNode cell NULL
}
CellGroup {
exposedField SFVec3f bboxSize -1 -1 -1
exposedField SFVec3f bboxCenter 0 0 0
exposedField SFInt32 range -50
exposedField MFNode cells []
exposedField MFNode children []
eventIn MFNode addChildren
eventIn MFNode removeChildren
eventOut MFNode activeCells
}
PROTO Particles {
exposedField SFVec3f bboxSize -1 -1 -1
exposedField SFVec3f bboxCenter 0 0 0
exposedField SFFloat lodRange 100
exposedField SFBool enabled TRUE
exposedField SFFloat particleRadius 0.1
exposedField SFFloat particleRadiusVariation 0
exposedField SFFloat particleRadiusRate 0
exposedField SFNode geometry NULL
exposedField SFVec3f emitterPosition 0 3 0
exposedField SFFloat emitterRadius 0
exposedField SFFloat emitterSpread 0.25
exposedField SFVec3f emitVelocity 2.5 5 2.5
exposedField SFFloat emitVelocityVariation 0.5
exposedField SFRotation emitterOrientation 0 1 0 0
exposedField SFFloat creationRate 500
exposedField SFFloat creationRateVariation 0
exposedField SFInt32 maxParticles 500
exposedField SFTime maxLifeTime 5
exposedField SFFloat maxLifeTimeVariation 0
exposedField SFVec3f gravity 0 -9.8 0
exposedField SFVec3f acceleration 0 0 0
exposedField SFColor emitColor 1 1 1
exposedField SFColor fadeColor 0.25 0.25 0.25
exposedField SFFloat fadeAlpha 1.0
exposedField SFFloat fadeRate 0.25
exposedField SFInt32 numTrails 0
exposedField SFInt32 numSparks 0
exposedField SFVec3f sparkGravity 0 -5 0
exposedField SFColor sparkFadeColor 0 0 0
}
Related links: