Using Graph-Based Data Structures to Organize and Manage Scene

Using Graph-Based Data Structures to Organize and Manage Scene

d07wals.x.g2db Page 1 of 7 Thursday, April 4, 2002 8:47:50 AM HEAD: Understanding Scene Graphs DEK Using graph-based Bio data structures to Aaron is chairman of Mantis Development, and teaches computer graphics and In- organize and manage ternet/Web application development at Boston College. He can be contacted at scene contents [email protected]. Byline NOTE TO AUTHORS: PLEASE CHECK ALL URLs AND SPELLINGS OF NAMES CAREFULLY. Aaron E. Walsh THANK YOU. Pullquotes Before scene-graph programming Scene-graph models, we usually nodes represent represented scene objects in a scene data and behavior procedurally d07wals.x.g2db Page 2 of 7 Thursday, April 4, 2002 8:47:50 AM 2.1 cene graphs are data structures used 2.68 At the scene level, you concern your- – to organize and manage the contents – self with what’s in the scene and any as- – of hierarchically oriented scene data. – sociated behavior or interaction among – Traditionally considered a high-level – objects therein. Underlying implementa- 2.5 S – data management facility for 3D content, tion and rendering details are abstracted – scene graphs are becoming popular as – out of the scene-graph programming mod- – general-purpose mechanisms for manag- – el. In this case, you can assume that your – ing a variety of media types. MPEG-4, for 2.75 VRML browser plug-in handles low-level – instance, uses the Virtual Reality Model- – concerns. 2.10 ing Language (VRML) scene-graph pro- – – gramming model for multimedia scene – Nodes and Arcs – composition, regardless of whether 3D – As Figure 2 depicts, scene graphs consist – data is part of such content. In this arti- 2.80 of nodes (that represent objects in a scene) – cle, I’ll examine what scene graphs are, – connected by arcs (edges that define re- 2.15 what problems they address, and scene- – lationships between nodes). Together, – graph programming models supported by – nodes and arcs produce a graph structure – VRML, Extensible 3D (X3D), MPEG-4, and – that organizes a collection of objects hi- – Java 3D. 2.85 erarchically, according to their spatial po- – – sition in a scene. 2.20 Scene Composition and Management – With the exception of the topmost root – Scene graphs address problems that gen- – node (which defines the entry point into – erally arise in scene composition and – the scene graph), every node in a scene – management. Popularized by SGI Open 2.90 has a parent. Nodes containing other – Inventor (the basis for VRML), scene- – nodes are parent nodes, while the nodes 2.25 graph programming shields you from the – they contain are the child nodes (children) – gory details of rendering, letting you fo- – of their parent. Nodes that can contain – cus on what to render rather than how to – children are grouping nodes; those that – render it. 2.95 cannot are leaf nodes. Subgraph structures – As Figure 1 illustrates, scene graphs of- – in Figure 2 let a specific grouping of nodes 2.30 fer a high-level alternative to low-level – exist as a discrete and independently ad- – graphics rendering APIs such as OpenGL – dressed unit of data within the main scene- – and Direct3D. In turn, they provide an ab- – graph structure. Operations on the scene – straction layer to graphics subsystems re- 2.100 can be performed on all nodes in the – sponsible for processing, eventually pre- – graph, or they may be restricted to a par- 2.35 senting scene data to users via monitors, – ticular subgraph (scenes can therefore be – stereoscopic goggles/glasses, projectors, – composed of individual nodes as well as – and the like. – entire subgraphs that may be attached or – Before scene-graph programming mod- 2.105 detached as needed). – els, we usually represented scene data and – Scene graphs in Figure 2 resemble tree 2.40 behavior procedurally. Consequently, code – data structures when depicted visually. – that defined the scene was often inter- – Not surprisingly, trees are often used for – spersed with code that defined the pro- – scene-graph programming. The directed – cedures that operated on it. The result was 2.110 acyclic graph (DAG) data structure (also – complex and inflexible code that was dif- – known as an “oriented acyclic graph”) is 2.45 ficult to create, modify, and maintain — – commonly used because it supports node – problems that scene graphs help resolve. – sharing at a high level in the graph (nodes – By separating the scene from the op- – in a DAG can have more than one par- – erations performed on it, the scene-graph 2.115 ent) although typically at the expense of – programming model establishes a clean – additional code complexity and memory 2.50 boundary between scene representation – consumption. In a DAG, all nodes in the – and rendering. Thus, scenes can be com- – graph have a directed parent-child rela- – posed and maintained independent of rou- – tionship in which no cycles are allowed — – tines that operate on them. In addition to 2.120 nodes cannot be their own parent. – making things easier, this lets you create – 2.55 sophisticated content using visual author- – Graph Traversal – ing tools without regard for how work is – Scene-graph nodes represent objects in a – processed. – scene. Scene graphs used for 3D content, – Listing One is VRML code for a scene 2.125 for instance, usually support nodes that – consisting of a sphere that, when touched, – represent 3D geometric primitives (prede- 2.60 appears yellow. As you can see, the ob- – fined boxes, cones, spheres, and so forth), – jects and their behavior are represented – arbitrarily complex polygonal shapes, lights, – at a high level. You don’t know (or care) – materials, audio, and more. On the other – how the sphere is rendered — just that it 2.130 hand, scene-graph programming models – is. Nor do you know or care about how – for other forms of media might support – the input device is handled by the un- – nodes for audio/video content, timing and – derlying run-time system to support the – synchronization, layers, media control, spe- 2.67 “touch” behavior. Ditto for the light. 2.134 cial effects, and other functionality for com- d07wals.x.g2db Page 3 of 7 Thursday, April 4, 2002 8:47:50 AM 3.1 posing multimedia. 3.68 because only one of each type can be – Scene-graph programming models sup- – bound, or affect the user’s experience, – port a variety of operations through tra- – at any instant in time. – versals of the graph data structure that typ- – 3.5 ically begin with the root node (root nodes – Every VRML node has an associated – are usually the entry point for scene ren- – type name that defines the formal name – dering traversals). Graph traversals are re- – for the node —Box, Fog, Shape, and so – quired for a number of operations, in- 3.75 forth. Each node may contain zero or – cluding rendering activities related to – more fields that define how nodes differ 3.10 transformations, clipping and culling (pre- – from other nodes of the same type (field – venting objects that fall outside of the – values are stored in the VRML file along – user’s view from being rendered), light- – with the nodes and encode the state of – ing, and interaction operations such as 3.80 the virtual world) in addition to a set of – collision detection and picking. – events, if any, that the node can send or 3.15 Nodes affected by a given operation are – receive. When a node receives an event, – visited during a corresponding traversal. – it reacts accordingly by changing its state, – Upon visitation, a node’s internal state – which might trigger additional events. – may be set or altered (if supported) so 3.85 Nodes can change the state of objects in – that it reflects the state of the operation – the scene by sending events. A node’s im- 3.20 at that point in time. Rendering traversals – plementation defines how it reacts to – occur almost constantly with interactive – events, when it may generate and send – and animated graphics because the state – events, and any visual or auditory ap- – of affairs change as often as the user’s 3.90 pearance it might have in the scene. – viewpoint, necessitating continual scene- – VRML supports a Script node that fa- 3.25 graph queries and updates in response to – cilitates dynamic behaviors written in pro- – an ever-changing perspective. To increase – gramming languages such as ECMAScript, – performance, effect caching can be used – JavaScript, and Java. Script nodes are typ- – so that commonly applied operations use 3.95 ically used to signify a change in the scene – cached results when possible. – or some form of user action, receive events 3.30 – from other nodes, encapsulate program – Virtual Reality – modules that perform computations, or – Modeling Language (VRML) – effect change elsewhere in the scene by – VRML is an international Standard for 3D 3.100 sending events. External programmatic – computer graphics developed by the – control over the VRML scene graph is pos- 3.35 Web3D Consortium (formerly the VRML – sible via the External Authoring Interface – Consortium) and standardized by ISO/IEC. – (EAI). Currently awaiting final ISO stan- – The complete specification for ISO/IEC – dardization as Part 2 of the VRML97 Stan- – 14772–1:1997 (VRML97) is available at 3.105 dard, EAI is a model and binding for the – http://web3d.org/. – interface between VRML worlds and ex- 3.40 An Internet and web-enabled outgrowth – ternal environments. – of Open Inventor technology developed – All in all, the VRML Standard defines – by SGI (http://www.sgi.com/), VRML stan- – semantics for 54 built-in nodes that im- – dardizes a DAG-based scene-graph pro- 3.110 plementers, such as VRML browser plug- – gramming model for describing interactive – ins, are obligated to provide.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us