Open Scene Graph Visualization II MSIM 842, CS 795/895

  • Published on
    25-Feb-2016

  • View
    30

  • Download
    0

DESCRIPTION

Open Scene Graph Visualization II MSIM 842, CS 795/895. Instructor: Jessica Crouch. Implementation work. 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 - PowerPoint PPT Presentation

Transcript

Open Scene GraphVisualization IIMSIM 842, CS 795/895Instructor:Jessica CrouchImplementation workTime constraints and algorithmic complexity make it impractical to implement very many of the algorithms well discussWell introduce OpenSceneGraph and do a little programmingIts a useful skillGood to learn after OpenGLWell do enough to prepare you to pursue it further on your ownOur primary focus in class will remain on the readingsVTK AlternativeVTK was another strong possibilityOSG implements more graphics and simulation oriented features VTK Implements more visualization, 2D & 3D data processing algorithmsScene GraphsDatastructure: Directed Acyclic Graph (DAG)Usually a tree (only one parent per node) Represents object-based hierarchy of geometry Leaves contains geometry (triangles, etc.)Each node holds pointers to childrenChildren can beGroupGeometryMatrix transformOthersScene GraphsSpatial transforms represented as graph nodes (rotation, translation, scaling, etc.)tricycleBack wheelsFront GroupLeft wheelRight wheelTTSeatHandle barsFront WheelTScene Graphs & Bounding VolumesBasic idea:Augment scene graphs with bounding volume data (spheres or blocks) at each nodeSometimes 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 trianglesScene graph examplecircles=BVsscene graphrootCulling: OverviewHierarchical view-frustum cullingUse bounding volumesDetail cullingChoose resolution of rendering based on objects distace to cameraView-Frustum CullingIf 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 geometryExample of Hierarchical View Frustum CullingcameraScene Graphs & Detail ControlIn complex scenes, a large percentage of time is wasted drawing tiny trianglesWhat happens if a triangle projects to one pixel or less?Goal: Use scene graph to reduce workload of insignificant trianglesDetail CullingIdea: Objects whose projected BV occupy less than N pixels are culledThis is an approximating algorithm since the triangles you cull may actually contribute to the final imageAdvantage: trade-off quality/speedExample of Detail CullingNot much difference, but 80-400% fasterGood when movingdetail culling OFFdetail culling ONImages courtesy of ABB Robotics Products, created by Ulf AssarssonLevel-of-Detail RenderingUse different levels of detail at different distances from the viewerMore triangles closer to the viewerLOD renderingNot much visual difference, but a lot fasterUse area of projection of BV to select appropriate LODScene graph with LODsScene Graphs:State ChangesState changes affect the way the graphics pipeline executeRecall pipelining from your architecture classA change in state may require flushing the pipelineflushing the cache (on the graphics card)Binding to a texture is one of the most expensive state changes Ideally, a scene would be drawn with the fewest possible state changesMost expensive state changes would be minimized at the expense of faster state changesHow to accomplish this?Must sort triangles according to their stateManually?Automatically?Scene Graphs:State ChangesScene graphs are used for state sortingState information is stored with the nodesOptimized rendering algorithms take advantage of groupings of same-state primitivesScene graph hierarchy can be (algorithmically) rearranged for rendering into a state graphBranchings represent state changesState tends to be staticScene Graphs:State ChangesOpen Scene GraphLibrary for scene graphsBuilt on top of OpenGLC++ APIObject orientedOpen sourceGrowing popularity in graphics communityCommercially used (Boeing, NASA, )Web site:http://www.openscenegraph.orgOpen Scene GraphSupports:View frustum cullingOcclusion cullingSmall feature cullingLevel Of Detail nodesState sortingMany other featuresOSG Distribution ContainsCore OSG Focus on understanding this firstNodeKits implements more node types than available in the corePlugins I/O for different file typesInteroperability libs for using OSG with various packages, languagesExamplesCore OSGosg::Node - Base class for all nodes in the scene graph.osg::Group - General group node which maintains a list of children. Transform Nodesosg::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.Geometry Nodesosg::Geode - A Geode is a "geometry node", that is, a leaf node on the scene graph that can have "renderable things" attached to it. Renderable things are represented by objects from the Drawable class, so a Geode is a Node whose purpose is grouping Drawables. DrawablesPure virtual base class for drawable geometry. Everything that can be rendered is implemented as a class derived from 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. The OpenGL state that must be used when rendering a Drawable is represented by a StateSet. Drawables 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. Plugins for file I/OHas plugins to support reading/writing lots of graphics file formats and 3D models:3D database loaders include OpenFlight (.flt)TerraPage (.txp)LightWave (.lwo)Alias Wavefront (.obj)Carbon Graphics GEO (.geo)3D Studio MAX (.3ds)Peformer (.pfb)Quake Character Models (.md2)Direct X (.x)Inventor Ascii 2.0 (.iv)/ VRML 1.0 (.wrl)Designer Workshop (.dw) AC3D (.ac) native .osg ASCII format. Image loaders include .rgb.gif.jpg.png.tiff.pic.bmp.dds.tgaOSGEditHelps you compose scenes for OSGOpen sourceImport models created with other programs, arrange your tree structure and transformshttp://osgedit.sourceforge.net/Open Scene GraphOSG documentation is incompleteNo textbookDoxygen code documentationSome online tutorials and example programsTakes time to learn your way aroundUseful As-Is, development work continuesReferenceswww.openscenegraph.orghttp://www.nps.navy.mil/cs/sullivan/osgTutorials/SceneGraphOverview.htmhttp://www.realityprime.com/scenegraph.phpYour To-Do ListEmail me (jrcrouch@cs.odu.edu) your paper preferences by Sunday night.Download and build OSG. See instructions on course web site.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.Read the two assigned papers for the next class.Objects close to each other in the virtual world are close in the scene graphNext slides shows some examplesHappens early (on CPU) in the pipeline == GOODAssuming that testing a sphere against the view frustum is cheaper than rendering the objectAlso, called SCREEN-SIZE CULLINGBullet 2: This implies that this is an approximation.forts slideBullet 3: higher speed if larger threshold (N)Often combined with Hierarchical VF CULL,that is, DONE in a hierarchical fashion as wellIDEA: Does not make sense to use 10,000 triangles when the object cover 50 pixels on-screenDifferent levels of detail == different number of polygonsBECAUSE, when an object is far away, Other criteria to select LOD: distance to the object, rendering budget (I.e., do we have time to draw a more complex LOD?)Many different types of LODs : what weve shown here are called Discrete Geometry LODsRead more in the book about Alpha LODs, Geomorph LODS, and more sophisticated LODselection critera.Speedups: usually at least a factor of 2

Recommended

View more >