Mass Spring Particle Systems
description
Transcript of Mass Spring Particle Systems
S T E P H E N S P I N K S0 9 0 1 2 0 3 6
Mass Spring Particle Systems
Contents
This presentation will cover:ObjectivesResearchDesignDevelopmentEvaluation
Stephen Spinks 09012036
Objectives
To research, identify and compare a variety of mass spring particle systems
To design different methods of creating mass spring particle systems and an application to demonstrate them
To develop an application to demonstrate different mass spring particle systems
To evaluate the quality, and realistic appearance of the mass spring particle systems and the application used to demonstrate them
Stephen Spinks 09012036
The Research Phase
The research phase coveredWriting documentsHuman computer interaction (HCI)Mass spring particle systems
Basic concepts Physics Spring networks and their arrangement Collision detection Integration methods Using OpenGL and the GPU
Stephen Spinks 09012036
The Research Phase: Basic Concepts
A modelling system contains a set of modelling elements (particles)A particle contains both static and dynamic states, which will evolve
over time using f = maNo system looks natural unless forces are included (gravity wind,
friction and collisions).The benefits of each force must outweigh it’s computational overheadBasic simulation loop:
Reset the modelling system Set the acceleration for each particle, using the force Move the system forward by one time step Check for and handle any collisions Display the results to the screen
Stephen Spinks 09012036
The Research Phase: Physics
Gravity Acts downwards f = mg 9.81 (2 d.p.)
Hooke’s Law Determines the force on two masses,
connected by a spring Rest length = no force in either
direction
Stephen Spinks 09012036
The Research Phase: Physics
Provot Dynamic Inverse Many high stresses in a small area produce unrealistic characteristics Possible solutions
Increase stiffness Use dynamic inverse procedures
Xavier Provot’s algorithm Compare current length to rest length Move non-fixed ends towards each other Helps deformation move through the cloth
Stephen Spinks 09012036
The Research Phase: Spring Networks
3 types of spring Structural (stretch) Diagonal (shear) Interleaved (bend)
Stephen Spinks 09012036
The Research Phase: Collision Detection
Brief impact stage High velocity decrease
Structural deformation stage Restores original position Disperses energy
Efficiency = realismMain bottleneck of cloth simulation
Point check against all cloth points and environment pointsMethods are available to speed up the process
Stephen Spinks 09012036
The Research Phase: Types of Integration
Many small predictions based on the laws of physicsExplicit Euler
Simplest form of integration Least processor heavy Add position and velocity change Less accurate than RK4
Runge-Kutta Order 4 (RK4) Very processor intensive Detects rate of change any times every timestep Combined to create an average
Stephen Spinks 09012036
The Research Phase: Tutorials
Simple set upOne simple collisionGravity includedOpenCloth
OpenGL Utility Toolkit (GLUT) OpenGL Mathematics (GLM)
MoseGaards Cloth Simulation GLUT Textured
Stephen Spinks 09012036
The Research Phase: Outputs
Chosen language: C++ and OpenGL using Visual Studio 2010
Physics to include Hooke’s Law Drag Gravity
Cloth layout: Using all three spring types Stretch Shear Bend
Stephen Spinks 09012036
The Design Phase
Originally a Windows Forms application was designedNot suitable for the projectNext idea
Build on top of OpenCloth but, All in one source file Uses freeglut
New idea Use OO code Setup OpenGL with Paul’s code Use Paul’s CGFont class to display text
Stephen Spinks 09012036
The Design Phase
Extra functionality to include: Add text to the screen Increase the number of cloth particles in real-time Add wind Add collision Add texture to the cloth
Stephen Spinks 09012036
The Development Phase
First aims Get application working with the same functionality as OpenCloth Add particle interaction Add text display
Very similar appearanceCode is now OO
Stephen Spinks 09012036
The Development Phase: Adding Wind
First improvement was to add windShows this implementation can deal with natural forcesStill looks realisticWorking out the right wind
strength was challengingSimulation and collision can
now be turned on and off
Stephen Spinks 09012036
The Development Phase: Adding a Flag
To demonstrate the wind properly a flag was addedA new mesh and an ellipsoid were requiredMust be rectangularIf collision is turned on the
flag can collide with the pole
Stephen Spinks 09012036
The Development Phase: Adding Textures
Finally, textures were created and added to theapplication
Different textures were used for the flag andthe cloth
Paul Angel’s texture loading functionwas used
A simple light was addedA normal update function
maps textures correctly
Stephen Spinks 09012036
Application Demonstration
Application Demonstration
Stephen Spinks 09012036
The Evaluation Phase: Problems Encountered
Main problem – increase in mass when adding particlesSolution – change the weight of each particle so all cloths
weigh the same no matter how many particles in a meshSecond problem – no ability to click and drag particlesSolution – none in available timeThird problem – cloth falling speed too slowPartial solution – increase gravity and modify spring
length (too much gravity = unnatural spring stretch)
Stephen Spinks 09012036
The Evaluation Phase: Program Testing
Many different scenarios were used to test the program for errors
Would discover any bugs in the codeA test example
Turn on collision when the cloth isin the middle of the ellipsoid
Expected – cloth jumps back Result – moved back smoother
than expected
Stephen Spinks 09012036
The Evaluation Phase: Big O Notation
Big O notation describes the performance of an algorithm, It uses the worst case scenario
void Physics::IntegrateEuler(void){float deltaTimeMass = deltaTime / mass;size_t i = 0; for(i = 0; i < totalParticles; i++){glm::vec3 oldV = (*V)[i];(*V)[i] += ((*F)[i] * deltaTimeMass);(*X)[i] += deltaTime * oldV; if((*X)[i].y < 0)(*X)[i].y = 0;}}
Resulting notation – O(N).
Stephen Spinks 09012036
The Evaluation Phase: Future Enhancements
Particle manipulation Place the cloth in any position See how it would react
Use the GPU Demonstrate the advantage of GPU usage Allow the cloth to fall more naturally
Self collision Most complex enhancement Add extra realism Very computationally expensive
Stephen Spinks 09012036
The Evaluation Phase: Conclusion
Objective 1 – reached, but not as well as expectedObjective 2 – not initially met well, but greatly improvedObjective 3 – achieved as originally imaginedObjective 4 – achieved as predicted
There were some hiccups along the way, but it has turned out as expected and met the original objectives to a good level
Stephen Spinks 09012036
P L E A S E F E E L F R E E T O A S K A N Y Q U E S T I O N S YO U H AV E
Thank you for listening