Download presentation
Presentation is loading. Please wait.
1
Introduction to VRML By Salman Yussof Diego Iglesias
2
What is VRML? VRML stands for Virtual Reality Modelling Language and is pronounced ‘vermil’. VRML stands for Virtual Reality Modelling Language and is pronounced ‘vermil’. n It is a standard for delivering 3D rendering on the net, just like HTML is a standard for web pages. n VRML is a subset of the Open Inventor standard developed by SGI for their graphics workstation.
3
The ‘World’ representation n VRML includes many of the things that go into making a world. It has a way of describing geometry which creates objects and spaces in which you can move around, as well as light, texture and sound which can be approached and viewed from whatever angle. n It is from this ‘worldly’ imitation that VRML files get their name. The files are called ‘worlds’ and have ‘.wrl’ extension.
4
VRML 1.0 n This is the first generation of VRML. n It describes the foundations of a world including geometry, lighting, color, texture and linking. n VRML 1.0 is designed to meet the following requirements: –Platform independence –Extensibility –Ability to work well over low-bandwidth connections n No support for interactive behaviors
5
VRML 2.0 n This is the current generation of VRML. n It has a richer level for interactivity and includes support for animation, spatial sound and scripting in addition to features that are already supported in VRML 1.0. n VRML Architecture Board made it official in March 1996
6
VRML97 n VRML 97 is the ISO standard for VRML n It is developed based on VRML 2.0
7
Features in VRML97 More realism in static worlds n Sound objects with controllable attenuation n An efficient system to describe irregular ground terrains n Extrusion objects for advanced but compact modelling n A more powerful background coloring and panorama system n A fog system allowing underwater and cloudy environments to be represented n The ability to use MPEG video as a texture map
8
Features in VRML97 Interaction from sensors: n Collision detection gives the user a sense of substance as they move in the world n Touch sensors allow reactions to a users deliberate actions n Proximity sensors allow reactions to a user’s not so deliberate actions n Visibility sensors allow conservation of resources
9
Features in VRML97 Motion, behaviors and beyond: n Interpolators provide engines to implement animation of any sort. n Scripting in JavaScript or Java allows everything from simple logic devices to fully blown analytical engines providing a wealth of complexity. n Prototypes extend the existing variety of object types with efficient reuse and simple scene graph structure. n A navigation information object provides the browser software with details of the speed and nature of the users movements in the world.
10
Writing VRML descriptions n VRML code is simply a text file, case sensitive n Header: –#VRML V2.0 utf8 n Comments indicated by ‘#’ sign n Terminology: –Nodes: a world is made up of nodes which are types of objects –Fields: describe properties of a node
11
Example #VRML V2.0 utf8 WorldInfo { title "Example 1" } DEF FBOX Shape { appearance Appearance { material Material { diffuseColor 0 0.5 0 } geometry Box { } Node Field (uses default values)
12
Shapes n Box –geometry Box {size 5.5 3.75 1.0} n Cylinder –geometry Cylinder {radius 0.5 height 10 top FALSE} n Cone –geometry Cone {bottomRadius 5 height 10 side TRUE bottom FALSE} n Sphere –geometry Sphere { radius 10,000,000} n Text & FontStyle
13
Materials n Material Node properties: –diffuseColor: The normal color of the object –specularColor: The color of highlights on shiny objects –emissiveColor: The object 'glows' with a light of it's own of this color. It doesn't cast light on any other objects though –ambientIntensity: The amount of ambient light that the object reflects –shininess: How reflective the object is –transparency: How transparent the object is. Note, some browsers will not support partly-transparent objects.
14
Transformations n Distances measured in meters (convention) n Angles measured in radians n Transformation types: –Translation, Rotation, and Scaling n Applied in following order (use nesting for custom) –Scale, then Rotate, the Translate n Example: Transform { translation 1 1 1 rotation 0 1 0 0.78 scale 2 1 2 children [ USE FBOX ]
15
Example 1 #VRML V2.0 utf8 Transform { children [ children [ NavigationInfo { headlight FALSE } # We'll add our own light NavigationInfo { headlight FALSE } # We'll add our own light DirectionalLight { # First child DirectionalLight { # First child direction 0 0 -1 # Light illuminating the scene direction 0 0 -1 # Light illuminating the scene } Transform { # Second child - a red sphere Transform { # Second child - a red sphere translation 3 0 1 translation 3 0 1 children [ children [ Shape { Shape { geometry Sphere { radius 2.3 } geometry Sphere { radius 2.3 } appearance Appearance { appearance Appearance { material Material { diffuseColor 1 0 0 } # Red material Material { diffuseColor 1 0 0 } # Red } } ] } ( … )
16
Example 2 #VRML V2.0 utf8 Transform { children [ children [ DEF Joe Shape { geometry Sphere {} } DEF Joe Shape { geometry Sphere {} } Transform { Transform { translation 2 0 0 translation 2 0 0 children DEF Joe Shape { geometry Sphere { radius.2 } } children DEF Joe Shape { geometry Sphere { radius.2 } } } Transform { Transform { translation -2 0 0 translation -2 0 0 children USE Joe children USE Joe } ]}
17
Example 3 #VRML V2.0 utf8 PROTO TwoColorTable [ field SFColor legColor.8.4.7 field SFColor topColor.6.6.1 ] { Transform { children [ Transform { # table top translation 0 0.6 0 children Shape { appearance Appearance { material Material { diffuseColor IS topColor } } geometry Box { size 1.2 0.2 1.2 } } Transform { # first table leg translation -.5 0 -.5 children DEF Leg Shape { appearance Appearance { material Material { diffuseColor IS legColor } } geometry Cylinder { height 1 radius.1 } } Transform { # another table leg translation.5 0 -.5 children USE Leg } Transform { # another table leg translation -.5 0.5 children USE Leg } Transform { # another table leg translation.5 0.5 children USE Leg } ] # End of root Transform's children } # End of root Transform } # End of prototype # The prototype is now defined. Although it contains a # number of nodes, only the legColor and topColor fields # are public. Instead of using the default legColor and # topColor, this instance of the table has red legs and # a green top: TwoColorTable { legColor 1 0 0 topColor 0 1 0 } NavigationInfo { type "EXAMINE" } # Use the Examine viewer
18
Example 4 Example 4 #VRML V2.0 utf8 DEF OpenVault Script { # Declarations of what's in this Script node: eventIn SFTime openVault eventIn SFBool combinationEntered eventOut SFTime vaultUnlocked field SFBool unlocked FALSE # Implementation of the logic: url "javascript: function combinationEntered(value) { unlocked = value; } function openVault(value) { if (unlocked) vaultUnlocked = value; }" } Shape { appearance Appearance { material Material { diffuseColor 1 0 0 } } geometry Sphere { } } Sound { source DEF Click AudioClip { url "click.wav" stopTime 1 } minFront 1000 maxFront 1000 minBack 1000 maxBack 1000 } DEF TS TouchSensor { } ROUTE TS.isOver TO OpenVault.combinationEntered ROUTE TS.touchTime TO OpenVault.openVault ROUTE OpenVault.vaultUnlocked TO Click.startTime
19
Additional Examples n Interpolation Interpolation n Interaction Interaction n Tour Tour n Distance Sensor Distance Sensor Distance Sensor n Graphics (1) Graphics (1) Graphics (1) n Graphics (2) Graphics (2) Graphics (2) n Graphics (3) Graphics (3) Graphics (3)
20
Acknowledgements n Example VRML code from –http://www.vapourtech.com/vrmlguide/ –http://www.web3d.org/Specifications/VRML97/part1/exampl es.html
21
References n VRML Consortium/Web3D –http://www.vrml.org/ n VRML repository: –http://vrml.sdsc.edu/ n VRML 1.0 Specification –http://www.vrml.org/VRML1.0/vrml10c.html n VRML 2.0 Specification –http://www.vrml.org/VRML2.0/FINAL/ n VRML97 Specification –http://www.web3d.org/Specifications/VRML97/
22
Examples n VRML97 Examples –http://www.web3d.org/Specifications/VRML97/part1/exampl es.html n 3D Web Graphics Using VRML Book Examples –http://www.iup.edu/~jacross/graphics/mybook.htmlx n Links to good examples: –http://www.3d-design.com/vrmlsite.html
23
Tutorials n VRML97 Tutorial –http://www.vapourtech.com/vrmlguide/ n VRML Works Tutorial –http://home.hiwaay.net/~crispen/vrmlworks/tutorials/index. html n Cosmo VRML Tutorial –http://cosmosoftware.com/developer/tutorials.html n VRML Repository Tutorial links –http://vrml.sdsc.edu/cgi- bin/display.cgi?category=Tutorials+-+VRML
24
Questions (and Answers) n Q: How to define the trajectory of the walk-through example? n A: There are two ways in which to implement the tour: –Using javascript to control the viewer’s camera position –Using VRML sensors, in particular the time sensor n The Tour example was implemented using the time sensor approach –An array of tour positions is defined together with a way to interpolate between them –A touch sensor determines when the timer is started –Each tick of the timer is routed to the position interpolator which sets a new orientation and translation
25
Tour Example DEF GuidePI PositionInterpolator { key [ 0, 0.2, 0.3, 0.5, 0.6, 0.8, 0.9, 1 ] keyValue [ 0 0 0, 0 0 -5, 2 0 -5, 2 6 -15 -4 6 -15, -4 0 -5, 0 0 -5, 0 0 0 ] } n Relevant source code DEF GuideRI OrientationInterpolator { key [ 0, 0.2, 0.3, 0.5, 0.6, 0.8, 0.9, 1 ] keyValue [ 0 1 0 0, 0 1 0 0, 0 1 0 1.2, 0 1 0 3, 0 1 0 3.5, 0 1 0 5, 0 1 0 0, 0 1 0 0, ] } DEF TS TimeSensor { cycleInterval 30 } # 30 second tour ROUTE StartTour.touchTime TO TS.startTime ROUTE TS.fraction_changed TO GuidePI.set_fraction ROUTE TS.fraction_changed TO GuideRI.set_fraction ROUTE GuidePI.value_changed TO GuideTransform.set_translation ROUTE GuideRI.value_changed TO GuideTransform.set_rotation
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.