Procedural, Collision University of British Columbia

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
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/
Computer graphics & visualization Collisions. computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
CSE 381 – Advanced Game Programming Scene Management
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures III, Procedural.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Collision Detection Week.
Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Particle Systems 1 Adapted from: E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
1 Geometry A line in 3D space is represented by  S is a point on the line, and V is the direction along which the line runs  Any point P on the line.
Oct 26, Fall 2006IAT 4101 Collision Detection. Oct 26, Fall 2006IAT 4102 Collision Detection  Essential for many games –Shooting –Kicking, punching,
OBBTree: A Hierarchical Structure for Rapid Interference Detection Gottschalk, M. C. Lin and D. ManochaM. C. LinD. Manocha Department of Computer Science,
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
Oct 3, Fall 2005Game Design1 Collision Detection.
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Picking II, Collision.
Collision Detection David Johnson Cs6360 – Virtual Reality.
Week 1 - Friday.  What did we talk about last time?  C#  SharpDX.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
CSE 381 – Advanced Game Programming Quickhull and GJK.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Textures III Week 10,
Particle Systems – Technique for Modeling a Class of Fuzzy Objects Craig Schroeder Computer Graphics I April 22, 2004.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
Collision/Acceleration University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
12/4/2001CS 638, Fall 2001 Today Managing large numbers of objects Some special cases.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 6, 2002 Day 10.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Procedural Approaches.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Procedural Approaches.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Computer Game Design and Development
Representation and modelling 3 – landscape specialisations 4.1 Introduction 4.2 Simple height field landscapes 4.3 Procedural modeling of landscapes- fractals.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Procedural II, Collision.
11/20/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Collision Detection Overview Player-Environment handling.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Collision II, Antialiasing.
Bounding Volume Hierarchy. The space within the scene is divided into a grid. When a ray travels through a scene, it only passes a few boxes within the.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Textures III, Procedural.
Particle Systems Reference: Reeves W.: "Particle Systems -- A Technique for Modelling a Class of Fuzzy Objets", Computer Graphics, 17(3), pp ,
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles.
Scene Manager Creates and places movable objects like lights and cameras so as to access them efficiently, e.g. for rendering. Loads and assembles world.
Bounding Volume Hierarchies and Spatial Partitioning
Week 2 - Monday CS361.
CS679 - Fall Copyright Univ. of Wisconsin
STBVH: A Spatial-Temporal BVH for Efficient Multi-Segment Motion Blur
Collision Detection Spring 2004.
Bounding Volume Hierarchies and Spatial Partitioning
3D Object Representations
2.1. Collision Detection Overview.
Jim X. Chen George Mason University
© University of Wisconsin, CS559 Fall 2004
Computer Animation Algorithms and Techniques
Collision Detection.
Procedural Approaches Curves Week 12, Fri 21 Nov 2003
Particle Systems - A Technique for Modeling a Class of Fuzzy Objects
David Johnson Cs6360 – Virtual Reality
Dr. Jim Rowan ITEC 2110 Vector Graphics II
GPAT – Chapter 7 Physics.
Presentation transcript:

Procedural, Collision University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner Procedural, Collision http://www.ugrad.cs.ubc.ca/~cs314/Vjan2016

Procedural Approaches

Procedural Textures generate “image” on the fly, instead of loading from disk often saves space allows arbitrary level of detail

Procedural Modeling textures, geometry procedural approach nonprocedural: explicitly stored in memory procedural approach compute something on the fly often less memory cost visual richness fractals, particle systems, noise

Fractal Landscapes fractals: not just for “showing math” triangle subdivision vertex displacement recursive until termination condition http://www.fractal-landscapes.co.uk/images.html

Self-Similarity infinite nesting of structure on all scales

Fractal Dimension D = log(N)/log(r) N = measure, r = subdivision scale Hausdorff dimension: noninteger Koch snowflake coastline of Britain D = log(N)/log(r) D = log(4)/log(3) = 1.26 http://www.vanderbilt.edu/AnS/psychology/cogsci/chaos/workshop/Fractals.html

Language-Based Generation L-Systems: after Lindenmayer Koch snowflake: F :- FLFRRFLF F: forward, R: right, L: left Mariano’s Bush: F=FF-[-F+F+F]+[+F-F-F] } angle 16 http://spanky.triumf.ca/www/fractint/lsys/plants.html                                                                                                       

1D: Midpoint Displacement divide in half randomly displace scale variance by half http://www.gameprogrammer.com/fractal.html

2D: Diamond-Square fractal terrain with diamond-square approach generate a new value at midpoint average corner values + random displacement scale variance by half each time

Particle Systems loosely defined key criteria modeling, or rendering, or animation key criteria collection of particles random element controls attributes position, velocity (speed and direction), color, lifetime, age, shape, size, transparency predefined stochastic limits: bounds, variance, type of distribution

Particle System Examples objects changing fluidly over time fire, steam, smoke, water objects fluid in form grass, hair, dust physical processes waterfalls, fireworks, explosions group dynamics: behavioral birds/bats flock, fish school, human crowd, dinosaur/elephant stampede

Particle Systems Demos general particle systems http://www.wondertouch.com boids: bird-like objects http://www.red3d.com/cwr/boids/ many shaders http://www.shadertoy.com

Particle Life Cycle generation dynamics death randomly within “fuzzy” location initial attribute values: random or fixed dynamics attributes of each particle may vary over time color darker as particle cools off after explosion can also depend on other attributes position: previous particle position + velocity + time death age and lifetime for each particle (in frames) or if out of bounds, too dark to see, etc

Particle System Rendering expensive to render thousands of particles simplify: avoid hidden surface calculations each particle has small graphical primitive (blob) pixel color: sum of all particles mapping to it some effects easy temporal anti-aliasing (motion blur) normally expensive: supersampling over time position, velocity known for each particle just render as streak

Procedural Approaches Summary Perlin noise covered in previous texturing lectures fractals L-systems particle systems not at all a complete list! big subject: entire classes on this alone

Collision/Acceleration

Collision Detection do objects collide/intersect? static, dynamic picking is simple special case of general collision detection problem (covered next) check if ray cast from cursor position collides with any object in scene simple shooting projectile arrives instantly, zero travel time better: projectile and target move over time see if collides with object during trajectory

Collision Detection Applications determining if player hit wall/floor/obstacle terrain following (floor), maze games (walls) stop them walking through it determining if projectile has hit target determining if player has hit target punch/kick (desired), car crash (not desired) detecting points at which behavior should change car in the air returning to the ground cleaning up animation making sure a motion-captured character’s feet do not pass through the floor simulating motion physics, or cloth, or something else

From Simple to Complex boundary check set of fixed barriers perimeter of world vs. viewpoint or objects 2D/3D absolute coordinates for bounds simple point in space for viewpoint/objects set of fixed barriers walls in maze game 2D/3D absolute coordinate system set of moveable objects one object against set of items missile vs. several tanks multiple objects against each other punching game: arms and legs of players room of bouncing balls

Naive General Collision Detection for each object i containing polygons p test for intersection with object j containing polygons q for polyhedral objects, test if object i penetrates surface of j test if vertices of i straddle polygon q of j if straddle, then test intersection of polygon q with polygon p of object i very expensive! O(n2)

Fundamental Design Principles fast simple tests first, eliminate many potential collisions test bounding volumes before testing individual triangles exploit locality, eliminate many potential collisions use cell structures to avoid considering distant objects use as much information as possible about geometry spheres have special properties that speed collision testing exploit coherence between successive tests things don’t typically change much between two frames

Example: Player-Wall Collisions first person games must prevent the player from walking through walls and other obstacles most general case: player and walls are polygonal meshes each frame, player moves along path not known in advance assume piecewise linear: straight steps on each frame assume player’s motion could be fast

Stupid Algorithm on each step, do a general mesh-to-mesh intersection test to find out if the player intersects the wall if they do, refuse to allow the player to move problems with this approach? how can we improve: in response? in speed?

Collision Response frustrating to just stop for player motions, often best thing to do is move player tangentially to obstacle do recursively to ensure all collisions caught find time and place of collision adjust velocity of player repeat with new velocity, start time, start position (reduced time interval) handling multiple contacts at same time find a direction that is tangential to all contacts

Accelerating Collision Detection two kinds of approaches (many others also) collision proxies / bounding volumes spatial data structures to localize used for both 2D and 3D used to accelerate many things, not just collision detection raytracing culling geometry before using standard rendering pipeline

Collision Proxies proxy: something that takes place of real object cheaper than general mesh-mesh intersections collision proxy (bounding volume) is piece of geometry used to represent complex object for purposes of finding collision if proxy collides, object is said to collide collision points mapped back onto original object good proxy: cheap to compute collisions for, tight fit to the real geometry common proxies: sphere, cylinder, box, ellipsoid consider: fat player, thin player, rocket, car …

Trade-off in Choosing Proxies AABB OBB Sphere Convex Hull 6-dop increasing complexity & tightness of fit decreasing cost of (overlap tests + proxy update) AABB: axis aligned bounding box OBB: oriented bounding box, arbitrary alignment k-dops – shapes bounded by planes at fixed orientations discrete orientation polytope

Pair Reduction want proxy for any moving object requiring collision detection before pair of objects tested in any detail, quickly test if proxies intersect when lots of moving objects, even this quick bounding sphere test can take too long: N2 times if there are N objects reducing this N2 problem is called pair reduction pair testing isn’t a big issue until N>50 or so…

Spatial Data Structures can only hit something that is close spatial data structures tell you what is close to object uniform grid, octrees, kd-trees, BSP trees bounding volume hierarchies OBB trees for player-wall problem, typically use same spatial data structure as for rendering BSP trees most common

Uniform Grids axis-aligned divide space uniformly

Quadtrees/Octrees axis-aligned subdivide until no points in cell

KD Trees axis-aligned subdivide in alternating dimensions

BSP Trees planes at arbitrary orientation covered in upcoming hidden surfaces lectures

Bounding Volume Hierarchies covered in previous raytracing lecture

OBB Trees oriented bounding boxes

Related Reading Real-Time Rendering Tomas Moller and Eric Haines on reserve in CICSR reading room

Acknowledgement slides borrow heavily from slides borrow lightly from Stephen Chenney, (UWisc CS679) http://www.cs.wisc.edu/~schenney/courses/cs679-f2003/lectures/cs679-22.ppt slides borrow lightly from Steve Rotenberg, (UCSD CSE169) http://graphics.ucsd.edu/courses/cse169_w05/CSE169_17.ppt