Download presentation
Presentation is loading. Please wait.
1
© De Montfort University, 20041 3D Graphics and VRML Howell Istance and Chris Hand* De Montfort University * now at http://fuji.computing.dundee.ac.uk/~chris/
2
© De Montfort University, 20042 3D COMPUTER GRAPHICS Co-ordinates, Lines and Polygons Specify a point in space using (x,y,z) co-ordinates Lines join points Lines form polygons Polygons are shaded with a colour Scenes may include lights – effect on shading needs to be calculated Virtual Camera (user’s “eye”) has a position in space
3
© De Montfort University, 20043 3D Scene…
4
© De Montfort University, 20044 Web 3D Describes any programming or descriptive language that can be used to deliver interactive 3D objects and worlds across the internet Consortium www.web3d.orgwww.web3d.org Includes open languages –VRML –Java3D –X3D (under development) Includes proprietary (closed) languages as well
5
© De Montfort University, 20045 VIRTUAL REALITY MODELLING LANGUAGE - VRML Born in 1994, intended to allow 3D and Virtual Worlds over the Internet Specification of a file-format as an open standard –VRML 1.0 spec - May 1995 –VRML 2.0 - August 1996 –VRML97 (ISO/IEC 14772-1) - October 1997
6
© De Montfort University, 20046 USES OF VRML 1.Specifying 3D Objects and Worlds in a platform independent way – useful as an open interchange format (cf. Proprietary standards such as.DXF) …many 3D modelling packages (e.g 3D Studio) will export to VRML format 2.Creating interactive 3D content for delivery over the Internet, intranets or CD-ROM etc. Pure 3D applications: interactive 3D maps, training, games… 3D user interfaces to web sites, databases… Web advertising - lightweight, interactive 2D/3D banner ads Multi-user 3D worlds (via VRML extension mechanisms)
7
© De Montfort University, 20047 Building a VRML World Collection of objects arranged in a particular order Objects correspond to something physical that has shape, various surface properties (colour, smoothness, shininess) and a position in 3D space other objects include sounds, lights, viewpoints, all of which have a location in 3D space
8
© De Montfort University, 20048 Nodes Fundamental building blocks, some nodes are objects, some nodes are containers to hold nodes which are related –e.g. Shape node contains geometry node and appearance node Geometry - definition of shape, predefined nodes include Cylinder, Box, Sphere, user defined shape represented as an indexed faceset (collection of numbered coordinates and specification of connectivity) Appearance - contains Material node - definition of surface properties of an object, colour, texture, shininess
9
© De Montfort University, 20049 Grouping Nodes Transform - specifies how a group of children nodes may be translated, rotated or scaled –translation field takes a single vector as its value, showing the amount to move in the x, y and z direction VRML coordinate system +x points to the right +y points up +z points out of the screen
10
© De Montfort University, 200410 Scene Graph hierarchical data structure containing nodes, built by browser as the file is loaded, enables groups of nodes to be manipulated by applying transforms to parent nodes which affect all children nodes
11
© De Montfort University, 200411 Fields and Data types Single Value Field Types - prefixed with SF(SFColor, SFFloat, SFString) - spec shows field, data type, identifier, default value Transform { …. exposedField SFVec3f translation 0 0 0 … } Material{ …. ExposedField SFColor diffuseColor 0.8, 0.8, 0.8 … } Multiple-valued Field types - prefixed with MF (MFColor, MFFloat, MFString) - essentially arrays of values
12
© De Montfort University, 200412 MULTIMEDIA SUPPORT Text –Use Text and fontStyle nodes –Control over font face,size, spacing, horizontal/vertical alignment and direction Bitmapped images –Support for Texture maps via ImageTexture node –Mono/Greyscale/RGB/RGB+Alpha (opacity) –Plug-ins/Browsers generally support PNG, JPEG and (usually) GIF formats
13
© De Montfort University, 200413 MULTIMEDIA SUPPORT Audio –Sound node with AudioClip node –Digital Audio - support for.WAV (uncompressed PCM) required by spec –MIDI type 1 file support recommended (general MIDI) –Audio is spatialised in 3D Video –MPEG-1 files (video or video+sound) supported as texture maps using MovieTexture node Animation –Extensive support for keyframe animation in 2D and 3D using timers (TimeSensor) and various “interpolators” –Properties of objects that may be animated include Position, Orientation, Colour and Transparency
14
© De Montfort University, 200414 Responding to user actions - events, sensors and scripts In addition to data fields, nodes can contain event fields Events typically used to change things –object position or orientation –material properties (colour, transparency) –switching things on/off EventIn - events which the node can respond to EventOut - events which the node can generate
15
© De Montfort University, 200415 Event Routing nodes are 'wired' together with ROUTE statements (i.e cause the event generated by node1 to trigger a response in node2 ) eventOut and eventIn must be of the same type (e.g.SFBool)
16
© De Montfort University, 200416 Event Graphs Nodes and routes form an Event Graph Each event has a time-stamp and a value, which depends on the type of the event e.g. SFVec3f: (time format is number of seconds since 1-Jan-70) x0.0 y32.5 z10.5 time8881181495
17
© De Montfort University, 200417 SENSOR NODES Events usually originate from sensors Environmental sensors Collision ProximitySensor TimeSensor VisibilitySensor Pointing Device Sensors Anchor TouchSensor Drag Sensors CylinderSensor PlaneSensor SphereSensor
18
© De Montfort University, 200418 Example of a Sensor The code in World3.wrl defines a box located 5 units to the right of the origin, which is equipped with a touchsensor the DEF reserved word allows a node to named, for reference in other nodes or statements The generated event from touchBox can be routed another node for processing ROUTE touchBox.isActive TO node2.eventIn
19
© De Montfort University, 200419 Typical Uses TimeSensor – Animations Drag Sensors – manipulating objects (translate, rotate) ProximitySensor, VisibilitySensor – Efficiency, reacting to user presence Anchor, TouchSensor – buttons, signposts Nodes (often grouped with other nodes) which generate events in response to user behaviour –ProximitySensor defines an area which generates an IsActive event when the user enters the area –TouchSensor generates an IsActive event when 'touched' by a mouse-click
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.