What is a Rigid Body?

Similar documents
A Different Approach for Continuous Physics. Vincent ROBERT Physics Programmer at Ubisoft

Shape of Things to Come: Next-Gen Physics Deep Dive

Abstract. Introduction. Kevin Todisco

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Chapter 19- Object Physics

Dynamic Ambient Occlusion and Indirect Lighting. Michael Bunnell NVIDIA Corporation

Physics Parallelization. Erwin Coumans SCEA

Real-Time Volumetric Smoke using D3D10. Sarah Tariq and Ignacio Llamas NVIDIA Developer Technology

CUDA Particles. Simon Green

Continuous Collision Detection and Physics

Anatomy of a Physics Engine. Erwin Coumans

Integrating Physics into a Modern Game Engine. Object Collision. Various types of collision for an object:

Collision Detection II. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

GAME PROGRAMMING ON HYBRID CPU-GPU ARCHITECTURES TAKAHIRO HARADA, AMD DESTRUCTION FOR GAMES ERWIN COUMANS, AMD

MODELING AND HIERARCHY

NVIDIA. Interacting with Particle Simulation in Maya using CUDA & Maximus. Wil Braithwaite NVIDIA Applied Engineering Digital Film

Cloth Simulation on the GPU. Cyril Zeller NVIDIA Corporation

Ray Tracing. Computer Graphics CMU /15-662, Fall 2016

CPSC / Sonny Chan - University of Calgary. Collision Detection II

Homework 1: Implicit Surfaces, Collision Detection, & Volumetric Data Structures. Loop Subdivision. Loop Subdivision. Questions/Comments?

2.11 Particle Systems

L10 Layered Depth Normal Images. Introduction Related Work Structured Point Representation Boolean Operations Conclusion

Fast continuous collision detection among deformable Models using graphics processors CS-525 Presentation Presented by Harish

About Phoenix FD PLUGIN FOR 3DS MAX AND MAYA. SIMULATING AND RENDERING BOTH LIQUIDS AND FIRE/SMOKE. USED IN MOVIES, GAMES AND COMMERCIALS.

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

Duksu Kim. Professional Experience Senior researcher, KISTI High performance visualization

Scalable multi-gpu cloud raytracing with OpenGL

Applications of Explicit Early-Z Z Culling. Jason Mitchell ATI Research

Ray Tracing Acceleration. CS 4620 Lecture 20

John Hsu Nate Koenig ROSCon 2012

CS GAME PROGRAMMING Question bank

T6: Position-Based Simulation Methods in Computer Graphics. Jan Bender Miles Macklin Matthias Müller

Programmable Shaders for Deformation Rendering

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Bullet Cloth Simulation. Presented by: Justin Hensley Implemented by: Lee Howes

Shadows for Many Lights sounds like it might mean something, but In fact it can mean very different things, that require very different solutions.

Parallel Physically Based Path-tracing and Shading Part 3 of 2. CIS565 Fall 2012 University of Pennsylvania by Yining Karl Li

Real-Time Ray Tracing Using Nvidia Optix Holger Ludvigsen & Anne C. Elster 2010

RSX Best Practices. Mark Cerny, Cerny Games David Simpson, Naughty Dog Jon Olick, Naughty Dog

3D Physics Engine for Elastic and Deformable Bodies. Liliya Kharevych and Rafi (Mohammad) Khan Advisor: David Mount

Automatic Dynamic Task Distribution between CPU and GPU for Real-Time Systems

Simulation in Computer Graphics. Introduction. Matthias Teschner. Computer Science Department University of Freiburg

Computer Graphics I Lecture 11

A simple example. Assume we want to find the change in the rotation angles to get the end effector to G. Effect of changing s

Collision Detection based on Spatial Partitioning

Topics. Ray Tracing II. Intersecting transformed objects. Transforming objects

Collision Detection of Triangle Meshes using GPU

CUDA Particles. Simon Green

INFOMAGR Advanced Graphics. Jacco Bikker - February April Welcome!

Radeon ProRender and Radeon Rays in a Gaming Rendering Workflow. Takahiro Harada, AMD 2017/3

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Collision Detection. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

Computer Graphics Ray Casting. Matthias Teschner

Adarsh Krishnamurthy (cs184-bb) Bela Stepanova (cs184-bs)

Interactive Cloth Simulation. Matthias Wloka NVIDIA Corporation

CSE 167: Introduction to Computer Graphics Lecture #18: More Effects. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

The Application Stage. The Game Loop, Resource Management and Renderer Design

S7260: Microswimmers on Speed: Simulating Spheroidal Squirmers on GPUs

Ray Casting of Trimmed NURBS Surfaces on the GPU

Administrivia. Administrivia. Administrivia. CIS 565: GPU Programming and Architecture. Meeting

#Short presentation of the guys

Collision Detection. Pu Jiantao.

CHAPTER 1 Graphics Systems and Models 3

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011

Topics. Ray Tracing II. Transforming objects. Intersecting transformed objects

CLOTH - MODELING, DEFORMATION, AND SIMULATION

Introduction to Collision Detection

GPU-based Distributed Behavior Models with CUDA

Lecture 18 of 41. Scene Graphs: Rendering Lab 3b: Shader

Spring 2009 Prof. Hyesoon Kim

Adaptive Assignment for Real-Time Raytracing

CS451Real-time Rendering Pipeline

Benchmark 1.a Investigate and Understand Designated Lab Techniques The student will investigate and understand designated lab techniques.

Physically-Based Laser Simulation

Adaptive Point Cloud Rendering

Acceleration Data Structures

Index FEATURES LIST 2

Simulation in Computer Graphics Space Subdivision. Matthias Teschner

Real-Time Hair Simulation and Rendering on the GPU. Louis Bavoil

Interaction of Fluid Simulation Based on PhysX Physics Engine. Huibai Wang, Jianfei Wan, Fengquan Zhang

Rendering Grass with Instancing in DirectX* 10

Collision Detection. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

GPGPU Lessons Learned. Mark Harris

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

Hardware Accelerated Volume Visualization. Leonid I. Dimitrov & Milos Sramek GMI Austrian Academy of Sciences

Real Time Rendering of Complex Height Maps Walking an infinite realistic landscape By: Jeffrey Riaboy Written 9/7/03

CS8803SC Software and Hardware Cooperative Computing GPGPU. Prof. Hyesoon Kim School of Computer Science Georgia Institute of Technology

NVIDIA DESIGNWORKS Ankit Patel - Prerna Dogra -

Simulation in Computer Graphics. Deformable Objects. Matthias Teschner. Computer Science Department University of Freiburg

Cloth Simulation. Tanja Munz. Master of Science Computer Animation and Visual Effects. CGI Techniques Report

Bounding Volume Hierarchies

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Collision and Proximity Queries

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

Programming Game Engines ITP 485 (4 Units)

Spring 2011 Prof. Hyesoon Kim

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

Real-Time Reyes: Programmable Pipelines and Research Challenges. Anjul Patney University of California, Davis

Post Mortem: GPU Accelerated Effects in Borderlands 2

Transcription:

Physics on the GPU

What is a Rigid Body? A rigid body is a non-deformable object that is a idealized solid Each rigid body is defined in space by its center of mass To make things simpler we assume the mass has an equal distribution of mass. The rigid body also has a velocity Unlike particles the rigid body has an associated rotation and angular velocity. Using these two distinctions, the velocity at any point on the body is equal and the rotational velocity at any point is equal. GPU Gems 3: Fig. 29-2

100s to 1000s of rigid bodies at once All maybe interacting with one another or the user Complex shapes The rigid bodies maybe different sizes and shapes Bodies may also be concave, allowing them to get stuck in one another Physically realistic Each object has visually realistic interactions with one another Objects may have inter-dependencies Becomes more Difficult to parallelize Arbitrary object shapes can create branching Dependencies makes it hard to find calculations to do in parallel

Integration Moving objects based on forces affecting them Not discussed as much in papers of Rigid Body Simulation Broad Phase Collision Detection Culling intersections to prevent performing O(n 2 ) checks Narrow Phase Collision Detection Performing intersections found in Broad Phase Collision Response Bouncing, Sliding and Deflecting objects based on previous detections Generally creates a force that is applied against colliding objects to change their velocity and thereby their position.

Entertainment Video Games Movies Realistic Visual Effects Mechanical Design Prototyping Stress and Usability Testing

Physics Effects adds realism to game Interacting with objects, environment and other players Creates an immersive world CellFactor: Revolution, Developed by Artificial Studios PhysX

Videos CellFactor http://www.youtube.com/watch?v=q_zf6hsif9o Half-Life http://www.youtube.com/watch?v=hxafdp0ffw0&feature=related

Realistic looking Effects with great detail Much easier to animate than using keyframes Litter and debris add detail Allows artists to play with physical properties to get intended result WALL-E, Disney s Pixar 2012, Sony Pictures

Create a computer model of a mechanical design Allows for testing of mechanical motion, stress, pressure and physical properties Can allow designers to tune properties without building actual model Autodesk Inventor Studio Programmable Matter Editor - PhysX

Physics Libraries NVIDIA s PhysX Havok FX Open Dynamics Engine (ODE) Other Papers ParallAX: An Architecture for Real-Time Physics Thomas Y. Yeh, Petros Faloutsos, Sanjay J. Patel, Glenn Reinman, ACM 2007 A New Physics Engine with Automatic Process Distribution between CPU-GPU Mark Joselli, Esteban Clua, Anselmo Montenegro, Aura Conci, Paulo Pagliosa, ACM 2008 Evaluation of Real-Time Physics Simulation System Adrian Boeing, Thomas Braunl, ACM 2007

GPU Gem 3. Chapter 29: Real Time Rigid Body Simulation on GPUs Takahiro Harada Bullet: A Case Study in Optimizing Physics Middleware for GPU Erwin Coumans

GPU Gem 3. Chapter 29: Real Time Rigid Body Simulation on GPUs Takahiro Harada Bullet: A Case Study in Optimizing Physics Middleware for GPU Erwin Coumans

GPU Gems 3: Fig. 29-5 Voxelization of Bodies Collision Detection using Grid and Particles Data Structures for Poisiton, Rotation, etc

Rigid Bodies are broken down into sets of particles Discretize space around bodies Perform a raycast through the grid space to determine which particles are filled Requires mesh to be closed, but allows for complex concave designs GPU Accelerations Using Depth Peeling to perform ray cast. Using fragment shader to hold information about voxelization. GPU Gems 3: Fig. 29-3

Generating Uniform Grid on GPU Stenciling Routing Technique Using vertex shader, one vertex for one particle Allocating a voxel for each pixel Allows for at maximum four particles per voxel Using RGBA values for the values of each voxel Rendering Requires 4 Passes into buffer Each pass rendering to RGBA respectively Uses stencil buffer and depth buffer to determine channel to use Can be used for more than 4 particles per voxel, but requires multiple render targets. GPU Gems 3: Fig. 29-8

Pseudocode of Passes GPU Gems 3: Example 29-1

Broken Down Complex Shapes into Simple particles Now only Requires Particle-Particle Collision Allows for control of speed versus Accuracy Higher Resolution Grid = Higher Accuracy Lower Resolution Grid = Higher Frame Rates Multipurpose Uniform Grid Organization Used to reduce check time between particles from O(n 2 ) Domain is divided into voxels with index g and each particle has an associated voxel index. With in the grid particles are reduced to colliding with Other particles within their grid Particles in the surrounding voxels Improves running time to O(n) Most efficient when voxel side length is equal to the diameter of a particle, reducing checks to 3 3 checks in 3 dimensions.

Look up into Voxel grid to find particles within the 27 possible voxels around a given particle. No Broad or Narrow phase needed Particles require only distance check Only checking neighboring particles because we are using uniform grid

Consider inter-particle forces between pairs rather than groups of particles interacting Discrete Element Method (DEM) for getting forces between granular materials Particles colliding are considered to have a repulsive force modeled by a spring, a damping force, and a shear force based on tangential velocity We then sum all the forces affecting one rigid body and apply it to all the particles within the rigid body. It is a similar process for the torques on each body. Once the forces have been calculated, we perform an integration to find positions Pseudo-Code for Detection and Reaction GPU Gems 3: Example 29-2

Rigid Bodies are defined like Particles We need to hold their center of mass, velocity, angular momentum and orientation. These can all be held in a texture Unlike Particles Since each rigid body is turned into particles we need to increase the size of the texture to hold all information for each particle Using the number of particles per rigid body we can calculate the rigid body s position in the texture. We use two textures, one for reading and one for writing GPU Gems 3: Fig. 29-6

We also need to consider the uniform grid in which the particles are placed For this we create a 3D data structure on a 2D texture Called Flat 3D Texture At time of implementation, 3D textures are not as optimized as 2D textures in hardware GPU Gems 3: Fig. 29-7

Tested on NVIDIA GeForce 8800 GTX 16,384 Chess pieces, with 65,536 particles at 44 fps 10,922 Tori, with 65,536 particles at 68 fps 963 bunnies, 68 particles each at 112 iterations per second (ips) 329 teapots, 199 particles each at 101 ips All grid sizes were uniform at 128 3 Made note that uniform grids were not necessarily and not always best Projects could be easily adapted to granular materials or fluids GPU Gems 3: Fig. 29-9 GPU Gems 3: Fig. 29-10

GPU Gems 3: Fig. 29-1

GPU Gem 3. Chapter 29: Real Time Rigid Body Simulation on GPUs Takahiro Harada Bullet: A Case Study in Optimizing Physics Middleware for GPU Erwin Coumans

Portability Dynamic BVH Trees Convex Closest Points, GJK Collision detection Projected Gauss Seidel Solving

Bullet is open source Physics SDK Used by game developers and movie studios Bullet 3.0 and above supports OpenCL acceleration Allows for developers to work on many platforms PC, Mac, iphone, Wii, Xbox360 and PlayStation 3 Many different implementations given in library, allowing for mixing between CPU and GPU stages Creating a much better library for varying games and movies Already has been implemented in tools commercially available Maya Plugins Cinema 4D 11.5 Blender

Trees Siblings are the bounding boxes closest to one another Optimized so overlapping of boxes is minimal Overall volume is minimized Implemented without recursion Necessary on the GPU Implemented for Broad phase collision Allows for concave triangle meshes and compound collision shapes Can also be used for ray tracing when drawing scene

Keeping two dynamic trees One for moving objects and one for static objects. They consider objects moving relatively slowly are static Updating the Trees We do not need to update the non-moving BVHT since their velocities are small Updating moving objects becomes hard to parallelize Objects are allowed to move from one tree to the other We must incrementally update and rebalance the tree. Bullet: A Case Study in Optimizing Physics, Erwin Coumans

History Flags This acts as an alternative to recursive or stackless traversal Each level in the tree has 2 bits of information to represent where we are in the recursion. We require twice the number of levels of bits to store the flags, which is relatively small compared to the entire tree The bit is 1 if you have visited or currently visiting the child The bit is then reset when you finish a node. This allows you to traverse the tree using the flag information without dealing with recursion.

Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Setting bit when going down child branch Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Resetting bit when moving back up tree Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Branch has been completed, so we back move up Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Reset the flags at the previous branch Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Rather than voxelizing objects we can create a low polygon representation of the object Voxelization may not be good for certain objects as you might need many spheres to get accurate collision and it no longer becomes faster Get a better approximation with a convex hull of the object with faster speed up Allows for usage of the Convex Closest Points, Gilbert-Johnson-Keerthi (GJK) Collision detection rather than sphere-sphere on a grid Also allows easier, non-uniform grids that are not dependent on the voxelization Acts as Narrow phase The same bunny, voxelized versus Low polygon where the number of spheres is comparable to the number of faces Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Bullet uses hybrid GJK (Gilbert-Johnson-Keerthi) algorithm with EPA Calculates distance between convex objects The algorithm returns a close approximation of the shortest distance between two convex objects The algorithm creates a set of vertices through iteration that contain the two closest points in each object The algorithm will produce the actual distance of two points if the objects are polytopes. To deal with hard cases such as spheres or cylinders, we augment the system with a mapping.

Rather than trying to organize threads for each object being acted upon we create constraint batches These batches represent the rigid interacting with one another They can be sorted into dependency groups to be solved Then we create the independent sets and solve them in parallel. Finding the sets to do in parallel is hard to do in parallel Bullet: A Case Study in Optimizing Physics, Erwin Coumans

Colored based on what interactions can be done in parallel Bullet: A Case Study in Optimizing Physics, Erwin Coumans

2D case 4000 Cubes CPU 3Ghz single thread, 185 ms/f Geforce 260 CUDA, 21 ms/f 8.8 times speed up 3D Case 3000 Cubes CPU 3Ghz singe thread, 15 ms/f Geforce 260 CUDA, 9 ms/f 1.6 times speed up Videos http://www.youtube.com/watch?v=3ilojin4vq8

The GPU offers a substantial way of speeding up rigid body simulations Use the right broad and narrow phase for your given situation If you have many objects in the scene and you don t care about accuracy, use voxelization If you have larger and fewer objects you may consider using a lower polygon representation with DBVHs Find ways to speed up the number of force calculations you must consider. By finding batches of force calculations that can be done in parallel, you decrease the amount of time to find the final force affecting any given body. Use the optimal data structure for your bodies to reduce space in the texture and to conserve bandwidth.

Final Project Create a rigid body simulator optimized for origami Take in folding sequences and apply torque forces to make rigid bodies fold Solving Torque Forces using sparse matrix Similar to batch idea For Origami, adjacency between objects is always known and never changes Collision methods that do not require closed meshes All methods I ve found so far require a closed mesh or voxelize the mesh I want to do neither, so to handle this case I perform AABB as a broad phase and simple triangle-triangle collision for the narrow phase. Reduce bandwidth by sending minimum information to the GPU at each time step and not have to recalculate structures each step.