Image-Space Collision Detection. University of Freiburg - Computer Science Department - Computer Graphics

Similar documents
Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Image Synthesis. Transparency. computer graphics & visualization

Computer Graphics Hardware An Overview

INTRODUCTION TO RENDERING TECHNIQUES

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Distributed Area of Interest Management for Large-Scale Immersive Video Conferencing

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

A Short Introduction to Computer Graphics

Lecture Notes, CEng 477

OpenGL Performance Tuning

Introduction to Computer Graphics

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August

The Car Tutorial Part 1 Creating a Racing Game for Unity

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 9 The Game Engine

3D Computer Games History and Technology

CUBE-MAP DATA STRUCTURE FOR INTERACTIVE GLOBAL ILLUMINATION COMPUTATION IN DYNAMIC DIFFUSE ENVIRONMENTS

Volumetric Meshes for Real Time Medical Simulations

COMP175: Computer Graphics. Lecture 1 Introduction and Display Technologies

A New Approach to Cutting Tetrahedral Meshes

Volume visualization I Elvins

GPU Architecture. Michael Doggett ATI

Computer Graphics. Introduction. Computer graphics. What is computer graphics? Yung-Yu Chuang

How To Teach Computer Graphics

REAL-TIME IMAGE BASED LIGHTING FOR OUTDOOR AUGMENTED REALITY UNDER DYNAMICALLY CHANGING ILLUMINATION CONDITIONS

Image Based Rendering With Stable Frame Rates

Comp 410/510. Computer Graphics Spring Introduction to Graphics Systems

2.3 WINDOW-TO-VIEWPORT COORDINATE TRANSFORMATION

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

Making natural looking Volumetric Clouds In Blender 2.48a

A NEW METHOD OF STORAGE AND VISUALIZATION FOR MASSIVE POINT CLOUD DATASET

Lezione 4: Grafica 3D*(II)

B2.53-R3: COMPUTER GRAPHICS. NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions.

ilean Cplp and PLP

SkillsUSA 2014 Contest Projects 3-D Visualization and Animation

Modern Graphics Engine Design. Sim Dietrich NVIDIA Corporation

Efficient Cloth Model and Collisions Detection for Dressing Virtual People

NVIDIA IndeX Enabling Interactive and Scalable Visualization for Large Data Marc Nienhaus, NVIDIA IndeX Engineering Manager and Chief Architect

Real-Time Realistic Rendering. Michael Doggett Docent Department of Computer Science Lund university

Introduction to ANSYS ICEM CFD

2.5 Physically-based Animation

FRACTURE is commonplace in crashes and explosions,

Deferred Shading & Screen Space Effects

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Introduction to GPGPU. Tiziano Diamanti

Using Photorealistic RenderMan for High-Quality Direct Volume Rendering

How To Understand The Power Of Unity 3D (Pro) And The Power Behind It (Pro/Pro)

Off-line Model Simplification for Interactive Rigid Body Dynamics Simulations Satyandra K. Gupta University of Maryland, College Park

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

Multiresolution 3D Rendering on Mobile Devices

Dynamic Resolution Rendering

1. INTRODUCTION Graphics 2

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Model Repair. Leif Kobbelt RWTH Aachen University )NPUT $ATA 2EMOVAL OF TOPOLOGICAL AND GEOMETRICAL ERRORS !NALYSIS OF SURFACE QUALITY

Computer Animation: Art, Science and Criticism

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura

Overview Motivation and applications Challenges. Dynamic Volume Computation and Visualization on the GPU. GPU feature requests Conclusions

Modelling 3D Avatar for Virtual Try on

3D Math Overview and 3D Graphics Foundations

3D Drawing. Single Point Perspective with Diminishing Spaces

GPU Christmas Tree Rendering. Evan Hart

Interactive Level-Set Deformation On the GPU

Outdoor beam tracing over undulating terrain

MobiX3D: a player for displaying 3D content on mobile devices

Announcements. Active stereo with structured light. Project structured light patterns onto the object

Geometry Chapter Point (pt) 1.1 Coplanar (1.1) 1.1 Space (1.1) 1.2 Line Segment (seg) 1.2 Measure of a Segment

Advanced Topics in Animation - Seminar. Introduction. Matthias Teschner. Computer Science Department University of Freiburg

Interactive Level-Set Segmentation on the GPU

Realtime 3D Computer Graphics Virtual Reality

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA

Parallel Simplification of Large Meshes on PC Clusters

Optimizing AAA Games for Mobile Platforms

Segmentation of building models from dense 3D point-clouds

Computer Graphics CS 543 Lecture 12 (Part 1) Curves. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

A System for Capturing High Resolution Images

Intersection of a Line and a Convex. Hull of Points Cloud

Visualization of 2D Domains

Lecture 15: Hardware Rendering

Advanced Volume Rendering Techniques for Medical Applications

How To Draw In Autocad

Deconstructing Hardware Usage for General Purpose Computation on GPUs

Hardware design for ray tracing

Fast Collision Detection Between Cloth and a Deformable Human Body

Online Model Reconstruction for Interactive Virtual Environments

3D Drawing. Single Point Perspective with Diminishing Spaces

Advanced Visual Effects with Direct3D

Examples. Pac-Man, Frogger, Tempest, Joust,

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1

Thea Omni Light. Thea Spot Light. Light setup & Optimization

Performance Optimization and Debug Tools for mobile games with PlayCanvas

3D Viewing. Chapter 7. Projections. 3D clipping. OpenGL viewing functions and clipping planes

High speed 3D capture for Configuration Management DOE SBIR Phase II Paul Banks

A VOXELIZATION BASED MESH GENERATION ALGORITHM FOR NUMERICAL MODELS USED IN FOUNDRY ENGINEERING

Advanced Rendering for Engineering & Styling

Real-time Visual Tracker by Stream Processing

Digital 3D Animation

Transcription:

Image-Space Collision Detection

Acknowledgements Parts of this slide set are courtesy of Bruno Heidelberger, ETH Zurich.

Outline motivation algorithms performance application discussion

Graphics Hardware for 2D Collision Detection rendering corresponds to placing all object primitives into the according cell (pixel) of a uniform rectangular 2D grid (frame buffer) rendering determines all pixels in a frame buffer affected by the object at each pixel position, information can be processed (color, depth, stencil) Kenneth Hoff, UNC stencil-buffer for collision detection clear stencil buffer increment stencil buffer for each rendered object intersection for stencil buffer value larger 1 stencil value 1 stencil value 2

Closed Objects exit point entry point inside region outside region number of entry points equals the number of exit points in case of convex objects, one entry point and one exit point inside and outside are separated by entry or exit point entry point is at a front face exit point is at a back face front and back faces alternate

Collision Detection with Graphics Hardware exploit rasteriation of object primitives for intersection test benefit from graphics hardware acceleration Image Plane (xy) Depth Buffer ()

Collision Detection with Graphics Hardware Idea computation of entry and exit points can be accelerated with graphics hardware computation corresponds to rasteriation of surface primitives all object representations that can be rendered are handled parallel processing on CPU and GPU Challenges restricted data structures and functionality Drawbacks approximate computation of entry and exit points

Early approaches [Shinya, Forgue 1991] image-space collision detection for convex objects [Myskowski, Okunev, Kunii 1995] collision detection for concave objects with limited depth complexity [Baciu, Wong 1997] hardware-assisted collision detection for convex objects

More approaches [Lombardo, Cani, Neyret 1999] intersection of tool with deformable tissue by rendering the interior of the tool [Vassilev, Spanlang, Chrysanthou 2001] image-space collision detection applied to cloth simulation and convex avatars [Hoff, Zaferakis, Lin, Manocha 2001] proximity tests and penetration depth computation, 2D

Recent approaches [Knott, Pai 2003] intersection of edges with surfaces [Govindaraju, Redon, Lin, Manocha 2003] object and sub-object pruning based on occlusion queries [Heidelberger, Teschner 2004] explicit intersection volume and self-collision detection based on LDIs

Image-Space Collision Detection [Knott, Pai 2003] render all query objects (e. g. edges) to depth buffer count the number f of front faces that occlude the query object count the number b of back faces that occlude the query object iff f - b == 0 then there is no collision 1 occluding front faces 1 occluding back face no collision = front face = back face = query point 2 occluding front faces 1 occluding back face collision

Image-Space Collision Detection clear depth buffer, clear stencil buffer render query objects to depth buffer disable depth update render front faces with stencil increment if front face is closer than query object, then stencil buffer is incremented depth buffer is not updated result: stencil buffer represents number of occluding front faces render back faces with stencil decrement if back face is closer than query object, then stencil buffer is decremented depth buffer is not updated result: stencil buffer represents difference of occluding front and back faces stencil buffer not equal to ero collision

Image-Space Collision Detection works for objects with closed surface works for n-body environments works for query objects that do not overlap in image space numerical problems if query object is part of an object offset in -direction required [Video]

Image-Space Collision Detection [Baciu 2000] RECODE REndered COllision DEtection works with pairs of closed convex objects A and B one or two rendering passes for A and B algorithm estimates overlapping intervals per pixel A f B f A b B b A f B f B b A b A f A b B f B b collision collision no collision

First Rendering Pass clear depth buffer clear stencil buffer enable depth update render back faces of A with stencil increment if nothing has been rendered stencil=0 if something has been rendered stencil=1 depth buffer contains depth of back faces of A disable depth update render B with stencil increment if stencil==1 and B occludes back face of A stencil+=1 depth buffer is not updated stencil-1 = number of faces of B that occlude A

First Rendering Pass first pass collision query stencil 0 no collision stencil 1 no collision no fragment of B occludes back face of A (2 cases) A b A b B f B b stencil 2 collision front face of B occludes back face of A (2 cases) A f B f B f A f A b A b B b B b stencil 3 second pass front and back face of B occlude back face of A (3 cases) A f B f B f B f A f B b B b B b A f A b A b A b

Second Rendering Pass render back faces of object B, count occluding faces of A corresponds to first pass with A and B permuted only 3 cases based on the result of the first rendering pass stencil 1 no collision no fragment of A occludes back face of B (1 case) B f B b A f A b stencil 2 collision front face of A occludes back face of B (2 cases) A f B f B f A f B b B b A b A b done

Second Rendering Pass [Myskowski 1995] render front faces of object A, count occluding faces of B corresponds to first pass, front faces are rendered instead of back faces only 3 cases based on the result of the first rendering pass stencil 3 no collision front and back face of B occlude front face of A B f B b A f A b stencil 2 collision front face of B occludes front face of A B f A f B b A b stencil 1 collision no fragment of B occludes front face of A A f B f B b A b done

Image-Space Collision Detection for Concave Objects [Myskowski 1995] collision detection for pairs of concave objects A and B with limited depth complexity (number of entry/exit points) faces have to be sorted with respect to the direction of the orthogonal projection (e. g. BSP tree) objects are rendered in front-to-back or back-to-front order alpha blending is employed: color framebuffer = color object + α color framebuffer color of A is ero, color of B is 2 k-1, k is the number of bits in the frame buffer, α = 0.5

Image-Space Collision Detection for Concave Objects example: k = 8 color A = 0, color B = 2 7 sequence of faces B 1 A 1 A 2 B 2 B 3 B 4 rendered back to front: c fb = 00000000 2 render B 4 : c fb = 2 7 + α c fb = 10000000 2 + 0.5 00000000 2 = 10000000 2 render B 3 : c fb = 10000000 2 + 0.5 10000000 2 = 11000000 2 render B 2 : c fb = 10000000 2 + 0.5 11000000 2 = 11100000 2 render A 2 : c fb = 00000000 2 + 0.5 11100000 2 = 01110000 2 render A 1 : c fb = 00000000 2 + 0.5 01110000 2 = 00111000 2 render B 1 : c fb = 10000000 2 + 0.5 00111000 2 = 10011100 2 resulting bit sequence represents order of faces of A (0) and B (1) odd number of adjacent eros or ones indicates collision

Image-Space Collision Detection for Concave Objects example: 00000000 01100000 01100000 10100000 10100000 10100000 11110000 11000000 Image Plane (xy) frame buffer (color)

Image-Space Collision Detection [Heidelberger 2003] works with pairs of closed arbitrarily-shaped objects three implementations n+1 hardware-accelerated rendering passes where n is the depth complexity of an object n hardware-accelerated rendering passes 1 software rendering pass three collision queries intersection volume (based on intersecting intervals) vertex-in-volume test self-collision test basic idea and implementation for convex objects has been proposed by Shinya / Forgue in 1991

Collision Detection with Graphics Hardware exploit rasteriation of object primitives for intersection test benefit from graphics hardware acceleration Image Plane (xy) Depth Buffer ()

Layered Depth Image compact, volumetric object representation [Shade et al. 1998] represents object as layers of depth values stores entry and exit points Layer 1 Layer 2 Layer 3 Layer 4 1 2 3 4 1 2 3 4 = entry point = exit point Layered Depth Image

Algorithm Overview Algorithm consists of 3 stages: Stage 1: Check for bounding box intersection a) Very fast detection of trivial no collision cases b) Overlapping area defines volume of interest (VoI) for step 2 & 3

Algorithm Overview Stage 2: Generate the layered depth images (LDI) d 3 d 2 d 3 d2 d2 d 2 d 2 LDI 1 Step 3: Perform the collision tests a) test object primitives of one object against LDI of the other b) combine both LDI to get overlapping volume c) self-intersection test LDI 2

Algorithm Overview Stage 1 Volume-of-interest Stage 2 Stage 3 LDI generation Collision query viewing direction a) LDI intersection b) Vertex-in-volume c) Self-collision

Algorithm Overview volume of interest VoI layer 1 layer 2 volume collision queries

Algorithm Overview

Volume of Interest VoI = BoundingBox(Object 1) BoundingBox(Object 2) 1. evaluation of trivial rejection test: VoI == Ø no collision! 2. choice of opposite render directions for LDI generation outside faces possible enlargement of VoI to guarantee valid directions outside faces are outside the object -> guarantees that first intersection point is an entry point

LDI Generation on the GPU Depth Peeling object is rendered once for each layer in the LDI two separate depth tests per fragment are necessary: fragment must be farther than the one in the previous layer (d 2 ) fragment must be the nearest of all remaining fragments (d 3 & d 4 ) example: pass #3 1 23 4 d 2 d 3 d 4 second depth test is realied using shadow mapping extended depth-peeling approach [Everitt 2001]

Shadow Mapping Idea: for each fragment to be rendered: check if it is visible from the light source Algorithm: render scene from the light source: store all distances to the visible (=lit) fragments in a shadow map render scene from the camera: compare the distance of each fragment to the light with the value * in the shadow map: Camera = * fragment is lit > * fragment is shadowed Frame Buffer A a = a * B b > b * Shadow Map (*) Light

Shadow Mapping as Depth Test Differences to regular depth test: shadow mapping depth test is not tied to camera position shadow map (depth buffer) is not writeable during depth test shadow mapping does not discard fragments Depth test setup for LDI generation: fragment must be farther away than fragment in previous depth layer shadow map test fragment must be the nearest of all remaining fragments regular depth test

Multipass LDI Generation Pass #1 clear object GPU CPU #pixels > 0 -buffer read back LDI #1 Pass #2 clear object copy Pass #n+1 #pixels > 0 Pass #i - #n clear #pixels == 0! -buffer -buffer object test test copy shadow map shadow map read back LDI #2 copy LDI #i - #n read back

Result of LDI Generation multipass LDI generation results in an ordered LDI representation of the VoI 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 1 2 3 4 VoI ordered LDI requires one rendering pass per depth layer requires shadow mapping functionality

Collision Detection Test test object primitives of one object against LDI of the other object (and vice versa) vertex-in-volume test example: Collision No collision d 3 d 2 x x d 2 No collision x d 2

LDI Combination intersect both LDI to get the overlapping volume provides an explicit intersection volume other boolean operations (union, difference) are also possible constructive solid geometry (CSG) d 3 d 2 d 3 d2 d2 d 2 d 2 LDI 1 LDI 2 LDI 1 2 = LDI 1 LDI 2 d 2 d 2 d 2 d 2 d 2 LDI 1 2

Collision queries Vertex-in-volume test Explicit intersection volume + +

Self-collision query check for incorrect ordering of front and back faces if front and back faces do not alternate -> self collision 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 1 2 VoI LDI

Algorithm Summary (1) Volume of interest (3) Collision detection test or d 2 d 2 d 2 d 2 d 2 LDI 1 2 d 3 d 2 x x d 2 x d 2 or self-collision (2) LDI generation d 3d2 d d 3d2 d 2 d 2 LDI 1 LDI 2

Problems object can not be rendered to shadow map (see differences to depth buffer) additional copy process necessary limited precision of depth buffer leads to singularities near edges between front and back faces: example: d 2 d 3 d 2 d 3 = valid entry point? = valid leaving point? handle front and back faces in separate passes No! corrupt LDI!

Unordered LDI Generation alternative method for LDI generation GPU generates unsorted LDI fragments are rendered in the same order in each rendering pass stencil buffer is used to get n-th value in the n-th pass CPU generates ordered LDI depth complexity is known for each fragment (how many values are rendered per pixel) 1 2 3 4 5 6 VoI 1 2 3 4 5 3 2 1 4 4 1 3 2 2 unsorted LDI (GPU) 6 2 1 2 3 4 5 6 1 2 3 4 2 2 sorted LDI (CPU)

Unordered LDI Generation GPU CPU clear render Pass 1 frame buffer stencil buffer Test: GREATER Ref: 1 Fail: INCR Pass: INCR read back depth complexities identify depth buffer Test: DISABLED read back ldi layer 1 n max clear render Pass n (2 n n max ) frame buffer stencil buffer Test: GREATER Ref: n Fail: KEEP Pass: INCR depth buffer Test: DISABLED read back ldi layer n

Limitations performance is dependent on: depth complexity of objects in volume of interest read back delay for simple objects rendering speed for complex objects requires graphics hardware

Ordered LDI Generation on CPU Motivation buffer read-back from GPU can be performance bottleneck GPU requires multiple passes CPU can store fragments directly into LDI Simplified software-renderer rasteriation of triangle meshes frustum culling face clipping orthogonal projection

LDI Generation - Summary Ordered LDI (GPU) Unordered LDI (GPU) Ordered LDI (CPU) rasterie n+1 passes complex setup two depth tests shadow map OpenGL extensions n passes simple setup no depth test stencil buffer plain OpenGL 1.4 1 pass simple setup no depth test

Performance - Intersection Volume hand with 4800 faces phone with 900 faces two LDIs intersection volume for collision detection analysis of front / back face ordering for self-collision

Performance Intersection Volume method collision min / max self collision min / max overall min / max ordered (GPU) 28 / 37 40 / 54 68 / 91 unordered (GPU, CPU) 9 / 12 12 / 18 21 / 30 software (CPU) 3 / 4 5 / 7 8 / 11 3 GH Pentium 4, GeForce FX Ultra 5800 hand with 4800 faces phone with 900 faces measurements in ms

Performance Vertex-in-Volume santa with 10000 faces 20000 particles one LDI test vertices against inside regions of the LDI

Performance Vertex-in-Volume method 520k faces 100k particles 150k faces 30k particles 50k faces 10k particles ordered (GPU) 450 160 50 unordered (GPU, CPU) 225 75 25 software (CPU) 400 105 35 3 GH Pentium 4, GeForce FX Ultra 5800 LDI resolution 64 x 64 measurements in ms

Performance LDI resolution mouse with 15000 faces hat with 1500 faces two LDIs intersection volume for collision detection

Performance LDI resolution method 32 x32 64 x 64 128 x128 ordered (GPU) 24 unordered (GPU, CPU) 8 software (CPU) 2 3 GH Pentium 4, GeForce FX Ultra 5800 26 9 3 51 17 6 mouse with 15000 faces hat with 1500 faces measurements in ms

Applications Cloth Modeling LDI 3 orthogonal dilated LDIs

Real-Time Cloth Simulation with Collision Handling real-time movie 3GH Pentium 4 stable collision handling

Real-Time Cloth Simulation with Collision Handling real-time movies 3GH Pentium 4 concave transforming object concave deforming object

Summary image-space technique detection of collisions and self-collisions handling of rigid and deformable closed meshes no pre-processing CPU: 5000 / 1000 faces at 100 H GPU: 520000 faces / 100000 particles at 4 H application to cloth simulation limitations closed meshes accuracy collision information for collision response

References M. Shinya, M. Forgue, Interference Detection through rasteriation, Journal of Visualiation and Computer Animation, vol. 2, pp. 132-134, 1991. K. Myskowski, O. Okunev, T. Kunii, Fast collision detection between complex solids using rasteriing graphics hardware, The Visual Computer, vol. 11, no. 9, pp. 497-512, 1995. J. C. Lombardo, M.-P. Cani, F. Neyret, Real-time Collision Detection for Virtual Surgery, Proc. of Comp. Anim., pp. 82-91, 1999. G. Baciu, S. K. Wong "Image-Based Techniques in a Hybrid Collision Detector," IEEE Trans on Visualiation and Computer Graphics, Jan 2002. D. Knott, D. Pai: Cinder: Collision and interference detection in real-time using graphics hardware, Proc. Graphics Interface, 2003. B. Heidelberger, M. Teschner, M. Gross, Volumetric Collision Detection for Deformable Objects, Proc. VMV 03, pp. 461-468, 2003. B. Heidelberger, M. Teschner, M. Gross, Detection of Collisions and Selfcollisions Using Image-space Techniques, Proc. WSCG 04, pp. 145-152, 2004.