scene graph - faculty of mechanical engineering, utm
TRANSCRIPT
Scene Graph
This set of slides reference the text book and Comps Graphics& Virtual Environments (Slater et. al, Addison-Wesley), slides
used at Princeton by Prof. Tom Funkhouser and Gahli et al.SIGGRAPH course note #15 on OO API.
Spatial Data Structures
⢠Data structures for efficiently storing geometricinformation. They are useful forâ Collision detection (will the spaceships collide?)
â Location queries (which is the nearest post office?)
â Chemical simulations (which protein will this drugmolecule interact with?)
â Rendering (is this aircraft carrier on-screen?), and more
⢠Good data structures can give speed up rendering by10x, 100x, or more
⢠Data structures for efficiently storing geometricinformation. They are useful forâ Collision detection (will the spaceships collide?)
â Location queries (which is the nearest post office?)
â Chemical simulations (which protein will this drugmolecule interact with?)
â Rendering (is this aircraft carrier on-screen?), and more
⢠Good data structures can give speed up rendering by10x, 100x, or more
Bounding Volume
⢠Simple notion: wrap things that are hard to check forray intersection in things that are easy to check.â Example: wrap a complicated polygonal mesh in a box. Ray
canât hit the real object unless it hits the box
⢠Adds some overhead, but generally pays for itself .
⢠Can build bounding volume hierarchies
⢠Simple notion: wrap things that are hard to check forray intersection in things that are easy to check.â Example: wrap a complicated polygonal mesh in a box. Ray
canât hit the real object unless it hits the box
⢠Adds some overhead, but generally pays for itself .
⢠Can build bounding volume hierarchies
Bounding Volumes
⢠Choose Bounding Volume(s)â Spheres
â Boxes
â Parallelepipeds
â Oriented boxes
â Ellipsoids
â Convex hulls
⢠Choose Bounding Volume(s)â Spheres
â Boxes
â Parallelepipeds
â Oriented boxes
â Ellipsoids
â Convex hulls
Motivation for Scene Graph
⢠Three-foldâ Performance
â Generality
â Ease of use
⢠How to model a scene ?â Java3D, Open Inventor, Open Performer, VRML,
etc.
⢠Three-foldâ Performance
â Generality
â Ease of use
⢠How to model a scene ?â Java3D, Open Inventor, Open Performer, VRML,
etc.
Scene Description
⢠Set of Primitives
⢠Specify for each primitive⢠Transformation
⢠Lighting attributes
⢠Surface attributes⢠Material (BRDF)
⢠Texture
⢠Texture transformation
⢠Set of Primitives
⢠Specify for each primitive⢠Transformation
⢠Lighting attributes
⢠Surface attributes⢠Material (BRDF)
⢠Texture
⢠Texture transformation
Scene Graphs
⢠Scene Elementsâ Interior Nodes
⢠Have children that inherit state⢠transform, lights, fog, color, âŚ
â Leaf nodes⢠Terminal⢠geometry, text
â Attributes⢠Additional sharable state (textures)
⢠Scene Elementsâ Interior Nodes
⢠Have children that inherit state⢠transform, lights, fog, color, âŚ
â Leaf nodes⢠Terminal⢠geometry, text
â Attributes⢠Additional sharable state (textures)
Scene Graph
⢠Graph Representationâ What do edges mean?
â Inherit state along edges⢠group all red object instances together
⢠group logical entities togetherâ parts of a car
â Capture intent with the structure
⢠Graph Representationâ What do edges mean?
â Inherit state along edges⢠group all red object instances together
⢠group logical entities togetherâ parts of a car
â Capture intent with the structure
Scene Graph
⢠Inheritance -- Overloaded Termâ Behavior inheritance (subclassing)
⢠Benefit of OO design
â Implementation inheritance⢠Perhaps provided by implementation language
⢠Not essential for a good API design
â Implied inheritance⢠Designed into the API
⢠Inheritance -- Overloaded Termâ Behavior inheritance (subclassing)
⢠Benefit of OO design
â Implementation inheritance⢠Perhaps provided by implementation language
⢠Not essential for a good API design
â Implied inheritance⢠Designed into the API
Scene Graph Traversal
⢠Simulationâ Animation
⢠Intersectionâ Collision detectionâ Picking
⢠Image Generationâ Cullingâ Detail elisionâ Attributes
⢠Simulationâ Animation
⢠Intersectionâ Collision detectionâ Picking
⢠Image Generationâ Cullingâ Detail elisionâ Attributes
Scene Graph Considerations
⢠Functional Organizationâ Semantics
⢠Bounding Volumesâ Cullingâ Intersection
⢠Levels of Detailâ Detail elisionâ Intersection
⢠Attribute Managementâ Eliminate redundancies
⢠Functional Organizationâ Semantics
⢠Bounding Volumesâ Cullingâ Intersection
⢠Levels of Detailâ Detail elisionâ Intersection
⢠Attribute Managementâ Eliminate redundancies
Functional Organization
⢠Articulated Transformationsâ Animation
â Difficult to optimize animated objects
Attribute Management
⢠Minimize transformationsâ Each transformation is expensive during rendering,
intersection, etc. Need automatic algorithms tocollapse/adjust transform hierarchy.
⢠Minimize transformationsâ Each transformation is expensive during rendering,
intersection, etc. Need automatic algorithms tocollapse/adjust transform hierarchy.
Attribute Management
⢠Minimize attribute changesâ Each state change is expensive during
rendering
Question: How do you manage yourlight sources?
⢠OpenGL supports only 8 lights. What if there are 200lights? The modeler must âscopeâ the lights in thescene graph?
Think!
⢠How to handle optimization of scene graphswith multiple competing goalsâ Function
â Bounding volumes
â Levels of Detail
â Attributes
⢠How to handle optimization of scene graphswith multiple competing goalsâ Function
â Bounding volumes
â Levels of Detail
â Attributes
Scene Graphs Traversal
⢠Perform operations on graph with traversalâ Like STL iterator
â Visit all nodes
â Collect inherited state while traversing edges
⢠Also works on a sub-graph
⢠Perform operations on graph with traversalâ Like STL iterator
â Visit all nodes
â Collect inherited state while traversing edges
⢠Also works on a sub-graph
Typical Traversal Operations
⢠Typical operationsâ Render
â Search (pick, find by name)
â View-frustum cull
â Tessellate
â Preprocess (optimize)
⢠Typical operationsâ Render
â Search (pick, find by name)
â View-frustum cull
â Tessellate
â Preprocess (optimize)
Scene Graphs Organization
⢠Tree structure bestâ No cycles for simple traversalâ Implied depth-first traversal (not essential)â Includes lists, single node, etc as degenerate trees
⢠If allow multiple references (instancing)â Directed acyclic graph (DAG)
⢠Difficult to represent cell/portal structures
⢠Tree structure bestâ No cycles for simple traversalâ Implied depth-first traversal (not essential)â Includes lists, single node, etc as degenerate trees
⢠If allow multiple references (instancing)â Directed acyclic graph (DAG)
⢠Difficult to represent cell/portal structures
State Inheritance
⢠General (left to right, top to bottom, all state)â Open Inventor
â Need Separator node to break inheritance
â Need to visit all children to determine final state
⢠Top to bottom onlyâ IRIS Performer, Java3D, âŚ
â State can be determined by traversing path to node
⢠General (left to right, top to bottom, all state)â Open Inventor
â Need Separator node to break inheritance
â Need to visit all children to determine final state
⢠Top to bottom onlyâ IRIS Performer, Java3D, âŚ
â State can be determined by traversing path to node
Scene Graphs Appearance Overrides
⢠One attempt to solve the âhighlightingâ problemâ After picking an object, want to display it differently
â Donât want to explicitly edit and restore its appearance
â Use override node in the scene graph to overrideappearance of children
⢠Only works if graph organization matches modelorganization
⢠One attempt to solve the âhighlightingâ problemâ After picking an object, want to display it differently
â Donât want to explicitly edit and restore its appearance
â Use override node in the scene graph to overrideappearance of children
⢠Only works if graph organization matches modelorganization
Multiple Referencing (Instancing)
⢠Convenient for representing multipleinstances of an objectâ rivet in a large assembly
⢠Save memory
⢠Need life-time managementâ is the object still in use
â garbage collection, reference counts
⢠Convenient for representing multipleinstances of an objectâ rivet in a large assembly
⢠Save memory
⢠Need life-time managementâ is the object still in use
â garbage collection, reference counts
Multiple Referencing
⢠Changes trees into DAGs
⢠Instance of an object represented by its path, (path islike a mini-scene)
⢠Difficult to attach instance specific propertiesâ e.g., caching transform at leaf node
⢠Changes trees into DAGs
⢠Instance of an object represented by its path, (path islike a mini-scene)
⢠Difficult to attach instance specific propertiesâ e.g., caching transform at leaf node
Other Scene Graph Organizations
⢠Logical structure (part, assembly, etc.)â Used by modeling applications
⢠Topology structure, e.g., boundaryâ surfaces, faces, edges, verticesâ Useful for CAD applications
⢠Behaviors, e.g., engine graph⢠Environment graph (fog, lights, etc.)⢠Scene graph is not just for rendering!!
⢠Logical structure (part, assembly, etc.)â Used by modeling applications
⢠Topology structure, e.g., boundaryâ surfaces, faces, edges, verticesâ Useful for CAD applications
⢠Behaviors, e.g., engine graph⢠Environment graph (fog, lights, etc.)⢠Scene graph is not just for rendering!!