Spatial Data Structures

Similar documents
Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

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

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

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

Ray Tracing Acceleration Data Structures

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

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

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

Hidden Surface Elimination: BSP trees

Acceleration Data Structures

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

Computer Graphics. Bing-Yu Chen National Taiwan University

Accelerated Raytracing

More Hidden Surface Removal

Intersection Acceleration

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

Speeding up your game

CS535 Fall Department of Computer Science Purdue University

Collision and Proximity Queries

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

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

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

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

Spatial Data Structures and Acceleration Algorithms

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

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

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

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

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

Advanced 3D-Data Structures

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

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

Collision Detection based on Spatial Partitioning

Computer Graphics. - Spatial Index Structures - Philipp Slusallek

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

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

Drawing the Visible Objects

improving raytracing speed

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

Accelerating Ray Tracing

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

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

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

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

Speeding Up Ray Tracing. Optimisations. Ray Tracing Acceleration

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

Ray Tracing: Intersection

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

CS 431/636 Advanced Rendering Techniques

Acceleration Data Structures for Ray Tracing

MSBVH: An Efficient Acceleration Data Structure for Ray Traced Motion Blur

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

9. Visible-Surface Detection Methods

Hidden surface removal. Computer Graphics

COMP 175: Computer Graphics April 11, 2018

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Ray Tracing Acceleration. CS 4620 Lecture 20

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

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

Advanced Ray Tracing

Universiteit Leiden Computer Science

Simulation in Computer Graphics Space Subdivision. Matthias Teschner

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

Spatial Data Structures and Acceleration Algorithms

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

VIII. Visibility algorithms (II)

A Model to Evaluate Ray Tracing Hierarchies

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

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

Accelerating Ray-Tracing

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

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

Ray Intersection Acceleration

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

Bounding Volume Hierarchies

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

Lecture 2 - Acceleration Structures

Lecture 11: Ray tracing (cont.)

Acceleration Data Structures. Michael Doggett Department of Computer Science Lund university

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

Using Bounding Volume Hierarchies Efficient Collision Detection for Several Hundreds of Objects

Ray Tracing Acceleration. CS 4620 Lecture 22

Geometric Queries for Ray Tracing

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Geometric Structures 2. Quadtree, k-d stromy

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

Geometric data structures:

Bounding Volume Hierarchies. CS 6965 Fall 2011

Geometric Algorithms. Geometric search: overview. 1D Range Search. 1D Range Search Implementations

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

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Algorithms for GIS:! Quadtrees

CSE 554 Lecture 5: Contouring (faster)

Acceleration Structures. CS 6965 Fall 2011

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

Culling. Computer Graphics CSE 167 Lecture 12

Transcription:

CSCI 480 Computer Graphics Lecture 7 Spatial Data Structures Hierarchical Bounding Volumes Regular Grids BSP Trees [Ch. 0.] March 8, 0 Jernej Barbic University of Southern California http://www-bcf.usc.edu/~jbarbic/cs480-s/ 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) Spatial Data Structures Bounding Volumes 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 0x, 00x, or more 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: Sphere Axis-aligned Bounding Box (AABB) Oriented Bounding Box (OBB) 6-dop Convex Hull 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 Hierarchical Bounding Volumes With simple bounding volumes, ray casting still 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)) bad 5 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 Spatial Subdivision Bounding volumes enclose objects, recursively Alternatively, divide space (as opposed to objects) For each segment of space, keep a list of intersecting surfaces or objects Basic techniques: 7 Uniform Spatial Sub Quadtree/Octree kd-tree BSP-tree 8 Grids D array of cells (voxels) that tile space Each cell points to all intersecting surfaces Intersection algorithm steps from cell to cell 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 any closer intersection with other objects If not, C could be missed (yellow ray) A B C 9 0 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 algorithms like Bresenham s for efficient traversal Non-uniform spatial subdivision more flexible Can adjust to objects that are present Outline

Quadtrees Generalization of binary trees in D 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 Generalization of quadtree in D 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 4 Assessment for Ray Tracing Grids Easy to implement Require a lot of memory Poor results for non-homogeneous scenes 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 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 dimensions, split with any line In k dims. split with k- dimensional hyperplane Particularly useful for painter s algorithm Can also be used for ray tracing 5 6 Outline BSP Trees Split space with any line (D) or plane (D) 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 How to balance the tree 7 8

Building a BSP Tree Use hidden surface removal as intuition Using line or line as root is easy Splitting of surfaces Using line as root requires splitting Line A D C Line Line a b a Line Line Viewpoint B A C D a BSP tree using as root B the subdivision of space it implies Line Line b Viewpoint 9 0 Building a Good Tree Naive partitioning of n polygons yields O(n ) polygons (in D) Algorithms with O(n ) 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? 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 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) 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 viewing frustrum Hierarchical bounding volumes 4 4

Data Structure Demos BSP Tree construction http://symbolcraft.com/graphics/bsp/index.html KD Tree construction http://donar.umiacs.umd.edu/quadtree/points/kdtree.html Real-Time and Interactive Ray Tracing Interactive ray tracing via space subdivision http://www.cs.utah.edu/~reinhard/egwr/ State of the art in interactive ray tracing http://www.cs.utah.edu/~shirley/irt/ 5 6 Summary 7 5