VRML - Virtual Reality Markup Language An Introduction to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Virtual Reality Markup Language An Introduction to VRML & Modeling Shapes, Geometry, Colour Introduction The Virtual Reality Modeling Language A file format for describing interactive threedimensional objects and worlds (a model of a 3D space, which can contain 3D objects, lights, and backgrounds). Is an open, extensible, industrystandard scene description language (human readable) for 3D scenes, or worlds, on the Internet Introduction Objects can be built from solid shapes, from text, or from primitive points, lines, and faces. Objects have optical material properties which affects how they interact with the lights in the world; they can also have textures (2D patterns) applied to them. Introduction Objects can be grouped into more complex objects, used multiple times, translated, and rotated. Objects can trigger events, which can be routed to other events or to scripts written in JavaScript or Java. Within VRML you can trigger sounds, move objects along paths, and link to HTML or VRML targets. In JavaScript or Java you can manipulate VRML object properties programmatically and even generate new objects. Application VRML can be used to create: interactive 3D games, simulations of real or imagined devices and buildings or even cities for walk throughs, interactive visualizations of scientific data, advertising banners, art, music, and much more. VRML File VRML is: A text file format A simple language for describing 3D shapes and interactive environments A web standard VRML is endorsed by: Most 3D graphics vendors Most web browser vendors Introduction VRML 1.0 supports worlds with relatively simple animations VRML supports complex 3D animations, simulations, and behaviors by allowing Java and JavaScript programmers to write scripts that act upon VRML objects Writing and Viewing VRML Files You can write VRML files using: You can view VRML files using: Any text editor (e.g. notepad) Many world builder applications A VRML browser A VRML plugin to an HTML browser VRML syntax at: http://www.sdsc.edu/~nadeau/Talks/NASA_EOSDIS/s yntax.htm To install VRML plugin refer to: http://cic.nist.gov/vrml/vbdetect.html http://cic.nist.gov/vrml/cosmoplayer.html Language Capabilities Built in geometric primitives including face sets and solids Lighting, material, texure, movie control Spatialised sound Absolute time for animations The concept of an avatar to allow collision detection Hyperlinking, viewpoints and navigation methods The ability to extend the language through prototyping Event handling to detect when geometry is interacted with in some way Routing of events to allow one object to affect another Scripting in various languages which allows logic in the world VRML Concepts - Nodes The VRML scene is composed of nodes and routes Each node can have the following: A unique name for routing or reuse A type A number of associated events both incoming and outgoing A number of fields which hold the data for the node VRML Concepts Nodes VRML files describe a scene graph structure which is parsed by a browser. The browser may be a plugin for a web browser or a helper application. The scene graph is composed of nodes which fall into two categories, grouping nodes and others. These nodes may have routes between them, which define the possible interactions of one node with another. Nodes have fields which define what actual values the node has associated with it. VRML Concepts Group Nodes Group nodes can have many other nodes as children The list of grouping nodes is: Anchor Billboard Collision Group All nodes in the scene should be children Typical syntax is: <Grouping Node> { children [ <other nodes> ] <field> <field> . . . } VRML Concepts Transform Node Positioning of objects in the world is achieved through the transform node The transform node applies scales, rotations and translations to its children These are applied in the order: scale, rotate, translate To achieve complex repeated transforms, transform nodes may be nested The center field may be used to specify scales and rotations about points other than 0 0 0 However, negative scaling (for reflection) is forbidden Nested transforms could be very expensive for a browser to calculate VRML Concepts - Sensor Node Sensors can be thought of in two categories, those associated with geometry and one for sensing time. The list of sensors is: CylinderSensor PlaneSensor ProximitySensor SphereSensor TouchSensor VisibilitySensor TimeSensor VRML Concepts Sensor Node The sensors can respond to various conditions such as proximity to an avatar, mouse clicks, mouse movement or whether an object is in the field of view of the user. Cylinder, sphere and plane sensors move the geometry associated with them when they are active Do not place a sensor in the same transform node as the geometry as this can result in undefined behaviour. VRML Concepts - Interpolator Nodes Each interpolator node has a set of keys and a set of keyValues The keys are numbers between 0.0 and 1.0 which represents a fraction over the interval (0.0..1.0) Each key must have an associated keyValue of the type of the interpolator When a set_fraction eventIn is received, the values are interpolated to get the correct value_changed eventOut. Think of these interpolators as key frame animators for different fields There is no integer interpolator in VRML! The value_changed eventOut is usually routed to a field of a named node to change something that is drawn, however it could be routed to a script node for further processing VRML Concepts - Interaction Model Interacting with VRML worlds or animating them will cause events to be generated. These are sent from one node to another node VRML Concepts - Bindable Node Certain nodes have a stack associated with them onto which they may be pushed and popped The node at the top of this stack is applied to the scene (there is always a default) The set_bind event sent to a bindable node, pushes or pops it The list of bindable nodes is: Background Fog NavigationInfo Viewpoint VRML Building Blocks Shapes are the building blocks of a VRML world Primitive Shapes are the standard building blocks: Box Cone Cylinder Sphere Understanding Shapes Shape nodes describe: Shape { geometry . . . appearance . . . } geometry form, or structure appearance color and texture Building Primitive Shapes Specifying Geometry Shape geometry is built with geometry nodes Standard, primitive geometry nodes include: Box { . . . } Cone { . . . } Cylinder { . . . } Sphere { . . . } Building Primitive Shapes - Setting Geometry Dimensions Geometry node fields control dimensions Box { size 2.0 0.5 3.0 } Dimensions are usually in meters, but they can be anything Cone { height 3.0 bottomRadius 0.75 } Cylinder { height 2.0 radius 1.5 } Sphere { radius 1.0 } Building Primitive Shapes - A Sample Primitive Shape #VRML V2.0 utf8 Shape { appearance Appearance { material Material { } } geometry Cylinder { height 2.0 radius 1.5 } } Building Primitive Shapes Understanding Groups Group nodes describe: children a list of member nodes for the group Group { children [ . . . ] } A Sample Group #VRML V2.0 utf8 Group { children [ Shape { . . . }, Shape { . . . }, . . . ] } Find More at : http://www.inrialpes.fr/sherpa/people/genoud/ Speinf/SupportsCours/IntroToVRML2.0/shape s13.htm VRML Space The VRML building space is threedimensional, described by an X axis (left to right), Y axis (bottom to top) and Z axis (from the back of the space (away from you) forward (toward you)). X is positive to the right Y is positive upward Z positive toward you in the space You can specify where the browser begins building and where it moves in this space using X,Y, and Z values to specify 3D coordinates VRML Route Circuits can be constructed by building routes between nodes. A route connects the eventOut of one node to the eventIn of another node. The first node can then send events to the second, causing the second node to react. Building Primitive Shapes Summary Shapes are built using a Shape node Shape geometry is built using geometry nodes, such as Box, Cone, Cylinder, and Sphere Nodes can be grouped using a Group node Dimensions are usually in meters, but they can be anything #VRML V2.0 utf8 Group { children [ Shape { } }, Transform { translation 0.0 2.0 0.0 children Shape { appearance USE Brown geometry Cone { height 2.0 bottomRadius 2.5 } } } appearance DEF Brown Appearance { material Material { diffuseColor 0.6 0.4 0.0 } } geometry Cylinder { height 2.0 radius 2.0 } Lab Exercise 1 Build the following virtual objects: A tree comprises of a cylinder and a cone A traffic light EMBEDDING VRML INTO YOUR HTML DOCUMENT Once you have created your VRML world, you can embed it within an HTML document by using the <EMBED> tag. Using the <EMBED> tag to place a VRML world in an HTML document is similar to using the <IMG> tag to place a 2D image in an HTML document. For example, the following example embeds a VRML file called example.wrl into an HTML document: <EMBED SRC="example.wrl" WIDTH=128 HEIGHT=128 BORDER=0 ALIGN=middle> References Introduction to VRML 2.0 http://www.inrialpes.fr/sherpa/people/genoud/Speinf/Supports Andrea L. Ames et al. (1997) VRML Sourcebook 2.0. Introduction to VRML http://mheller.com/vrml.htm VRML subject tutorial http://deslab.mit.edu/DesignLab/courses/13.016/visualization/ Beginners Guide to VRML http://wp.netscape.com/eng/live3d/howto/vrml_primer_index.h VRML Repository at www.sdsc.edu/vrml ...
View Full Document

This note was uploaded on 02/06/2012 for the course FACULTY OF WXGE6320 taught by Professor Noraini during the Winter '09 term at University of Malaya.

Ask a homework question - tutors are online