Post on 05-Jan-2016
Virtual Reality Modeling Language 9
7
What’s VRML?
•Virtual Reality Modeling Language2D/3D graphicsAudio: .wav, .midVideo: MPEG-1Interactivity: time- and action-basedHyperlinksJava
•VRML97 International Standard (IS) ISO/IEC 14772-1:1997
Basic Concepts
•VRML File StructurePrototypesScene GraphEvent Routing
•A VRML browser
VRML File Structure
• A VRML file contains#VRML V2.0 utf8
# A sample VRML 97 file
Prototypes
Scene graph
Event routing
Prototypes
• Provides a capability to extend VRML node types
• Can reuse defined nodes– e.g., defines different chairs, tables, etc.
Scene Graph
• A hierarchical structures for nodes
• Good for transformations
• Good for event generation and routing
Event Routing
• For interactivity
• User, time, or script triggered
• Routing path defined by authors– e.g., collide --> alarm --> crash --> ...
A VRML Browser
Parser
prototypesbuilt-in nodes
World
routing pathscene graph
Audio/Visual Presentation
VRML file user input
user
Node Reference
(1) Group Nodes (2) Coordinates
(3) Anchor (4) Sound
(5) Sensor (6) Interpolator
(7) Script
Group Nodes
• Transformations, events, etc. occur within a group
• Includes:• Group: all children
• Transform: all children, new coordinate
• Switch: one child
Group {children [
Shape { … }Shape { … }...
]}
Coordinates
Transform { # X Y Z translation 2.0 0.0 0.0 children [
Shape Cylinder {radius 1.0height 1.0
}, ]}
Anchor
• A group node
• Select any child in the group jumps to a new VRML file
Anchor { url "stairway.wrl" } description "Floating Stairs" children [ . . . ]}
Sound
• AudioClip: signal source
• Sound: place to play
Sound { source AudioClip { url "bach.wav" description ”music" loop TRUE startTime 1 stopTime 0 }, location 0 0 0 minFront 10 minBack 10 maxFront 40 maxBack 40 spatialize TRUE },
Sensor
• Generated from depressed buttons, collision, timer, etc.
• Define a route path to trigger other nodes
• Each node has eventIn and eventOut interfaces
A B
out
in
Interpolator
PositionInterpolator { key [ 0.0, 0.5, 1.0 ] keyValue [ 0.0 0.0 0.0, 3.0 0.0 0.0, 0.0 0.0 0.0 ]}
• Given a fraction [0..1], interpolate a new value– e.g., given 0.3 --> key = 0.3 --> keyValue =
(0.0+3.0)/0.5*0.3 = 1.8, i.e., (1.8, 0.0, 0.0)
Script { field … eventIn …set_zzz eventOut … xxx_changed url "circle.class"or... url "circle.js"or... url "javascript: ..."}
Script
• Extend VRML’s capabilities to more complex objects/behaviors
References
• Official site: www.vrml.org
• VRML repository: www.sdsc.edu/vrml
• Industry:– vrml.sgi.com– www.intervista.com– www.microsoft.com/vrml