Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.

Slides:



Advertisements
Similar presentations
1 Binary Space Partition Trees ©Anthony Steed, Yiorgos Chrysanthou
Advertisements

GR2 Advanced Computer Graphics AGR
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.

Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
Computer graphics & visualization Collisions. computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
CSE 381 – Advanced Game Programming Scene Management
Visibility Culling. Back face culling View-frustrum culling Detail culling Occlusion culling.
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Bounding Volume Hierarchy “Efficient Distance Computation Between Non-Convex Objects” Sean Quinlan Stanford, 1994 Presented by Mathieu Brédif.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
Advanced Data Structures for Games and Graphics Lecture 4
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
1 Advanced Scene Management System. 2 A tree-based or graph-based representation is good for 3D data management A tree-based or graph-based representation.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
BSP Trees, Quadtrees & Octrees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, January 28, 2004.
Data Structures for Computer Graphics Point Based Representations and Data Structures Lectured by Vlastimil Havran.
Managing Your Objects Paul Taylor 2009 Assignment Due Fri 5/6/2009.
CS 450: COMPUTER GRAPHICS VISIBLE SURFACE DETECTION SPRING 2015 DR. MICHAEL J. REALE.
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
1 Speeding Up Ray Tracing Images from Virtual Light Field Project ©Slides Anthony Steed 1999 & Mel Slater 2004.
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
CS-378: Game Technology Lecture #10: Spatial Data Structures Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
2-3 Tree. Slide 2 Outline  Balanced Search Trees 2-3 Trees Trees.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Computational Geometry Piyush Kumar (Lecture 5: Range Searching) Welcome to CIS5930.
Implementation II.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Maths & Technologies for Games Spatial Partitioning 2
Computer Graphics I, Fall 2010 Implementation II.
CSE554Contouring IISlide 1 CSE 554 Lecture 5: Contouring (faster) Fall 2015.
CSE554Contouring IISlide 1 CSE 554 Lecture 5: Contouring (faster) Fall 2013.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
BSP Tree Supplement Jyun-Ming Chen. Fall Kd-Tree and BSP tree kd-tree is a special kind of bsp tree.
Advanced Computer Graphics Spring 2009 K. H. Ko Department of Mechatronics Gwangju Institute of Science and Technology.
Ray Tracing Optimizations
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Visibility Determination – List Priority Methods Chapter 11.
Ray Tracing Acceleration (3)
Hierarchical Data Structure in Game Programming Yanci Zhang Game Programming Practice.
School of Computing Clemson University Fall, 2012
CSE 554 Lecture 5: Contouring (faster)
Scene Manager Creates and places movable objects like lights and cameras so as to access them efficiently, e.g. for rendering. Loads and assembles world.
Bounding Volume Hierarchies and Spatial Partitioning
BSP Trees Binary space partitioning trees.
Collision Detection Spring 2004.
Bounding Volume Hierarchies and Spatial Partitioning
Deformable Collision Detection
Modeliranje kompleksnih modelov
CSCE 441: Computer Graphics Hidden Surface Removal
Quadtrees 1.
CS679 - Fall Copyright Univ. of Wisconsin
Deformable Collision Detection
Modeliranje kompleksnih modelov
Presentation transcript:

Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering

Material Recipes As previously mentioned there are several different components used in the creation of a material for an object –Ambient –Diffuse –Specular –Shininess –Emissive

Material Recipes Use Shininess value times 128

Spatial Data Structures One of the important topics for performing real time graphics applications are data structures for efficient queries to do: –Graphics Culling –Intersection Testing

Spatial Data Structure Spatial Data Structures organize geometry in some n - dimensional space (generally 2 or 3 but can work in higher dimensional space). The list is the simplest data structure and fairly slow for large data sets but reasonable for smaller ones.

Spatial Data Structures Most spatial data structures are hierarchical as a tree like structure nested and recursive. Searching a list is O(n) while searching a tree is O(log n). Usually constructing a spatial data structure is fairly slow and is done as preprocessing.

Spatial Data Structures There are several types of spatial data structures: –Bounding Volume Hierarchies –BSP Trees –Octrees –Scene Graphs

Bounding Volume Hierarchies The most common bounding volume is the bounding box. Other common types are sphere and cylinders. The idea is that the bounding volume is simpler than the more complex shapes it contains.

Bounding Volume Hierarchies A Bounding Volume Hierarchy (BVH) is the most common kind of spatial data structure for rendering real-time 3-d scenes. Each object in a scene is bound by a volume and then groups of objects are bounded and eventually the entire scene is bounded.

Bounding Volume Hierarchies Simple Scene of Objects Tree of Objects Root

Bounding Volume Hierarchies For a tree where each node has k children then the height of the tree is log k n where n is the number of nodes in the tree. A binary tree is the simplest choice but a higher number of children per node can give slightly better results.

Bounding Volume Hierarchies In the example of ray casting you search each subtree recursively. If a child node is not hit then skip the rest of its subtree If the ray hits the outer volume check each the children

Bounding Volume Hierarchies Speed up comes from simple intersection tests with bounding volumes and also from culling subtrees If objects move around then first check is it still fits in its current bounding volume. Otherwise remove it and change the parent bounding volume and drop the node in the root of the tree and reinsert it.

Binary Space Partitioning Trees These trees are created by using a plane to split space into two pieces and sorting the geometry into each side. There are two flavors of BSP trees. –Axis-Aligned –Polygon-Aligned

Binary Space Partitioning Trees Axis-Aligned BSP Tree –The whole scene is enclosed in an axis- aligned bounding box (AABB). –The idea is to subdivide that box into smaller and smaller boxes. –For each split an axis is chosen and a plane perpendicular to that axis is generated that divides the space into two boxes

Binary Space Partitioning Trees a 1b 1a 1b 2

Binary Space Partitioning Trees 0 1a 1b 2 0 1a1b 2

Binary Space Partitioning Trees Axis-Aligned BSP Tree –Space is usually split until some criteria has been reached (height of tree) –One of the strategies of splitting is to rotate through the axes each turn. –One of the benefits of the BSP tree is that it provides a rough front to back sorting based on the position of the viewer.

Binary Space Partitioning Trees 0 1a 1b 2 Traverse the tree by first moving down the subtrees defined by the side of the plane the user is one. For plane 0 is the viewer’s x position > x0? - Yes, so take right subtree. For plane 1b is viewer’s y position > y1b? - No, so take the left subtree. Test against objects in that subtree and go back to parent if no collision. x0 y1a y1b x2

Binary Space Partitioning Trees Polygon-Aligned BSP Trees –In this version a polygon from the scene is chosen and the plane it lies in becomes the splitting plane. –The other polygons in the scene are divided by the plane and any polygons the plane intersects are cut by the plane

Binary Space Partitioning Trees AA B C A B C F G D E A BC DEFG

Polygon-Aligned BSP Trees –Constructing this kind of tree is very expensive and is general done and then saved in a file. –Traversing this tree based on the position of the camera will provide a strict back to front (or front to back) sorting of the polygons

Binary Space Partitioning Trees A B C F G D E A BC DEFG Determine which side of the plane the camera lies on by a point/plane comparison The polygon set on the far side of the plane is is beyond the near side set From the far side set again do the comparison and determine the far side of its splitting plane Back to front order is for this example is: F - G- A - D - B- E This does not tell which polygon is closest but which polygon occludes (hides) another polygon.

Octrees Similar to an AA-BSP tree a box is split simultaneously along all 3 axes and the split point is in the center of the box creating 8 new boxes. Enclose the entire space in an AABB and split until you meet a stopping criteria. The 2D version of the octree is the quadtree.

Octrees Objects that cross boundaries are either: Split Stored in multiple nodes Stored in the largest box that contains it

Scene Graphs BVHs, BSP tree and Octrees all use some sort of tree to partition space and store geometry. Scene graphs are higher level structures that that are augmented with textures, transforms, levels-of-detail, material properties, light sources, etc.

Scene Graphs Every graphics application has some sort of scene graph even if it is a root node with a set of children to display. A node in a scene graph often has a bounding volume while leaves store geometry. A leaf may contain an entire spatial data structure (such as a BSP Tree) to encode the geometry.

Scene Graphs Transformations can be placed in any internal node and effects the entire subtrees of that node. Draw the star Save the current matrix Apply a rotation Draw Planet One Save the current matrix Apply a second rotation Draw Moon A Draw Moon B Reset the matrix we saved Draw Planet two Save the current matrix Apply a rotation Draw Moon C Draw Moon D Reset the matrix we saved

Scene Graphs A single leaf node can have multiple parents. Car Chassis Transform Wheel

Scene Graph Maintenance –The most intuitive method is to alter a scene graph through a GUI (Maya, 3DMax) –Otherwise design a scripting “language” to insert and delete nodes from the graph

Scene Graphs Open Source Scene Graphs: –Open Scene Graph –Open SG These are two semi-competing scene graphs which have somewhat specialized.

References Tomas Akenine-Moller and Eric Haines. Real Time Rendering. 2 nd Edition. A. K. Peters mming/features/scenegraph/