Open Scene Graph Visualization II MSIM 842, CS 795/895 Instructor: Jessica Crouch.

  • Published on
    27-Dec-2015

  • View
    212

  • Download
    0

Transcript

  • Slide 1
  • Open Scene Graph Visualization II MSIM 842, CS 795/895 Instructor: Jessica Crouch
  • Slide 2
  • Implementation work Time constraints and algorithmic complexity make it impractical to implement very many of the algorithms well discuss Time constraints and algorithmic complexity make it impractical to implement very many of the algorithms well discuss Well introduce OpenSceneGraph and do a little programming Well introduce OpenSceneGraph and do a little programming Its a useful skill Good to learn after OpenGL Well do enough to prepare you to pursue it further on your own Our primary focus in class will remain on the readings Our primary focus in class will remain on the readings
  • Slide 3
  • VTK Alternative VTK was another strong possibility VTK was another strong possibility OSG implements more graphics and simulation oriented features VTK Implements more visualization, 2D & 3D data processing algorithms
  • Slide 4
  • Scene Graphs Datastructure: Directed Acyclic Graph (DAG) Datastructure: Directed Acyclic Graph (DAG) Usually a tree (only one parent per node) Usually a tree (only one parent per node) Represents object-based hierarchy of geometry Represents object-based hierarchy of geometry Leaves contains geometry (triangles, etc.) Leaves contains geometry (triangles, etc.) Each node holds pointers to children Each node holds pointers to children Children can be Children can be Group Group Geometry Geometry Matrix transform Matrix transform Others Others
  • Slide 5
  • Scene Graphs Spatial transforms represented as graph nodes (rotation, translation, scaling, etc.) Spatial transforms represented as graph nodes (rotation, translation, scaling, etc.) tricycle Back wheels Front Group Left wheel Right wheel TT Seat Handle bars Front Wheel T
  • Slide 6
  • Scene Graphs & Bounding Volumes Basic idea: Basic idea: Augment scene graphs with bounding volume data (spheres or blocks) at each node Sometimes called Bounding Volume Hierarchy (BVH) Sometimes called Bounding Volume Hierarchy (BVH) By applying clipping/culling tests to the bounding volumes, prune entire branches of the tree and possibly avoid processing many triangles
  • Slide 7
  • Scene graph example circles=BVs scene graph root
  • Slide 8
  • Culling: Overview Hierarchical view-frustum culling Hierarchical view-frustum culling Use bounding volumes Detail culling Detail culling Choose resolution of rendering based on objects distace to camera
  • Slide 9
  • View-Frustum Culling If a bounding volume (BV) is outside the view frustum, then the entire contents of that BV is also outside (not visible) If a bounding volume (BV) is outside the view frustum, then the entire contents of that BV is also outside (not visible) Avoid further processing of such BVs and their containing geometry Avoid further processing of such BVs and their containing geometry
  • Slide 10
  • Example of Hierarchical View Frustum Culling root camera
  • Slide 11
  • Scene Graphs & Detail Control In complex scenes, a large percentage of time is wasted drawing tiny triangles In complex scenes, a large percentage of time is wasted drawing tiny triangles What happens if a triangle projects to one pixel or less? What happens if a triangle projects to one pixel or less? Goal: Use scene graph to reduce workload of insignificant triangles Goal: Use scene graph to reduce workload of insignificant triangles
  • Slide 12
  • Detail Culling Idea: Objects whose projected BV occupy less than N pixels are culled Idea: Objects whose projected BV occupy less than N pixels are culled This is an approximating algorithm since the triangles you cull may actually contribute to the final image This is an approximating algorithm since the triangles you cull may actually contribute to the final image Advantage: trade-off quality/speed Advantage: trade-off quality/speed
  • Slide 13
  • Example of Detail Culling detail culling OFF Not much difference, but 80-400% faster Not much difference, but 80-400% faster Good when moving Good when moving detail culling ON Images courtesy of ABB Robotics Products, created by Ulf Assarsson
  • Slide 14
  • Level-of-Detail Rendering Use different levels of detail at different distances from the viewer Use different levels of detail at different distances from the viewer More triangles closer to the viewer More triangles closer to the viewer
  • Slide 15
  • LOD rendering Not much visual difference, but a lot faster Not much visual difference, but a lot faster Use area of projection of BV to select appropriate LOD
  • Slide 16
  • Scene graph with LODs Car chair
  • Slide 17
  • Scene Graphs: State Changes State changes affect the way the graphics pipeline execute State changes affect the way the graphics pipeline execute Recall pipelining from your architecture class A change in state may require flushing the pipeline flushing the pipeline flushing the cache (on the graphics card) flushing the cache (on the graphics card) Binding to a texture is one of the most expensive state changes
  • Slide 18
  • Ideally, a scene would be drawn with the fewest possible state changes Ideally, a scene would be drawn with the fewest possible state changes Most expensive state changes would be minimized at the expense of faster state changes Most expensive state changes would be minimized at the expense of faster state changes How to accomplish this? How to accomplish this? Must sort triangles according to their state Manually? Automatically? Scene Graphs: State Changes
  • Slide 19
  • Scene graphs are used for state sorting Scene graphs are used for state sorting State information is stored with the nodes State information is stored with the nodes Optimized rendering algorithms take advantage of groupings of same-state primitives Optimized rendering algorithms take advantage of groupings of same-state primitives Scene graph hierarchy can be (algorithmically) rearranged for rendering into a state graph Scene graph hierarchy can be (algorithmically) rearranged for rendering into a state graph Branchings represent state changes State tends to be static Scene Graphs: State Changes
  • Slide 20
  • Open Scene Graph Library for scene graphs Library for scene graphs Built on top of OpenGL Built on top of OpenGL C++ API C++ API Object oriented Object oriented Open source Open source Growing popularity in graphics community Growing popularity in graphics community Commercially used (Boeing, NASA, ) Commercially used (Boeing, NASA, ) Web site: Web site: http://www.openscenegraph.org http://www.openscenegraph.org
  • Slide 21
  • Open Scene Graph Supports: Supports: View frustum culling Occlusion culling Small feature culling Level Of Detail nodes State sorting Many other features
  • Slide 22
  • OSG Distribution Contains Core OSG Focus on understanding this first Core OSG Focus on understanding this first NodeKits implements more node types than available in the core NodeKits implements more node types than available in the core Plugins I/O for different file types Plugins I/O for different file types Interoperability libs for using OSG with various packages, languages Interoperability libs for using OSG with various packages, languages Examples Examples
  • Slide 23
  • Core OSG osg::Node - Base class for all nodes in the scene graph.
  • Slide 24
  • osg::Group - General group node which maintains a list of children.
  • Slide 25
  • Transform Nodes osg::Transform - A Transform is a group node for which all children are transformed by a 4x4 matrix. It is often used for positioning objects within a scene, producing trackball functionality or for animation.Transform
  • Slide 26
  • Geometry Nodes osg::Geode - A Geode is a "geometry node", that is, a leaf node on the scene graph that can have "renderable things" attached to it.Geode Renderable things are represented by objects from the Drawable class, so a Geode is a Node whose purpose is grouping Drawables.Drawable GeodeNodeDrawable
  • Slide 27
  • Drawables Pure virtual base class for drawable geometry. Everything that can be rendered is implemented as a class derived from Drawable. Drawable A Drawable is not a Node, and therefore it cannot be directly added to a scene graph. Instead, Drawables are attached to Geodes, which are scene graph nodes.DrawableNodeDrawableGeode The OpenGL state that must be used when rendering a Drawable is represented by a StateSet.DrawableStateSet DrawableDrawables can also be shared between different Geodes, so that the same geometry (loaded to memory just once) can be used in different parts of the scene graph.Geode
  • Slide 28
  • Plugins for file I/O Has plugins to support reading/writing lots of graphics file formats and 3D models: Has plugins to support reading/writing lots of graphics file formats and 3D models: 3D database loaders include OpenFlight (.flt) OpenFlight (.flt) OpenFlight TerraPage (.txp) TerraPage (.txp) TerraPage LightWave (.lwo) LightWave (.lwo) LightWave Alias Wavefront (.obj) Alias Wavefront (.obj) Carbon Graphics GEO (.geo) Carbon Graphics GEO (.geo) 3D Studio MAX (.3ds) 3D Studio MAX (.3ds) Peformer (.pfb) Peformer (.pfb) Quake Character Models (.md2) Quake Character Models (.md2) Direct X (.x) Direct X (.x) Inventor Ascii 2.0 (.iv)/ VRML 1.0 (.wrl) Inventor Ascii 2.0 (.iv)/ VRML 1.0 (.wrl) Designer Workshop (.dw) Designer Workshop (.dw) AC3D (.ac) AC3D (.ac) native.osg ASCII format. native.osg ASCII format. Image loaders include.rgb.rgb.gif.gif.jpg.jpg.png.png.tiff.tiff.pic.pic.bmp.bmp.dds.dds.tga.tga
  • Slide 29
  • OSGEdit Helps you compose scenes for OSG Helps you compose scenes for OSG Open source Open source Import models created with other programs, arrange your tree structure and transforms Import models created with other programs, arrange your tree structure and transforms http://osgedit.sourceforge.net/
  • Slide 30
  • Open Scene Graph OSG documentation is incomplete OSG documentation is incomplete No textbook Doxygen code documentation Some online tutorials and example programs Takes time to learn your way around Takes time to learn your way around Useful As-Is, development work continues Useful As-Is, development work continues
  • Slide 31
  • References www.openscenegraph.org www.openscenegraph.org www.openscenegraph.org http://www.nps.navy.mil/cs/sullivan/osgTutorials/SceneGr aphOverview.htm http://www.nps.navy.mil/cs/sullivan/osgTutorials/SceneGr aphOverview.htm http://www.nps.navy.mil/cs/sullivan/osgTutorials/SceneGr aphOverview.htm http://www.nps.navy.mil/cs/sullivan/osgTutorials/SceneGr aphOverview.htm http://www.realityprime.com/scenegraph.php http://www.realityprime.com/scenegraph.php http://www.realityprime.com/scenegraph.php
  • Slide 32
  • Your To-Do List 1. Email me (jrcrouch@cs.odu.edu) your paper preferences by Sunday night. 2. Download and build OSG. See instructions on course web site. 3. Read through and run the Example osgAnimate. Draw the scene graph tree constructed in osgAnimate.cpp and bring to the next class. For each node, list object name and type. 4. Read the two assigned papers for the next class.

Recommended

View more >