1cs533d-winter-2005 Notes. 2 Numerical Implementation 1  Get candidate x(t+∆t)  Check to see if x(t+∆t) is inside object (interference)  If so Get.

Slides:



Advertisements
Similar presentations
CSG and Raytracing CPSC 407.
Advertisements

Derivatives in physics. Why Do We Need Derivatives? In physics things are constantly changing. Specifically, what we’ll be interested with is how physical.
Derivatives in physics. Why Do We Need Derivatives? In physics things are constantly changing. Specifically, what we’ll be interested with is how physical.
Day 13 – June 6 – WBL Elastic and Inelastic Collisions PC141 Intersession 2013Slide 1.
Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
Gauss’ Law Besides adding up the electric fields due to all the individual electric charges, we can use something called Gauss’ Law. Its idea is similar.
EARS1160 – Numerical Methods notes by G. Houseman
CS447/ Realistic Rendering -- Solids Modeling -- Introduction to 2D and 3D Computer Graphics.
1cs533d-term Notes  Assignment 1 due today.
Notes Assignment questions… cs533d-winter-2005.
1cs533d-term Notes  Assignment 2 is up. 2cs533d-term Modern FEM  Galerkin framework (the most common)  Find vector space of functions that.
1Notes. 2Heightfields  Especially good for terrain - just need a 2d array of heights (maybe stored as an image)  Displacement map from a plane  Split.
1cs533d-term Notes  For using Pixie (the renderer) make sure you type “use pixie” first  Assignment 1 questions?
1Notes. 2 Building implicit surfaces  Simplest examples: a plane, a sphere  Can do unions and intersections with min and max  This works great for.
1cs533d-term Notes  Required reading: Baraff & Witkin, “Large steps in cloth animation”, SIGGRAPH’98 Grinspun et al., “Discrete shells”, SCA’03.
More Accurate Pressure Solves. Solid Boundaries  Voxelized version works great if solids aligned with grid  If not: though the error in geometry is.
1Notes. 2 Triangle intersection  Many, many ways to do this  Most robust (and one of the fastest) is to do it based on determinants  For vectors a,b,c.
1Notes  Text:  Motion Blur A.3  Particle systems 4.5 (and 4.4.1, 6.6.2…)  Implicit Surfaces  Classic particle system papers  W. Reeves, “Particle.
1Notes  Reference  Witkin and Baraff, “Physically Based Modelling” course, SIGGRAPH 2001  Link on the course website.
1cs533d-winter-2005 Notes  Please read Fedkiw, Stam, Jensen, “Visual simulation of smoke”, SIGGRAPH ‘01.
1cs533d-winter-2005 Notes  More optional reading on web for collision detection.
Lecture 2: Numerical Differentiation. Derivative as a gradient
1cs533d-winter-2005 Notes  Assignment 2 going okay? Make sure you understand what needs to be done before the weekend  Read Guendelman et al, “Nonconvex.
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.
UNC Chapel Hill S. Redon - M. C. Lin Rigid body dynamics II Solving the dynamics problems.
Implicit Surfaces Tom Ouyang January 29, Outline Properties of Implicit Surfaces Polygonization Ways of generating implicit surfaces Applications.
1cs426-winter-2008 Notes  Course project: Will be due at the end of the term You can do it in pairs Create an animation that combines an algorithm for.
1cs533d-winter-2005 Notes  More reading on web site Baraff & Witkin’s classic cloth paper Grinspun et al. on bending Optional: Teran et al. on FVM in.
1cs533d-term Notes  list Even if you’re just auditing!
1cs533d-winter-2005 Notes  Finish up time integration methods today  Assignment 1 is mostly out Later today will make it compile etc.
1cs533d-winter-2005 Notes  Some example values for common materials: (VERY approximate) Aluminum: E=70 GPa =0.34 Concrete:E=23 GPa =0.2 Diamond:E=950.
1cs533d-term Notes. 2 Poisson Ratio  Real materials are essentially incompressible (for large deformation - neglecting foams and other weird composites…)
1cs533d-term Notes  Typo in test.rib --- fixed on the web now (PointsPolygon --> PointsPolygons)
Notes, part 4 Arclength, sequences, and improper integrals.
1cs533d-winter-2005 Notes  Assignment 2 instability - don’t worry about it right now  Please read D. Baraff, “Fast contact force computation for nonpenetrating.
1Notes. 2 Time integration for particles  Back to the ODE problem, either  Accuracy, stability, and ease-of- implementation are main issues  Obviously.
Gauss’s Law.
Monte Carlo Methods in Partial Differential Equations.
Gravity and Orbits The gravitational force between two objects:
Linear Momentum and Collisions
CSE 681 Ray Tracing Implicit Surfaces. CSE 681 Overview Similar to CSG –Combine primitive objects to form complex object Primitives are “density fields”
Computer graphics & visualization Collision Detection – Narrow Phase.
Gauss’ Law. Class Objectives Introduce the idea of the Gauss’ law as another method to calculate the electric field. Understand that the previous method.
© 2007 Pearson Prentice Hall This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Skills for October Rounds
Newton’s Law of Gravitation and Kepler’s Third Law We showed already this week that Newton was able to prove Kepler’s third Law, the Harmonic Law, from.
Momentum, Impulse, And Collisions
Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an.
2D/3D Shape Manipulation, 3D Printing Shape Representations Slides from Olga Sorkine February 20, 2013 CS 6501.
3D Graphics for Game Programming Chapter XII Physics-based Simulation.
1 Lesson 8: Basic Monte Carlo integration We begin the 2 nd phase of our course: Study of general mathematics of MC We begin the 2 nd phase of our course:
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Course 13 Curves and Surfaces. Course 13 Curves and Surface Surface Representation Representation Interpolation Approximation Surface Segmentation.
Obtaining Electric Field from Electric Potential Assume, to start, that E has only an x component Similar statements would apply to the y and z.
Advanced EM - Master in Physics We have now calculated all the intermediate derivatives which we need for calculating the fields E and B. We.
Controlling a Virtual Camera Ross Ptacek University of Alabama Birmingham.
Exam 2 Review 8.02 W08D1. Announcements Test Two Next Week Thursday Oct 27 7:30-9:30 Section Room Assignments on Announcements Page Test Two Topics: Circular.
Introduction to Particle Simulations Daniel Playne.
MTH 253 Calculus (Other Topics) Chapter 11 – Infinite Sequences and Series Section 11.1 – Sequences Copyright © 2009 by Ron Wallace, all rights reserved.
Computer Game Design and Development
© 2007 Pearson Prentice Hall This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their.
Volume and Solid Modeling
Sect. 9.2: Impulse & Momentum
PHY 151: Lecture Motion of an Object attached to a Spring 12.2 Particle in Simple Harmonic Motion 12.3 Energy of the Simple Harmonic Oscillator.
Physics 141MechanicsLecture 2 Kinematics in One Dimension Kinematics is the study of the motion of an object. We begin by studying a single particle in.
Medan Listrik Statis I (Hk.Couloumb, Hk. Gauss, Potensial Listrik) Sukiswo
Momentum And Energy Review BRYCE TOWLE EDCI 270 Click this Home Button to return to the main menu at anytime. Use this to switch from momentum to energy,
GPAT – Chapter 7 Physics.
Presentation transcript:

1cs533d-winter-2005 Notes

2 Numerical Implementation 1  Get candidate x(t+∆t)  Check to see if x(t+∆t) is inside object (interference)  If so Get normal n at t+∆t Get new velocity v from collision response formulas and average v Replay x(t+∆t)=x(t)+∆tv

3cs533d-winter-2005 Robustness?  If a particle penetrates an object at end of candidate time step, we fix that  But new position (after collision processing) could penetrate another object!  Maybe this is fine-let it go until next time step  But then collision formulas are on shaky ground…  Switch to repulsion impulse if x(t) and x(t+∆t) both penetrate Find ∆v N proportional to final penetration depth, apply friction as usual

4cs533d-winter-2005 Making it more robust  Other alternative: After collision, check if new x(t+∆t) also penetrates If so, assume a 2nd collision happened during the time step: process that one Check again, repeat until no penetration To avoid infinite loop make sure you lose kinetic energy (don’t take perfectly elastic bounces, at least not after first time through) Let’s write that down:

5cs533d-winter-2005 Numerical Implementation 2  Get candidate x(t+∆t)  While x(t+∆t) is inside object (interference) Get normal n at t+∆t Get new velocity v from collision response formulas and average v Replay x(t+∆t)=x(t) + ∆t v  Now can guarantee that if we start outside objects, we end up outside objects

6cs533d-winter-2005 Micro-Collisions  These are “micro-collision” algorithms  Contact is modeled as a sequence of small collisions We’re replacing a continuous contact force with a sequence of collision impulses  Is this a good idea? [block on incline example]  More philosophical question: how can contact possibly begin without fully inelastic collision?

7cs533d-winter-2005 Improving Micro-Collisions  Really need to treat contact and collision differently, even if we use the same friction formulas  Idea: Collision occurs at start of time step Contact occurs during whole duration of time step

8cs533d-winter-2005 Numerical Implementation 3  Start at x(t) with velocity v(t), get candidate position x(t+∆t)  Check if x(t+∆t) penetrates object If so, process elastic collision using v(t) from start of step, not average velocity Replay from x(t) with modified v(t) Could add ∆t∆v to x(t+∆t) instead of re-integrating Repeat check a few (e.g. 3) times if you want  While x(t+∆t) penetrates object Process inelastic contact (  =0) using average v Replay x(t+∆t)=x(t)+∆t v

9cs533d-winter-2005 Why does this work?  If object resting on plane y=0, v(t)=0 though gravity will pull it down by t+∆t  In the new algorithm, elastic bounce works with pre-gravity velocity v(t)=0 So no bounce  Then contact, which is inelastic, simply adds just enough ∆v to get back to v(t+∆t)=0 Then x(t+∆t)=0 too  NOTE: if  =0 anyways, no point in doing special first step - this algorithm is equivalent to the previous one

10cs533d-winter-2005 Moving objects  Same algorithms, and almost same formulas: Need to look at relative velocity v particle -v object instead of just particle velocity As before, decompose into normal and tangential parts, process the collision, and reassemble a relative velocity Add object velocity to relative velocity to get final particle velocity  Be careful when particles collide: Same relative ∆v but account for equal and opposite forces/impulses with different masses…

11cs533d-winter-2005 Moving Objects…  Also, be careful with interference/collision detection Want to check for interference at end of time step, so use object positions there Objects moving during time step mean more complicated trajectory intersection for collisions

12cs533d-winter-2005 Collision Detection  We have basic time integration for particles in place now  Assumed we could just do interference detection, but…  Detecting collisions over particle trajectories can be dropped in for more robustness - algorithms don’t change But use the normal at the collision time

13cs533d-winter-2005 Geometry  The plane is easy Interference: y<0 Collision: y became negative Normal: constant (0,1,0)  Can work out other analytic cases (e.g. sphere)  More generally: triangle meshes and level sets Heightfields sometimes useful - permit a few simplifications in speeding up tests - but special case Splines and subdivision surfaces generally too complicated, and not worth the effort Blobbies, metaballs, and other implicits are usually not as well behaved as level sets Point-set surfaces: becoming a hot topic

14cs533d-winter-2005 Implicit Surfaces  Define surface as where some scalar function of x,y,z is zero: {x,y,z | F(x,y,z)=0}  Interior (can only do closed surfaces!) is where function is negative {x,y,z | F(x,y,z)<0}  Outside is where it’s positive {x,y,z | F(x,y,z)>0}  Ground is F=y  Example: F=x 2 +y 2 +z 2 -1 is the unit sphere

15cs533d-winter-2005 Testing Implicit Surfaces  Interference is simple: Is F(x,y,z)<0?  Collision is a little trickier: Assume constant velocity x(t+h)=x(t)+hv Then solve for h: F(x(t+h))=0 This is the same as ray-tracing implicit surfaces… But if moving, then need to solve F(x(t+h), t+h)=0 Try to bound when collision can occur (find a sign change in F) then use secant search

16cs533d-winter-2005 Implicit Surface Normals  Outward normal at surface is just  Most obvious thing to use for normal at a point inside the object (or anywhere in space) is the same formula Gradient is steepest-descent direction, so hopefully points to closest spot on surface: direction to closest surface point is parallel to normal there We really want the implicit function to be monotone as we move towards/away from the surface

17cs533d-winter-2005 Building Implicit Surfaces  Planes and spheres are useful, but want to be able to represent (approximate) any object  Obviously can write down any sort of functions, but want better control Exercise: write down functions for some common shapes (e.g. cylinder?)  Constructive Solid Geometry (CSG) Look at set operations on two objects  [Complement, Union, Intersection, …] Using primitive F()’s, build up one massive F() But only sharp edges…

18cs533d-winter-2005 Getting back to particles  “Metaballs”, “blobbies”, …  Take your particle system, and write an implicit function: Kernel function f is something smooth like a Gaussian Strength  and radius r of each particle (and its position x) are up to you Threshold t is also up to you (controls how thick the object is)

19cs533d-winter-2005 Problems with these  They work beautifully for some things! Some machine parts, water droplets, goo, …  But, the more complex the surface, the more expensive F() is to evaluate Need to get into more complicated data structures to speed up to acceptable  Hard to directly approximate any given geometry  Monotonicity - how reliable is the normal?

20cs533d-winter-2005 Signed Distance  Note infinitely many different F represent the same surface  What’s the nicest F we can pick?  Obviously want smooth enough for gradient (almost everywhere)  It would be nice if gradient really did point to closest point on surface  Really nice (for repulsions etc.) if value indicated how far from surface  The answer: signed distance

21cs533d-winter-2005 Defining Signed Distance  Generally use the letter  instead of F  Magnitude is the distance from the surface Note that function is zero only at surface  Sign of  (x) indicates inside ( 0)  [examples: plane, sphere, 1d]

22cs533d-winter-2005 Closest Point Property  Gradient is steepest-ascent direction Therefore, in direction of closest point on surface (shortest distance between two points is a straight line)  The closest point is by definition distance |  | away  So closest point on surface from x is

23cs533d-winter-2005 Unit Gradient Property  Look along line from closest point on surface to x  Value is distance along line  Therefore directional derivative is 1:  But plug in the formula for n [work out]  So gradient is unit length:

24cs533d-winter-2005 Aside: Eikonal equation  There’s a PDE! Called the Eikonal equation Important for all sorts of things Later in the course: figure out signed distance function by solving the PDE…  See Ian Mitchell’s course on level sets for a lot more detail

25cs533d-winter-2005 Aside: Spherical particles  We have been assuming our particles were just points  With signed distance, can simulate nonzero radius spheres Sphere of radius r intersects object if and only if  (x)<r i.e. if and only if  (x)-r<0 So looks just like points and an “expanded” version of the original implicit surface - normals are exactly the same, …

26cs533d-winter-2005 Level Sets  Use a discretized approximation of   Instead of carrying around an exact formula store samples of  on a grid (or other structure)  Interpolate between grid points to get full definition (fast to evaluate!) Almost always use trilinear [work out]  If the grid is fine enough, can approximate any well- behaved closed surface But if the features of the geometry are the same size as the grid spacing or smaller, expect BAD behaviour  Note that properties of signed distance only hold approximately!

27cs533d-winter-2005 Building Level Sets  We’ll get into level sets more later on Lots of tools for constructing them from other representations, for sculpting them directly, or simulating them…  For now: can assume given  Or CSG: union and intersection with min and max [show 1d] Just do it grid point by grid point Note that weird stuff could happen at sub-grid resolution (with trilinear interpolation)  Or evaluate from analytical formula

28cs533d-winter-2005 Normals  We do have a function F defined everywhere (with interpolation) Could take its gradient and normalize But (with trilinear) it’s not smooth enough  Instead use numerical approximation for gradient: Then, use trilinear interpolation to get (continuous) approximate gradient anywhere Or instead apply finite difference formula to 6 trilinearly interpolated points (mathematically equivalent) Normalize to get unit-length normal

29cs533d-winter-2005 Evaluating outside the grid  Check if evaluation point x is outside the grid  If outside - that’s enough for interference test  But repulsion forces etc. may need an actual value  Most reasonable extrapolation: A = distance to closest point on grid B =  at that point Lower bound on distance, correct asymptotically and continuous (if level set doesn’t come to boundary of grid): Or upper bound on distance: