Spatial Data Structures

Similar documents
Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Ray Tracing Acceleration Data Structures

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Intersection Acceleration

Lecture 17: Solid Modeling.... a cubit on the one side, and a cubit on the other side Exodus 26:13

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

More Hidden Surface Removal

Computer Graphics. Bing-Yu Chen National Taiwan University

Hidden Surface Elimination: BSP trees

Accelerated Raytracing

Advanced 3D-Data Structures

CPSC / Sonny Chan - University of Calgary. Collision Detection II

Ray Tracing with Spatial Hierarchies. Jeff Mahovsky & Brian Wyvill CSC 305

Speeding up your game

Acceleration Data Structures

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics

CSG obj. oper3. obj1 obj2 obj3. obj5. obj4

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Accelerating Geometric Queries. Computer Graphics CMU /15-662, Fall 2016

CS535 Fall Department of Computer Science Purdue University

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Curves and Surfaces Computer Graphics I Lecture 10

Accelerating Ray Tracing

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Acceleration. Welcome!

Ray Tracing: Intersection

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

VIII. Visibility algorithms (II)

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Lecture 11: Ray tracing (cont.)

Spatial Data Structures and Acceleration Algorithms

Advanced Ray Tracing

CPSC GLOBAL ILLUMINATION

Ray-tracing Acceleration. Acceleration Data Structures for Ray Tracing. Shadows. Shadows & Light Sources. Antialiasing Supersampling.

Computer Graphics. - Spatial Index Structures - Philipp Slusallek

Point Cloud Filtering using Ray Casting by Eric Jensen 2012 The Basic Methodology

Solid Modeling. Ron Goldman Department of Computer Science Rice University

COMP 175: Computer Graphics April 11, 2018

Acceleration Data Structures for Ray Tracing

Polygon Meshes and Implicit Surfaces

Polygon Meshes and Implicit Surfaces

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Implicit Surfaces & Solid Representations COS 426

Speeding Up Ray Tracing. Optimisations. Ray Tracing Acceleration

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Spatial Data Structures and Speed-Up Techniques. Ulf Assarsson Department of Computer Science and Engineering Chalmers University of Technology

9. Visible-Surface Detection Methods

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

Ray Genealogy. Raytracing: Performance. Bounding Volumes. Bounding Volume. Acceleration Classification. Acceleration Classification

Computer Graphics. - Ray-Tracing II - Hendrik Lensch. Computer Graphics WS07/08 Ray Tracing II

Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

Homework 1: Implicit Surfaces, Collision Detection, & Volumetric Data Structures. Loop Subdivision. Loop Subdivision. Questions/Comments?

Topics. Ray Tracing II. Intersecting transformed objects. Transforming objects

Parallel Physically Based Path-tracing and Shading Part 3 of 2. CIS565 Fall 2012 University of Pennsylvania by Yining Karl Li

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Drawing the Visible Objects

CS 352: Computer Graphics. Hierarchical Graphics, Modeling, And Animation

11/1/13. Polygon Meshes and Implicit Surfaces. Shape Representations. Polygon Models in OpenGL. Modeling Complex Shapes

Dynamic Spatial Partitioning for Real-Time Visibility Determination. Joshua Shagam Computer Science

Graphics 2009/2010, period 1. Lecture 8: ray tracing

Collision and Proximity Queries

Hidden surface removal. Computer Graphics

Collision Detection based on Spatial Partitioning

Ray Tracing Acceleration. CS 4620 Lecture 20

Logistics. CS 586/480 Computer Graphics II. Questions from Last Week? Slide Credits

Visible-Surface Detection Methods. Chapter? Intro. to Computer Graphics Spring 2008, Y. G. Shin

Simulation in Computer Graphics Space Subdivision. Matthias Teschner

Computer Graphics I Lecture 11

Today. Acceleration Data Structures for Ray Tracing. Cool results from Assignment 2. Last Week: Questions? Schedule

Universiteit Leiden Computer Science

Collision Detection. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

Questions from Last Week? Extra rays needed for these effects. Shadows Motivation

CS 431/636 Advanced Rendering Techniques

Accelerating Ray-Tracing

Spatial Data Structures. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

Computer Graphics Ray Casting. Matthias Teschner

Topics. Ray Tracing II. Transforming objects. Intersecting transformed objects

Space-based Partitioning Data Structures and their Algorithms. Jon Leonard

Computer Graphics II

MODELING AND HIERARCHY

Geometric Representations. Stelian Coros

Bounding Volume Hierarchies. CS 6965 Fall 2011

Lecture 2 - Acceleration Structures

improving raytracing speed

Second degree equations - quadratics. nonparametric: x 2 + y 2 + z 2 = r 2

11 - Spatial Data Structures

The Traditional Graphics Pipeline

Transcription:

15-462 Computer Graphics I Lecture 17 Spatial Data Structures Hierarchical Bounding Volumes Regular Grids Octrees BSP Trees Constructive Solid Geometry (CSG) April 1, 2003 [Angel 9.10] Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/

Ray Tracing Acceleration Faster intersections Faster ray-object intersections Object bounding volume Efficient intersectors Fewer ray-object intersections Hierarchical bounding volumes (boxes, spheres) Spatial data structures Directional techniques Fewer rays Adaptive tree-depth control Stochastic sampling Generalized rays (beams, cones) 04/01/2003 15-462 Graphics I 2

Spatial Data Structures Data structures to store geometric information Sample applications Collision detection Location queries Chemical simulations Rendering Spatial data structures for ray tracing Object-centric data structures (bounding volumes) Space subdivision (grids, octrees, BSP trees) Speed-up of 10x, 100x, or more 04/01/2003 15-462 Graphics I 3

Bounding Volumes Wrap complex objects in simple ones Does ray intersect bounding box? No: does not intersect enclosed objects Yes: calculate intersection with enclosed objects Common types Boxes, axis-aligned Boxes, oriented Spheres Finite intersections or unions of above 04/01/2003 15-462 Graphics I 4

Selection of Bounding Volumes Effectiveness depends on: Probability that ray hits bounding volume, but not enclosed objects (tight fit is better) Expense to calculate intersections with bounding volume and enclosed objects Amortize calculation of bounding volumes Use heuristics good bad 04/01/2003 15-462 Graphics I 5

Hierarchical Bounding Volumes With simple bounding volumes, ray casting still has requires O(n) intersection tests Idea use tree data structure Larger bounding volumes contain smaller ones etc. Sometimes naturally available (e.g. human figure) Sometimes difficult to compute Often reduces complexity to O(log(n)) 04/01/2003 15-462 Graphics I 6

Ray Intersection Algorithm Recursively descend tree If ray misses bounding volume, no intersection If ray intersects bounding volume, recurse with enclosed volumes and objects Maintain near and far bounds to prune further Overall effectiveness depends on model and constructed hierarchy 04/01/2003 15-462 Graphics I 7

Spatial Subdivision Bounding volumes enclose objects, recursively Alternatively, divide space For each segment of space keep list of intersecting surfaces or objects Basic techniques Regular grids Octrees (axis-aligned, non-uniform partition) BSP trees (recursive Binary Space Partition, planes) 04/01/2003 15-462 Graphics I 8

Grids 3D array of cells (voxels) that tile space Each cell points to all intersecting surfaces Intersection alg steps from cell to cell 04/01/2003 15-462 Graphics I 9

Caching Intersection points Objects can span multiple cells For A need to test intersection only once For B need to cache intersection and check next cell for closer one If not, C could be missed (yellow ray) A B C 04/01/2003 15-462 Graphics I 10

Assessment of Grids Poor choice when world is non-homogeneous Size of grid Too small: too many surfaces per cell Too large: too many empty cells to traverse Can use alg like Bresenham s for efficient traversal Non-uniform spatial subdivision more flexible Can adjust to objects that are present 04/01/2003 15-462 Graphics I 11

Outline Hierarchical Bounding Volumes Regular Grids Octrees BSP Trees Constructive Solid Geometry (CSG) 04/01/2003 15-462 Graphics I 12

Quadtrees Generalization of binary trees in 2D Node (cell) is a square Recursively split into 4 equal sub-squares Stop subdivision based on number of objects Ray intersection has to traverse quadtree More difficult to step to next cell 04/01/2003 15-462 Graphics I 13

Octrees Generalization of quadtree in 3D Each cell may be split into 8 equal sub-cells Internal nodes store pointers to children Leaf nodes store list of surfaces Adapts well to non-homogeneous scenes 04/01/2003 15-462 Graphics I 14

Assessment for Ray Tracing Grids Easy to implement Require a lot of memory Poor results for non-homogeneous scense Octrees Better on most scenes (more adaptive) Alternative: nested grids Spatial subdivision expensive for animations Hierarchical bounding volumes Natural for hierarchical objects Better for dynamic scenes 04/01/2003 15-462 Graphics I 15

Other Spatial Subdivision Techniques Relax rules for quadtrees and octrees k-dimensional tree (k-d tree) Split at arbitrary interior point Split one dimension at a time Binary space partitioning tree (BSP tree) In 2 dimensions, split with any line In k dims. split with k-1 dimensional hyperplane Particularly useful for painter s algorithm Can also be used for ray tracing [see handout] 04/01/2003 15-462 Graphics I 16

Outline Hierarchical Bounding Volumes Regular Grids Octrees BSP Trees Constructive Solid Geometry (CSG) 04/01/2003 15-462 Graphics I 17

BSP Trees Split space with any line (2D) or plane (3D) Applications Painters algorithm for hidden surface removal Ray casting Inherent spatial ordering given viewpoint Left subtree: in front, right subtree: behind Problem: finding good space partitions Proper ordering for any viewpoint Balance tree For details, see http://reality.sgi.com/bspfaq/ 04/01/2003 15-462 Graphics I 18

Building a BSP Tree Use hidden surface removal as intuition Using line 1 or line 2 as root is easy Line 1 3 2 1 1 A D C Line 3 Line 2 B A C D a BSP tree using 2 as root 3 B the subdivision of space it implies 2 Viewpoint 04/01/2003 15-462 Graphics I 19

Splitting of surfaces Using line 3 as root requires splitting Line 1 3 Line 2a 2b 2a Line 3 Line 2b 1 Viewpoint 04/01/2003 15-462 Graphics I 20

Building a Good Tree Naive partitioning of n polygons yields O(n 3 ) polygons (in 3D) Algorithms with O(n 2 ) increase exist Try all, use polygon with fewest splits Do not need to split exactly along polygon planes Should balance tree More splits allow easier balancing Rebalancing? 04/01/2003 15-462 Graphics I 21

Painter s Algorithm with BSP Trees Building the tree May need to split some polygons Slow, but done only once Traverse back-to-front or front-to-back Order is viewer-direction dependent What is front and what is back of each line changes Determine order on the fly 04/01/2003 15-462 Graphics I 22

Details of Painter s Algorithm Each face has form Ax + By + Cz + D Plug in coordinates and determine Positive: front side Zero: on plane Negative: back side Back-to-front: inorder traversal, farther child first Front-to-back: inorder traversal, near child first Do backface culling with same sign test Clip against visible portion of space (portals) 04/01/2003 15-462 Graphics I 23

Clipping With Spatial Data Structures Accelerate clipping Goal: accept or rejects whole sets of objects Can use an spatial data structures Scene should be mostly fixed Terrain fly-through Gaming Hierarchical bounding volumes Octrees 04/01/2003 15-462 Graphics I 24

Data Structure Demos BSP Tree construction http://symbolcraft.com/graphics/bsp/index.html KD Tree construction http://www.rolemaker.dk/nonrolemaker/uni/algogem/kdtree.htm 04/01/2003 15-462 Graphics I 25

Real-Time and Interactive Ray Tracing Interactive ray tracing via space subdivision http://www.cs.utah.edu/~reinhard/egwr/ Interactive ray tracing with good hardware http://www.cs.utah.edu/vissim/projects/raytracing/ 04/01/2003 15-462 Graphics I 26

Outline Hierarchical Bounding Volumes Regular Grids Octrees BSP Trees Constructive Solid Geometry (CSG) 04/01/2003 15-462 Graphics I 27

Constructive Solid Geometry (CSG) Generate complex shapes with simple building blocks (boxes, spheres, cylinders, cones,...) Particularly applicable for machined objects Efficient with ray tracing 04/01/2003 15-462 Graphics I 28

Example: A CSG Train Brian Wyvill et al., U. of Calgary 04/01/2003 15-462 Graphics I 29

Boolean Operations Intersection and union Subtraction Example: drilling a hole Subtract From To get 04/01/2003 15-462 Graphics I 30

CSG Trees Set operations yield tree-based representation Use these trees for ray/objects intersections Think about how! 04/01/2003 15-462 Graphics I 31

Implicit Functions for Booleans Solid as implicit function, F(x,y,z) F(x, y, z) < 0 interior F(x, y, z) = 0 surface F(x, y, z) > 0 exterior For CSG, use F(x, y, z) 2 {-1, 0, 1} F A Å B (p) = max (F A (p), F B (p)) F A [ B (p) = min (F A (p), F B (p)) F A B (p) = max (F A (p), - F B (p)) 04/01/2003 15-462 Graphics I 32

Summary Hierarchical Bounding Volumes Regular Grids Octrees BSP Trees Constructive Solid Geometry (CSG) 04/01/2003 15-462 Graphics I 33

Preview Radiosity Assignment 6 due Thursday Assignment 7 (ray tracing) out Thursday 04/01/2003 15-462 Graphics I 34