Using BSP for CD Ref: BSP in deBerg et al ’ s book (url)url.

Slides:



Advertisements
Similar presentations
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Advertisements


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.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
CECS461 Computer Graphics II University of Missouri at Columbia Hidden Surface Removal.
Visibility in Computer Graphics Toni Sellarès Unversitat de Girona
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
CSE 381 – Advanced Game Programming Scene Management
Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
BSP Trees Binary space partitioning trees. Used to store a collection of objects in n- dimensional space. Tree recursively divides n-dimensional space.
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.
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.
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.
Hidden-Line Elimination Computational Geometry, WS 2006/07 Lecture 14 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
UNC Chapel Hill M. C. Lin Overview of Last Lecture About Final Course Project –presentation, demo, write-up More geometric data structures –Binary Space.
Visible-surface Detection Computer Graphics Seminar MUM
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.
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.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
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.
Graphics Pipeline Hidden Surface CMSC 435/634. Visibility We can convert simple primitives to pixels/fragments How do we know which primitives (or which.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
mo_chardesign2/ mo_chardesign2/ New iMap
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
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.
On a Few Ray Tracing like Algorithms and Structures. -Ravi Prakash Kammaje -Swansea University.
Visible-Surface Detection Jehee Lee Seoul National University.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
CS-378: Game Technology Lecture #2.2: Clipping and Hidden Surfaces Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney,
Orthogonal Range Search
Binary Space Partitioning Trees Ray Casting Depth Buffering
Ray Tracing II. HW1 Part A due October 10 Camera module Object module –Read from a file –Sphere and Light only Ray tracer module: –No shading. No reflection.
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.
Game Engine Design Quake Engine Presneted by Holmes 2002/12/2.
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.
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.
Hidden Surface Removal. 2 Goal: Determine which surfaces are visible and which are not. Z-Buffer is just one of many hidden surface removal algorithms.

BSP Trees Binary space partitioning trees.
Visible-Surface Detection Methods
Hidden Surfaces Dr. Scott Schaefer.
Modeliranje kompleksnih modelov
CSCE 441: Computer Graphics Hidden Surface Removal
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Modeliranje kompleksnih modelov
Presentation transcript:

Using BSP for CD Ref: BSP in deBerg et al ’ s book (url)url

Fall Introduction BSP: binary space partition CD: collision detection Especially useful for indoor scenes

Fall Kd-Tree and BSP tree kd-tree is a special kind of bsp tree + –

Fall BSP Tree Construction

Fall Equation at a Node Defines the hyperplane,  : ax+by+cz+d=0 Subtree polygons are classified according to the coefficients stored at (internal) nodes Coefficients are often “ normalized ” for distance computation between point and plane

Fall Elements of BSP Construction Choosing the partition plane Auto-partition: choose the partition plane from the input set of polygons It is desirable to have a balanced tree, where each leaf contains roughly the same number of polygons. However, there is some cost in achieving this. Partitioning polygons If a polygon happens to span the partition plane, it will be split into two or more pieces. A poor choice of the partition plane can result in many such splits, and a marked increase in the number of polygons.

Fall Elements of BSP Construction (cont) The decision to terminate tree construction can be: when the number of polygons in a leaf node is below a maximum value. until every polygon is placed in an internal node. maximum tree depth.

Fall S3 S2 S3 S1 SIZE=3 Different ordering generates different trees

Fall S3 S2 S2b S2a S2 S3 S3a S3b S1 S2b S3bS2a S3a S1 S2b S3b S2a S3a S2bS2a S3b S3a S3b S3a S3bS3a SIZE=5

Fall Painter ’ s Algorithm What do we mean “sort in z”? That is for a triangle, what is its representative z value? Minimum z Maximum z Polygon ’ s centroid Work cost = sort + draw An object space visibility algorithm

Fall Painter ’ s Algorithm (cont) Pros: No extra memory Relatively fast Easy to understand and implement Cons: Precision issues (and additional work to handle them) Sort stage Intersecting objects

Fall Painter ’ s Algorithm (BSP Version) S(v) need not be drawn!

Fall Example Scene

Fall A B E C F D G

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D A B 1 C 1 B 2 C 2 EFG + –

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F A B 1 C 2 B 2 EG

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A Tree completed!

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye Rendering BSP [b-to-f]

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V hv-hv- hv+hv+

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V C1 hv-hv- hv+hv+

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 hv-hv- hv+hv+

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A D hv-hv- hv+hv+

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A D hv-hv- hv+hv+

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A D hv-hv- hv+hv+

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A D B2

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A B2 E D hv-hv- hv+hv+

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A B2 E D G

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A B2 E D F G hv-hv- hv+hv+

Fall A E C1C1 F D G C2C2 B2B2 B1B1 D C1C1 F B1B1 C 2 E G B 2 A eye V B1 C1 A B2 E D F G hv-hv- hv+hv+ C2

Line Equation P 1 (x 1,y 1 ) P 2 (x 2,y 2 ) L = 0 L > 0 (left side) P(x,y) (1,0) (0,1) Check: origin on + (left) side ! Left side correspond to positive side n

Fall BSP in Games (ref)ref To account for character size, use offset planes in BSP Problems when angles between planes are large Character-environment collision detection

Fall Collision Resolution Better to solve a collision by deflecting the motion rather than stopping at the impact point Stepping and climbing

Fall Example L1 L2 L3 L1 L2 L3 (0,4) (6,0) (6,4) L1: (0,4)  (6,0) L2: (6,0)  (6,4) L3: (6,4)  (0,4) + – solid free

Fall Point-Scene Test

Fall Example L1 L2 L3 L1 L2 L3 00 <0 d0d0 d  -r r

Fall Example L1 L2 L3 L1 L2 L3 00 <0 d  -r r

Fall Example L1 L2 L3 L1 L2 L3 00 <0 d  -r solid free

Fall Example L1 L2 L3 L4 L5 L6 L1 L2 L5 L4 L3 L6 + – solid free

Fall Ex: Tree Building 1/4 L1 + – L2 L3 L7 L5 L6 L4 L2,L3,L4,L5,L6L5,L6,L7

Fall Tree Building 2/4 L1 + – L2 L3 L7 L5 L6 L4 L2,L3,L4,L5,L6L5,L6,L7 L4 L2,L3 L5,L6 L7 L5,L6

Fall Tree Building 3/4 L1 + – L2 L3 L7 L5 L6 L4 L2,L3 L5,L6 L7 L6 L5 L2 L3 L5 L6

Fall Tree Building 4/4 L1 + – L2 L3 L7 L5 L6 L4 L7 L6 L5 L2 L3 L5 L6 solid

Fall Dynamic Scenes Moving camera: no problem Moving objects: Fuchs et. al. was to specify a bounding polygon around the area that of the scene that would be changing. Doom: use z-buffer for for dynamic objects (missiles and bullets) Adding objects: no problem Deleting objects: BIG problem (ref)ref

Fall [BSP & Ray Tracing] Speed up ray tracing by: Reaching leaf nodes Determine face through which ray exits Find region-binding faces: collect all parental halfplanes Compute exit points Extending ray into next region … until the ray shoots into infinity reference