320 likes | 506 Views
Overview. Introduction Constructing a scene Rendering Frustum culling OpenGL Performer. Introduction. The term ‘scene graph’ is a combination of cinematography and discrete mathematics. Scene: ‘the visual percept of a region.’
E N D
Overview • Introduction • Constructing a scene • Rendering • Frustum culling • OpenGL Performer
Introduction The term ‘scene graph’ is a combination of cinematography and discrete mathematics. Scene: ‘the visual percept of a region.’ In cinematography a scene includes camera’s, actors, background and so forth Graph: ‘nodes connected by edges.’ In this case a directed acyclic graph
Introduction • A scene graph is a data structure which contains: • (Viewable) objects • Relations of objects to another • Information on the appearance of objects • Why use scene graphs? • Possibly quick elimination of peripheral regions • Easy content management • Hierarchical objects are well supported • Persistence; easy saving and storing
Introduction • Every graphics application uses some form of scene graph. • Paint photo manipulation programs • Illustration/design programs • Presentation software • Visualization of modeling and simulation • Any program that provides a GUI • etc…
Positioning objects in a scene Models are stored in their own local space. To be positioned in the right position in the scene, they must be transformed from ‘model space’ to ‘world space’. It is common practice to use a 4x4 transformation matrix for this purpose.
Linear transformations 3-dimensional coordinates can (amongst other transformations) be rotated, scaled and translated using 4x4 matrices after the vectors are rewritten in homogeneous form. Translation Scaling X-axis rotation Y-axis rotation Z-axis rotation
Linear transformations Transforming coordinate v with a single matrix A Transforming coordinate v by matrix B after begin transformed with matrix A
Positioning objects in a scene Green box is placed (A) somewhere in the scene. Red prism is placed (B) on top of the green box Blue box is scaled down (C) and placed (D) on top of green box White prism is rotated (E) and placed on top of blue box (F) Green box: A Red prism: AB Blue box: ADC White prism: ADCFE
Light sources Directional light Spot light Point light • Parameters: • Attenuation • Diffuse color/specular color • Intensity
Rendering states • Material properties • Color • Light reflection • Surface texture • Transparancy/opacity • Reflection/refraction (ray tracing) • Type of shading • More rendering states • Fog • ZBuffer/Stencil buffer settings • Other OpenGL/rasterizer specific settings
LOD (Level Of Detail) node (1) High-res bunny Med-res bunny Low-res bunny
Switch/animation node Depending on a decision function only a specific subtree is used
Rendering the scene graph (1) Input: Scene graph, initial render state Output: Render queue
Rendering the scene graph (2) Next, let OpenGL or other rendering context consume the render queue. Changing the render state might be expensive!! Therefore the render queue is often sorted in such a way that the number of render changes is minimized.
Frustum culling So far, we've been rendering everything without considering wether or not it is in our field of view. Frustum culling: only process that part of the scene graph that is within our field of view. Test if an object lies within all six frustum boundaries. Do not proceed if this isn't the case. Not rendering something is cheap.
Bounding volumes Testing individual vertices of a model is not very efficient. By using bounding volumes, the number of tests is reduced significantly, at the cost of some unnescessary rendering. Bounding Sphere Axis Aligned Bounding Box Orientated Bounding Box
Bounding volumes Bounding volumes can be grouped in larger bounding volumes, so that large sections of the graph can be rejected at an early stage.
Spatial structuring: Static grid Only process nodes that overlap grid cells lying inside the frustum.
Spatial structuring: BSP-tree Binary Space Partitioning-tree. A spatial binary hierarchy within the scene graph. A balanced, axis aligned BSP-tree can be generated with the k-D tree algorithm.
Spatial structuring: Octree BSP-related. Every node of an octree splits an region in eight subregions or none at all (leaf). The 2-dimensional version of the same principal is called a quadtree.
Portals Portals clip the viewing frustum. When an additional transformation is added as well, portals can also be used for 'television' or mirrors. Making the viewing frustum smaller by clipping increases the chance of rejection.
Occlusion Culling • Occlussion culling attempts to not render objects that are invisible because occluding objects are located in front of them. • Z-Buffering • Z-Pyramid/Hierarchical occluding maps • Shadow frusta
OpenGL Performer "Industrial-strength" scene graph API developed by Silicon Graphics for OpenGL. Mainly used for visualisation purposes, but can also be employed for simulations and games. From the "Getting Started" guide: OpenGL Performer is an extensible software toolkit for creating real-time 3D graphics. Typical applications are in the fields of visual simulation, entertainment, virtual reality, broadcast video, and CAD. OpenGL Performer provides a flexible, intuitive, toolkit-based solution for developers who want to optimize application performance.
OpenGL Performer • Performer is composed of the following eight libraries: • High performance rendering library • Visual simulation library • Geometry Builder Library • Utility Library • User Interface Library • Graphical Viewer Library • A Configuration-import Library • Database Loader Library