Cloth SimulationSlide 2Cloth Simulation with SpringsSlide 4ParticleEuler IntegrationPhysics SimulationSlide 8Uniform GravitySpring-DampersSpring-DamperSlide 12Slide 13Spring-Damper ForceSlide 15Slide 16Aerodynamic ForceSlide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Bending ForcesSlide 27CollisionsPlastic DeformationSlide 30Fracture & TearingRopes & SolidsSystem StabilityConservation of MomentumConservation of EnergySlide 36Slide 37Simulation StabilityIntegrationTwo-Level Integration MethodsMultipoint MethodsRunge-Kutta MethodsCloth StabilityAdvanced ClothContinuum MechanicsCollision Detection & ResponseSlide 47Cloth SimulationCSE169: Computer AnimationInstructor: Steve RotenbergUCSD, Winter 2005Cloth SimulationCloth simulation has been an important topic in computer animation since the early 1980’sIt has been extensively researched, and has reached a point where it is *basically* a solved problemToday, we will look at a very basic method of cloth simulation. It is relatively easy to implement and can achieve good results. It will also serve as an introduction to some more advanced cloth simulation topics.Cloth Simulation with SpringsWe will treat the cloth as a system of particles interconnected with spring-dampersEach spring-damper connects two particles, and generates a force based on their positions and velocitiesEach particle is also influenced by the force of gravityWith those three simple forces (gravity, spring, & damping), we form the foundation of the cloth systemThen, we can add some fancier forces such as aerodynamics, bending resistance, and collisions, plus additional features such as plastic deformation and tearingCloth Simulation• • ••••••••ParticleSpring-damperParticle•fam1vriffforcemomentummassmonaccelera tivelocityposition::::::fpavrvp mEuler IntegrationOnce we’ve computed all of the forces in the system, we can use Newton’s Second Law (f=ma) to compute the accelerationThen, we use the acceleration to advance the simulation forward by some time step Δt, using the simple Euler integration schemettnnnnnn111vrravvnnmfa1Physics SimulationGeneral Physics Simulation:1. Compute forces2. Integrate motion- RepeatCloth Simulation1. Compute ForcesFor each particle: Apply gravityFor each spring-damper: Compute & apply forcesFor each triangle: Compute & apply aerodynamic forces2. Integrate MotionFor each particle: Apply forward Euler integrationUniform Gravity 20008.90smmgravityggfSpring-Dampers••1r2r2v1vThe basic spring-damper connects two particles and has three constants defining its behaviorSpring constant: ksDamping factor: kdRest length: l0Spring-DamperA simple spring-damper class might look like:class SpringDamper {float SpringConstant,DampingFactor;float RestLength;Particle *P1,*P2;public:void ComputeForce();};Spring-DampersThe basic linear spring force in one dimension is:The linear damping force is:We can define a spring-damper by just adding the two: llkxkfssspring0 21vvkvkfdddamp 210vvkllkfdssdSpring-DampersTo compute the forces in 3D:Turn 3D distances & velocities into 1DCompute spring force in 1DTurn 1D force back into 3D forceSpring-Damper ForceWe start by computing the unit length vector e from r1 to r2We can compute the distance l between the two points in the process••1r2rll***12eeerreelSpring-DampersNext, we find the 1D velocities••1r2r2v1ve22ve v11ve vSpring-DampersNow, we can find the 1D force and map it back into 3D••efsdf1e 121210ffefsddssdfvvkllkf12ff Aerodynamic ForceIn the last lecture, we defined a simple aerodynamic drag force on an object as:ρ: density of the air (or water…)cd: coefficient of drag for the objecta: cross sectional area of the objecte: unit vector in the opposite direction of the velocityevf acdaero221vve Aerodynamic ForceToday we will extend that to a simple flat surfaceInstead of opposing the velocity, the force pushes against the normal of the surfaceNote: This is a major simplification of real aerodynamic interactions, but it’s a good place to startnvf acdaero221Aerodynamic ForceIn order to compute the aerodynamic forces, we need surfaces to apply it toWe will add some triangles to our cloth definition, where each triangle connects three particles1r2r3rAerodynamic ForceIn order to compute our force:we will need find the velocity, normal, and area of the triangle (we can assume that ρ and cd are constants)1r2r3rnvf acdaero221Aerodynamic ForceFor the velocity of the triangle, we can use the average of the three particle velocitiesWe actually want the relative velocity, so we will then subtract off the velocity of the air1v2v3v3321vvvvsurfaceairsurfacevvv surfacevAerodynamic ForceThe normal of the triangle is:1r2r3rn 13121312rrrrrrrrnAerodynamic ForceThe area of the triangle is:But we really want the cross-sectional area (the area exposed to the air flow) 1312021rrrr avnv 0aanvvAerodynamic ForceAs the final equation requires |v |2an, we can reduce the math a little bit:Also, notice that: **2**21312nnnvvnvrrrrna22**nvnvAerodynamic ForceThe final aerodynamic force is assumed to apply to the entire triangleWe can turn this into a force on each particle by simply dividing by 3, and splitting the total force between themBending ForcesIf we arrange our cloth springs as they are in the picture, there will be nothing preventing the cloth from bendingThis may be find for simulating softer cloth, but for stiffer materials, we may want some resistance to bending• • •••••••Bending ForcesA simple solution is to add more springs, arranged in various configurations, such as the one in the pictureThe spring constants and damping factors of this layer might need to be tuned differently…• • •••••••CollisionsWe will talk about collision detection & response in the next lecture…In the mean time, here’s a very basic way to collide with a y=y0 planeIf(r.y < y0) {r.y= y0 - r.y;v.y= - elasticity * v.y;v.x= (1-friction) * v.x; // cheezyv.z=
View Full Document