Week 13 - Wednesday CS361.

Slides:



Advertisements
Similar presentations
Everything you ever wanted to know about collision detection
Advertisements

2.4. Primitive Tests - Closest point
2.5. B ASIC P RIMITIVE I NTERSECTION Details of common forms of primitive intersection test.
8.1 Prisms, Area and Volume Prism – 2 congruent polygons lie in parallel planes corresponding sides are parallel. corresponding vertices are connected.
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
CSE 681 Bounding Volumes. CSE 681 Bounding Volumes Use simple volume enclose object(s) tradeoff for rays where there is extra intersection test for object.
Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
Collision Detection and Resolution Zhi Yuan Course: Introduction to Game Development 11/28/
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
Chapter 12: Surface Area and Volume of Solids
Computational Geometry & Collision detection
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
By: Andrew Shatz & Michael Baker Chapter 15. Chapter 15 section 1 Key Terms: Skew Lines, Oblique Two lines are skew iff they are not parallel and do not.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
OBBTree: A Hierarchical Structure for Rapid Interference Detection Gottschalk, M. C. Lin and D. ManochaM. C. LinD. Manocha Department of Computer Science,
Computer graphics & visualization Collision Detection – Narrow Phase.
12.1 Exploring Solids Geometry Mrs. Spitz Spring 2006.
Chapter 12 Surface Area and Volume. Topics We Will Discuss 3-D Shapes (Solids) Surface Area of solids Volume of Solids.
Chapter 12 Surface Area and Volume. Topics We Will Discuss 3-D Shapes (Solids) Surface Area of solids Volume of Solids.
Surface Area and Volume
Chapter 15: Geometric Solids Brian BarrDan Logan.
Chapter 12 Notes.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Introduction to 3D Graphics Lecture 4: Scenes and Scene Graphs Anthony Steed University College London.
Week 15 - Friday CS361.
Surface Area and Volume Chapter 12. Exploring Solids 12.1 California State Standards 8, 9: Solve problems involving the surface area and lateral area.
1 Ray Tracing Polyhedra ©Anthony Steed
Collision handling: detection and response
CS 325 Introduction to Computer Graphics 04 / 26 / 2010 Instructor: Michael Eckmann.
Week 13 - Friday.  What did we talk about last time?  Ray/sphere intersection  Ray/box intersection  Slabs method  Line segment/box overlap test.
Section 8.4 Nack/Jones1 Section 8.4 Polyhedrons & Spheres.
Week 13 - Monday.  What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips,
Chapter 11.1 Notes Common Core – G.GMD.4 Identify the shapes of two-dimensional cross-sections of three-dimensional objects, and identify three-dimensional.
Chapter 12 Section 1 Exploring Solids Using Properties of Polyhedra Using Euler’s Theorem Richard Resseguie GOAL 1GOAL 2.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
1 Dr. Scott Schaefer Intersecting Simple Surfaces.
Chapter Area, Pythagorean Theorem, and Volume 14 Copyright © 2013, 2010, and 2007, Pearson Education, Inc.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
1 11. Polygons Polygons 2D polygons ( 다각형 ) –Polygon sides are all straight lines lying in the same plane 3D polyhedra ( 다면체 )  chap. 12 –Polyhedra.
Advanced Computer Graphics Spring 2009
12.1 Exploring Solids.
Section 12-1 Exploring Solids. Polyhedron Three dimensional closed figure formed by joining three or more polygons at their side. Plural: polyhedra.
11-1 Space Figures and Cross Sections Objectives To recognize polyhedra and their parts To visualize cross sections of space figures.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Analytic Geometry in Three Dimensions
Graphing in 3-D Graphing in 3-D means that we need 3 coordinates to define a point (x,y,z) These are the coordinate planes, and they divide space into.
Week 13 - Wednesday CS361.
Goal 1: Using Properties of Polyhedra Goal 2: Using Euler’s Theorem
Polyhedra and Prisms.
Week 15 - Friday CS361.
Vectors and the Geometry
Copyright © Cengage Learning. All rights reserved.
Intersecting Simple Surfaces
11 Vectors and the Geometry of Space
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Parts of these slides are based on
Collision handling: detection and response
10.2 Space Coordinates and Vectors in Space
Vectors and the Geometry
12-1 Properties of Polyhedra
P.5 The Cartesian Plane Our goals are to learn
2.5. Basic Primitive Intersection
Ray Tracing Polyhedra ©Anthony Steed
Surface Area and Volume
14 Chapter Area, Pythagorean Theorem, and Volume
11 Vectors and the Geometry of Space
GPAT – Chapter 7 Physics.
Presentation transcript:

Week 13 - Wednesday CS361

Last time What did we talk about last time? Intersection testing Bounding volumes Sphere AABB OBB k-DOP SharpDX tools

Questions?

Project 4

Getting Bounding Spheres from SharpDX Models

SharpDX Picker

Intersection Methods

Ray/sphere intersection We can write the implicit sphere equation as f(p) = ||p – c|| – r = 0 p is any point on the surface c is the center r is the radius By substituting in r(t) for p, we can eventually get the equation t2 + 2tb + c = 0, where b = d • (o – c) and c = (o – c) •(o – c) – r2 If the discriminant is negative, the ray does not hit the sphere, otherwise, we can compute the location(s) where it does

Optimized ray/sphere Looking at it geometrically, we can optimize the test Find the vector from the ray origin to the center of the sphere l = c – 0 Find the squared length l2 = l • l If l2 < r2, then o is in the sphere, intersect! If not, project l onto d: s = l • d If s < 0, then the ray points away from the sphere, reject Otherwise, use the Pythagorean theorem to find the squared distance from the sphere center to the projection: m2 = l2 – s2 If m2 > r2, the ray will miss, otherwise it hits

Ray/box intersection Ray box intersection is a key element to have in your arsenal Bounding boxes are a very common form of bounding volume A ray/box intersection is often the first test you will use before going down deeper There are a couple of methods Slabs method Line segment/box overlap test

Slabs method First find the t value where the ray intersects each plane The box is made up of 3 slabs Find the min t and max t for each slab The final tmin is the max of all the tmin values The final tmax is the min of all the tmax values If tmin ≤ tmax, the ray intersects the box, otherwise it does not The idea can be extended to frustums and k-DOPs

Separating axis test For two arbitary, convex, disjoint polyhedra A and B, there exists a separating axis where the projections of the polyhedra are also disjoint Furthermore, there is an axis that is orthogonal to (making the separating plane parallel to) A face of A or A face of B or An edge from each polyhedron (take the cross product) This definition of polyhedra is general enough to include triangles and line segments

Line segment/box overlap test This method uses the separating axis test and only works for AABBs and line segments The AABB has its center at (0,0,0) and size half vector h The line segment is defined by center c and half vector w If |ci| > wi + hi for any i x,y,z then disjoint There is another test for each axis that is the cross product of the x, y, and z axis and w If any test passes, then disjoint Only if all tests fail, then overlap

Triangle representation One way to represent a triangle is with barycentric coordinates For triangles, barycentric coordinates are weights that describe where in the triangle you are, relative to the three vertices These weights are commonly labeled u, v, and w and have the following properties u ≥ 0, v ≥ 0, w ≥ 0 and u + v + w ≤ 1

Ray triangle intersection We represent a point f(u,v) on a triangle with the following explicit formula f(u,v) = (1 – u – v)p0 + up1 + vp2 Then, setting the ray equal to this equation gives o + td = (1 – u – v)p0 + up1 + vp2 This is simply a vector representation of three equations with three unknowns If the solution has a positive t, and u and v between 0 and 1, it's an intersection

Ray/polygon intersection First we compute the intersection of the ray and the plane of the polygon Then we determine if that point is inside the polygon (in 2D) The plane of the polygon is np • x + dp = 0 np is the plane normal dp is the distance along the normal from the origin to the plane Intersection is found by: np • (o + td) + dp = 0 Then project onto xy, xz, or yz plane (whichever maximizes polygon area) and see if the point is in the polygon

Crossings test If you want to see if a point is inside a polygon, you shoot a ray from that point along the positive x axis If it intersects edges of the p0lygon an even number of times, it is outside, otherwise it is inside Problems can happen if a ray intersects a vertex, so we treat all vertices with y ≥ 0 as being strictly above the x axis

Plane/box intersection Simplest idea: Plug all the vertices of the box into the plane equation n • x + d = 0 If you get positive and negative values, then the box is above and below the plane, intersection! There are more efficient ways that can be done by projecting the box onto the plane

Quiz

Upcoming

Next time… Finish intersection test methods

Reminders Keep working on Project 4 Keep reading Chapter 16