Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

1 Binary Space Partition Trees ©Anthony Steed, Yiorgos Chrysanthou
GR2 Advanced Computer Graphics AGR
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Collisions and Intersections When objects move, test for collision. When projecting surfaces, check for intersections. (Many slides adapted from Amitabh.
Nearest Neighbor Search
Searching on Multi-Dimensional Data
03/12/02 (c) 2002 University of Wisconsin, CS559 Last Time Some Visibility (Hidden Surface Removal) algorithms –Painter’s Draw in some order Things drawn.
CSE 381 – Advanced Game Programming Scene Management
Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye
Computer Graphics1 Quadtrees & Octrees. Computer Graphics2 Quadtrees n A hierarchical data structure often used for image representation. n Quadtrees.
CS447/ Realistic Rendering -- Solids Modeling -- Introduction to 2D and 3D Computer Graphics.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Multiple-key indexes Index on one attribute provides pointer to an index on the other. If V is a value of the first attribute, then the index we reach.
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.
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
1 Clipping and Hidden Surfaces CS-184: Computer Graphics Prof. James O’Brien.
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.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
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.
Spatial Data Structure: Quadtree, Octree,and BSP tree Mengxia Zhu Fall 2007.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
Hidden Surface Removal
BSP Trees, Quadtrees & Octrees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, January 28, 2004.
Graphics Pipeline Hidden Surfaces CMSC 435/634. Visibility We can convert simple primitives to pixels Which primitives (or parts of primitives) should.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Data Structures for Computer Graphics Point Based Representations and Data Structures Lectured by Vlastimil Havran.
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
Data Structures Arrays both single and multiple dimensions Stacks Queues Trees Linked Lists.
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.
The Visibility Problem In many environments, most of the primitives (triangles) are not visible most of the time –Architectural walkthroughs, Urban environments.
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
The BSP-tree from Prof. Seth MIT.. Motivation for BSP Trees: The Visibility Problem We have a set of objects (either 2d or 3d) in space. We have.
Visible-Surface Detection Jehee Lee Seoul National University.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
Using BSP for CD Ref: BSP in deBerg et al ’ s book (url)url.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Where We Stand At this point we know how to: –Convert points from local to window coordinates –Clip polygons and lines to the view volume –Determine which.
Maths & Technologies for Games Spatial Partitioning 2
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
01/28/09Dinesh Manocha, COMP770 Visibility Computations Visible Surface Determination Visibility Culling.
BSP Tree Supplement Jyun-Ming Chen. Fall Kd-Tree and BSP tree kd-tree is a special kind of bsp tree.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
Visibility Determination – List Priority Methods Chapter 11.
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Hierarchical Data Structure in Game Programming Yanci Zhang Game Programming Practice.
CS552: Computer Graphics Lecture 28: Solid Modeling.
School of Computing Clemson University Fall, 2012

Bounding Volume Hierarchies and Spatial Partitioning
Distance Computation “Efficient Distance Computation Between Non-Convex Objects” Sean Quinlan Stanford, 1994 Presentation by Julie Letchner.
Bounding Volume Hierarchies and Spatial Partitioning
© University of Wisconsin, CS559 Fall 2004
Hidden Surfaces Dr. Scott Schaefer.
Modeliranje kompleksnih modelov
KD Tree A binary search tree where every node is a
CSCE 441: Computer Graphics Hidden Surface Removal
Quadtrees 1.
CS679 - Fall Copyright Univ. of Wisconsin
Hidden Surface Removal
Modeliranje kompleksnih modelov
Lecture 31: Visible Surface Detection
Presentation transcript:

COMPUTER GRAPHICS NOVEMBER 5, 2014 CS 482 – FALL 2014 DATA STRUCTURES QUAD TREES OCTREES K-D TREES BINARY SPACE PARTITIONING

NOVEMBER 5, 2014: DATA STRUCTURES QUAD TREES 2D PARTITIONING Quad trees are used to partition two-dimensional space by recursively subdividing it into quadrants until each quadrant contains all or part of a single shape or reaches some minimum size (usually a pixel). Quad trees are effectively utilized in applications such as image representation, efficient 2D collision detection, and fractal image analysis. CS 482 – FALL 2014 NOVEMBER 5, 2014: DATA STRUCTURES PAGE 257

NOVEMBER 5, 2014: DATA STRUCTURES OCTREES 3D PARTITIONING Octrees extend the notion of Quad trees into three dimensions by recursively subdividing 3D space into octants until each contains all or part of a single shape or reaches some minimum size (usually a voxel). Commonly used for view 3D image representation, frustum culling, and 3D collision detection, octrees have also proven effective in reducing a scene’s color palette. CS 482 – FALL 2014 NOVEMBER 5, 2014: DATA STRUCTURES PAGE 258

NOVEMBER 5, 2014: DATA STRUCTURES OCTREES COLOR QUANTIZATION To restrict an image’s color palette to a particular size, the following octree algorithm starts by creating an octree whose leaf nodes constitute a count of how many pixels in the image possess a particular color. For each color in the scene, separate the color into 8-bit RGB components. RGB=(100, 117, 214) R: 01100100 G: 01110101 B: 11010110 Starting with the most significant bit for each primary color, use the eight 3-bit sequences to generate indices between 0 and 7 by adding R+2G+4B. 0014 1117 1103 0116 0000 1117 0014 0102 Traverse the octree structure, using the computed indices to determine which offspring to visit, adding one to the count of the color in question in the leaf node. After finishing all pixels, if the number of leaf nodes exceeds the desired palette size, start merging leaf nodes with low counts into their parent. CS 482 – FALL 2014 NOVEMBER 5, 2014: DATA STRUCTURES PAGE 259

K-D TREES BALANCED PARTITIONING K-D TREES PARTITION SPACE IN A BALANCED MANNER BY ALTERNATING BETWEEN VERTICAL AND HORIZONTAL SPLITTING OF REGIONS INTO TWO PARTS, EACH CONTAINING HALF OF THE REGION’S OBJECTS. CS 482 – FALL 2014 NOVEMBER 5, 2014: DATA STRUCTURES PAGE 260

K-D TREES NEAREST NEIGHBOR ALGORITHM K-D TREES MAY BE USED TO DETERMINE WHICH OF THE ORIGINAL OBJECTS IN THE SCENE ARE CLOSEST TO A PARTICULAR LOCATION. Recursively traverse the tree until you determine which sector the new location belongs in. The object in this sector is the initial candidate for being closest. Backtrack up the tree from the leaf node to the root, determining whether the subtree on the other side of each partition contains an object that’s closer to the location in question, which would make it the new candidate for closest. This algorithm may be used to speed up ray tracing (by determining that a ray doesn’t intersect particular portioned sectors). Once the backtracking reaches the root of the tree, the current candidate object is the actual closest object to the specified location. CS 482 – FALL 2014 NOVEMBER 5, 2014: DATA STRUCTURES PAGE 261

BINARY SPACE PARTITIONING BSP TREES Using a binary tree structure, object space can be partitioned into numerous half-spaces, and the viewpoint’s position in these half-spaces can be used to determine the order in which they should be rendered in the Painter’s Algorithm. A B C D2 E F D1 Pick a polygon and split the space into the part in front of the polygon and the part in back of it (splitting all intersected polygons) B A,D2,E,F C,D1 front back A B C D2 E F D1 A B C D2 E F D1 A B C D2 E F D1 B F C front back A D2 D1 E Continue this process B F C,D1 front back A D2,E B F C front back A D2,E D1 The process ends when each tree node contains one object (or sub-object) CS 482 – FALL 2014 NOVEMBER 5, 2014: DATA STRUCTURES PAGE 262

BINARY SPACE PARTITIONING PAINTER’S ALGORITHM IMPLEMENTATION B F C front back A D2 D1 E When determining the order in which the objects should be displayed (e.g., in a painter’s algorithm) for a particular viewpoint, merely traverse the BSP tree recursively: If the viewpoint is in front of the root, traverse Back-Root-Front; otherwise, traverse Front-Root-Back. Example 1 Example 2 A B C D2 E F D1 A B C D2 E F D1 Viewpoint Viewpoint B-subtree: in front  C-subtree, B, F-subtree C-subtree: in front  C, D1 F-subtree: in front  A, F, D2-subtree D2-subtree: in back  D2, E Complete Traversal: C, D1, B, A, F, D2, E B-subtree: in back  F-subtree, B, C-subtree F-subtree: in front  A, F, D2-subtree D2-subtree: in front  E, D2 C-subtree: in front  C, D1 Complete Traversal: A, F, E, D2, B, C, D1 CS 482 – FALL 2014 NOVEMBER 5, 2014: DATA STRUCTURES PAGE 263