BSP Trees Binary space partitioning trees. Used to store a collection of objects in n- dimensional space. Tree recursively divides n-dimensional space.

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

Parallel Lines & Transversals
1 Binary Space Partition Trees ©Anthony Steed, Yiorgos Chrysanthou
Two Segments Intersect?
Computational Geometry
Collisions and Intersections When objects move, test for collision. When projecting surfaces, check for intersections. (Many slides adapted from Amitabh.
INTERVAL TREE & SEGMENTATION TREE

Computer Graphics Scan Conversion Polygon Faculty of Physical and Basic Education Computer Science Dep Lecturer: Azhee W. MD.
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
Brute-Force Triangulation
AreaPortal Visibility By Filami. Objectives Practice the techniques of visibility determination using Area Portals; Develop an experimental application.
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.
Convex Hull obstacle start end Convex Hull Convex Hull
CSE 381 – Advanced Game Programming Scene Management
Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Clipping II, Hidden Surfaces.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Lecture 5: Orthogonal Range Searching Computational Geometry Prof. Dr. Th. Ottmann 1 Orthogonal Range Searching 1.Linear Range Search : 1-dim Range Trees.
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.
UNC Chapel Hill M. C. Lin Overview of Last Lecture About Final Course Project –presentation, demo, write-up More geometric data structures –Binary Space.
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.
Chapter 4: Straight Line Drawing Ronald Kieft. Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?
Spatial Data Structure: Quadtree, Octree,and BSP tree Mengxia Zhu Fall 2007.
Hidden Surface Removal
BSP Trees, Quadtrees & Octrees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, January 28, 2004.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
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.
Polygons Polygons. Polygon Any shape where every segment intersects exactly two others at its endpoints.
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
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.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
Using BSP for CD Ref: BSP in deBerg et al ’ s book (url)url.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
Implementation II.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
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.
Computer Graphics I, Fall 2010 Implementation II.
UNC Chapel Hill M. C. Lin Delaunay Triangulations Reading: Chapter 9 of the Textbook Driving Applications –Height Interpolation –Constrained Triangulation.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
The Visibility Problem and Binary Space Partition.
BSP Tree Supplement Jyun-Ming Chen. Fall Kd-Tree and BSP tree kd-tree is a special kind of bsp tree.
Solid Modeling Dr. Scott Schaefer.
3D Object Representations. Introduction Line and circle and polygon algorithms- represented simple and smooth object. Some Natural object are neither.
Visibility Determination – List Priority Methods Chapter 11.
Polygon Triangulation
Minkowski Sums and Distance Computation Eric Larsen COMP
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
CS552: Computer Graphics Lecture 28: Solid Modeling.
Visibility-Driven View Cell Construction Oliver Mattausch, Jiří Bittner, Michael Wimmer Institute of Computer Graphics and Algorithms Vienna University.

Geometric Data Structures
BSP Trees Binary space partitioning trees.
Hidden Surfaces Dr. Scott Schaefer.
Modeliranje kompleksnih modelov
Graphics Pipeline Hidden Surfaces
KD Tree A binary search tree where every node is a
Orthogonal Range Searching and Kd-Trees
CSCE 441: Computer Graphics Hidden Surface Removal
Hidden Surface Removal
Modeliranje kompleksnih modelov
Lecture 31: Visible Surface Detection
Presentation transcript:

BSP Trees Binary space partitioning trees. Used to store a collection of objects in n- dimensional space. Tree recursively divides n-dimensional space using (n-1)-dimensional hyperplanes.

Space Partitioning n-dimensional space splitting hyperplane (n-1)-dimensional a 1 x 1 + a 2 x 2 + … a n x n + a n+1 = 0 ax + by + c = 0 (2D) ax+by+cz+d = 0 (3D)

Space Partitioning n-dimensional space +ve half space ax + by + c > 0 ax+by+cz+d > 0 -ve half space ax + by + c < 0 ax+by+cz+d < 0 coincident ax + by + c = 0 ax+by+cz+d = 0

Classifying Object z In 2D, ph is the line ax + by + c = 0.  Compute ax + by + c for all vertices of z.  If all values are = 0; z is coincident to ph.  If all values are <= 0; z is left of ph.  If all values are >= 0; z is right of ph.  Otherwise, z spans ph and is to be split by finding intersection points with ph.

2D a b c d g e f h Equation of ph is x – 6 = 0 6

2D a b c d g e f h Equation of ph is y –x –2 = 0 2

3D x z y Equation of ph is z –2 = 0 General: ax + by + cz + d = 0

Space Partitioning n-dimensional space -ve+ve -ve +ve coincident list

Objects in 2D a b c d g e f h

a b c d g e f h

a b c d g e f h a-de-h

Objects in 2D a b c d g e f h a-de-h

Objects in 2D a b c d g e f h a-b e-fc-dg-h

Objects in 2D a b c d g e f h abcd e f gh

Collision Detection a b c d g e f h abcd e f gh

Visibility Ordering a b c d g e f h abcd e f gh

BSP Tree Construction Select partitioning hyperplanes. Partition objects. Repeat on partitions.

Partitioning Hyperplane Selection Face of an object. a b c d g e f h

Partitioning Hyperplane Selection Face of an object. a b c d g e f h

Autopartition Only object faces are used as splitting hyperplanes a b c d g e f h

Partitioning Hyperplane Selection Axis-aligned orthogonal hyperplanes a b c d g e f h

Partitioning Hyperplane Selection Axis-aligned orthogonal hyperplanes a b c d g e f h

Partitioning Hyperplane Selection Balance # objects (pieces) on each side of hyperplane Minimize increase in number of objects/pieces. a b c d g e f h

3D Example

Another 3D Example

BSP Tree of an Object Each leaf represents a region that is either wholly inside or outside the object. Object surface is considered inside object. Surface planes are used as partitioning planes. Orient partitioning hyperplanes so that interior is to left. a a

BSP Tree of an Object Each leaf represents a region that is either wholly inside or outside the object. Object surface is considered inside object. Surface planes are used as partitioning planes. Orient partitioning hyperplanes so that interior is to left. a a b b

BSP Tree of an Object Each leaf represents a region that is either wholly inside or outside the object. Object surface is considered inside object. Surface planes are used as partitioning planes. Orient partitioning hyperplanes so that interior is to left. a a b b c c

BSP Tree of an Object Each leaf represents a region that is either wholly inside or outside the object. Object surface is considered inside object. Surface planes are used as partitioning planes. Orient partitioning hyperplanes so that interior is to left. a a b b c c d d

BSP Tree of an Object Each leaf represents a region that is either wholly inside or outside the object. Object surface is considered inside object. Surface planes are used as partitioning planes. Orient partitioning hyperplanes so that interior is to left. a a b b c d e d e c

BSP Tree of an Object Each leaf represents a region that is either wholly inside or outside the object. Object surface is considered inside object. Surface planes are used as partitioning planes. Orient partitioning hyperplanes so that interior is to left. a a b b c d f e d c f e

BSP Tree of an Object Orient partitioning hyperplanes so that interior is to left. With this orientation, left leaves are interior and right leaves are exterior. a a b b c d f e d e f c

BSP Tree Construction Node structure:  ph = equation of partitioning hyperplane  cList = list of objects coincident with ph  leftChild  rightChild

BSP Tree Construction BSPtree(O) // O is object set if O is empty, return null; Create a new node N; N.ph = partitioning hyperplane for O; lList = rList = N.cList = null; for each object z in O do if z is coincident to ph or |O| = 1, add z to N.cList; if z is left of ph, add z to lList; if z is right of ph, add z to rList; if z spans ph, split z and add pieces to lList and rList; N.leftChild = BSPTree(lList); N.rightChild = BSPTree(rList); return N;

Basic Draw Back to Front draw(N) if eye left of N.ph {draw(N.rightChild); draw N.cList; draw(N.leftChild)}; else if eye right of N.ph {draw(N.leftChild); draw N.cList; draw(N.rightChild)}; else // eye coincident to N.ph {draw(N.leftChild); draw(N.rightChild)};

Basic Draw Front to Back draw(N) if eye left of N.ph {draw(N.leftChild); draw N.cList; draw(N.rightChild)}; else if eye right of N.ph {draw(N.rightChild); draw N.cList; draw(N.leftChild)}; else // eye coincident to N.ph {draw(N.rightChild); draw(N.leftChild)};

Randomization Autopartition. Splitting hyperplane is randomly selected to be one of the object faces. Lines in 2D; planes in 3D. a b g e h

Randomization—2D Analysis Start with n (nonintersecting) line segments. Total number of line segments in autopartition bsp is expected to be <= n + 2n ln n. If this bound is exceeded; rerun construction. Expected number of construction rounds before this bound is not exceeded is n = 29

So, number of nodes in bsp is O(n log n). Construction time at each node is O(n) as at each node O(n) segments need to be partitioned. Time is O(n 2 log n) per construction round. 2 rounds expected. Expected complexity is O(n 2 log n). Randomization —2D Analysis n = 29

Randomization—3D Analysis Start with n (nonintersecting) triangles. Total number of triangles in autopartition bsp is O(n 2 ). There exist n-triangle examples for which every autopartition has  (n 2 ) triangles. n = 24

Free Partitions One that does not split an object. Do a free partition whenever possible; otherwise, randomly select a segment/face as partitioning hyperplane

Free Partitions Using an object face, that crosses a BSP region, results in a free partition of that BSP region. Portion of black segment bounded by red (previous) splitting lines may be used to partition blue region. No segments in blue region can be split as line segments are non- intersecting.

Free Partitions Using an object face, that crosses a BSP region, results in a free partition of that BSP region. When green segment is used to partition blue region, segments in blue region may be split.