scene graphs scene representation
play

Scene Graphs Scene Representation How does one describe the objects - PDF document

Scene Graphs Scene Representation How does one describe the objects in a 3D scene? Scene Graphs 1 Scene Modeling Languages / API From the low level to the high level State Machine Model -- OpenGL Graph Based Scene Languages


  1. Scene Graphs Scene Representation  How does one describe the objects in a 3D scene?  Scene Graphs 1

  2. Scene Modeling Languages / API  From the low level to the high level  State Machine Model -- OpenGL  Graph Based Scene Languages  Inventor  VRML  True Object Oriented Model Languages  GROOP State Machine Model API  State Machine Model  Current “state” of rendering is maintained in global variable or stack.  Material properties  Object transformation matrix  Lights / Camera parameters  Much like a “graphicsContext” 2

  3. State Machine Model API  Open GL  Originally designed as an API for SGI’s rendering hardware  Very low level “C” programming library  Includes:  Scene modeling  Rendering  Animation  Some rudimentary and low level interactivity State Machine Model API  OpenGL - scene modeling  Objects  only knows about polygons (different kinds of polygons, but just polygons)  Polygons are specified by vertex list  You are responsible for definition of normal vector. 3

  4. State Machine Model API  OpenGL  Transformations  Routines for scaling, translation, and rotation  Routines for direct manipulation of transformation matrix  Maintains a stack of transformation matricies for support of object hierarchy State Machine Model API  OpenGL  Models a state machine. Maintains current:  Color  Transformation (transformation stack)  Material properties  New polygonal objects will use current color, transforms and materials. 4

  5. State Machine Model API  Open GL  Summary  Low level “C” interface  Polygonal model  State machine  Transformation Stack  Other State Model specs  RenderMan (RIB) Scene Graphs  Scene is represented by a tree structure (scene graph)  Scene graph is passed to a viewer which is responsible for rendering  Basis for VRML and Java3D 5

  6. Scene Graphs  Inventor  Object oriented wrapper around GL  Not a truly Object Oriented scene representation.  Originator of the scene graph  Implemented as C++ library with associated file format. Scene Graphs  Inventor  Scene is represented by a tree structure (scene graph)  Scene graph is passed to a viewer which is responsible for rendering  Basis for VRML and Java3D 6

  7. Scene Graphs  Inventor -- Graph Nodes  Shape nodes  represent physical objects  cone, cylinder, sphere, 3Dtext, triangleMesh, NURB surface  Lighting Nodes  introduces lights to a scene  directional, point, spot Scene Graphs  Inventor  Camera Nodes  Introduces a camera model  Orthographic/Perspective camera  Property nodes  Appearance nodes (texture, color, material)  Transformations nodes (scale, rotate, translate)  Other (environment, normal, draw style) 7

  8. Scene Graphs  Inventor  Group nodes  Support for definition of “objects”  Locally groups subgraphs  Switch node (switch between 2 subgraphs) Scene Graphs  Inventor 8

  9. Scene Graphs  Graph Actions  Traversal of scene graph for a particular purpose.  Examples  Rendering  Searching  Compute Bounding Box  Interactivity / Picking  Write to file Scene Graphs  Inventor - Rendering  Like OpenGL, Inventor assumes a state machine.  Unlike OpenGL, entire state can be placed on a stack.  Visiting a shape node introduces a new object with “current” properties  Visiting a property node is equivalent to making a given material current. 9

  10. Scene Graphs  Inventor - Rendering  Entering a group node pushes current state on stack  Leaving a group node pops current state off stack. Scene Modeling Language  Inventor - summary  “Object oriented” wrapper to OpenGL  Scene represented as graph  Actions performed on graphs for specific purposes (like rendering)  Precursor to VRML and Java3D 10

  11. Scene Modeling Languages  Inventor - further reading  [Strauss92]  Strauss/Carey, The Inventor Mentor Scene Modeling Language - VRML  VRML  Virtual Reality Modeling Language  “ an open standard for 3D multimedia and shared virtual worlds on the Internet .”  Text-based scene description language  Need plug-in/applet for viewing VRML scenes  ISO Standard  Originally designed to create virtual worlds as described in books like Snowcrash.  VRML is a Scene Description Language NOT an API  Based on Inventor file format 11

  12. Scene Modeling Language - VRML  Nodes  Have data fields & children  Node Types  Geometry  Appearance  Transformation  Sound  Grouping  Viewpoint Scene Modeling Language - VRML Transform { Translation = translation 1.0 1.0 6.5 Xform (1.0, 1.0, 6.5) children [ Shape { appearance Appearance { material Material { diffuseColor 1.0 0.0 0.0 Shape } } appearance geometry geometry Sphere { radius 1.0 } } ] Sphere Material } Radius = 1.0 Color = red 12

  13. Scene Modeling Language - VRML  VRML  Supports Encapsulation and Reuse  Ability to define new node types  PROTO Statement Scene Modeling Language - VRML Define Seat (location, mycolor) PROTO Seat [ exposedField SFVec3f location 0.0 0.0 0.0 Translation = exposedField SFColor mycolor 1.0 1.0 1.0 Xform location ] Transform { translation IS location children [ Shape { appearance Appearance { Shape material Material { diffuseColor IS myColor appearance } geometry } geometry Sphere { radius 1.0 } } ] Sphere Material } Seat { location 1.0 1.0 6.5 Radius = 1.0 Color = mycolor mycolor 1.0 0.0 0.0} 13

  14. Scene Modeling Language - VRML PROTO Seat [ exposedField SFVec3f location 0 0 0 exposedField SFColor mycolor 1.0 1.0 1.0 Seat3 ] … DEF Seat1 Seat { location 1.0 1.0 6.5 mycolor 1.0 0.0 0.0} DEF Seat2 Seat { location 2.0 1.0 6.5 Seat2 Seat4 mycolor 1.0 0.0 0.0} DEF Seat3 Seat { location 3.0 1.0 6.5 mycolor 1.0 0.0 0.0} DEF Seat4 Seat { location 4.0 1.0 6.5 Seat5 mycolor 1.0 0.0 0.0} Seat1 DEF Seat5 Seat { location 5.0 1.0 6.5 mycolor 1.0 0.0 0.0} Color / Location of each seat can be modified by sending messages Scene Modeling Language - VRML  Inventor and VRML not a truly OO scene model  Separation between object and materials  Still based on state machine model.  Created for CG user. Still doesn’t fit real world paradigm  e.g. We usually aren’t concerned transformation matricies  Scene Graphs are excellent for specifying object heirarchies 14

  15. Scene Modeling Language  GROOP  truly object oriented scene description  transformations, material, geometry, and color are all associated with an object  uses a camera/actor/stage paradigm. Scene Modeling Languages  GROOP 15

  16. Scene Modeling Language  GROOP  Scene object is a collection of objects in a scene.  Objects are introduced by literally “Adding” them to a scene.  Unlike Inventor, order of addition is not important. Scene Modeling Languages  GROOP  Extensibility achieved by use of C++ inheritance. 16

  17. Scene Modeling Languages  GROOP - summary  example of a truly object oriented scene description mechanism  intuitive  extensible  Alas, not used….never caught on. Summary  On the road to scene graphs  Scene Modeling Languages  State Model  Scene Graphs  True Object Oriented Descriptions  Questions? 17

Recommend


More recommend