Presentation - Stephen Spinks

Download Report

Transcript Presentation - Stephen Spinks

Mass Spring Particle Systems
STEPHEN SPINKS
09012036
Contents
This presentation will cover:
 Objectives
 Research
 Design
 Development
 Evaluation
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 covered
 Writing documents
 Human 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 = ma
 No system looks natural unless forces are included (gravity wind,
friction and collisions).
 The benefits of each force must outweigh it’s computational
overhead
 Basic 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 = realism
 Main bottleneck of cloth simulation
 Point check against all cloth points and environment points
 Methods are available to speed up the process
Stephen Spinks
09012036
The Research Phase: Types of Integration
 Many small predictions based on the laws of physics
 Explicit 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 up
 One simple collision
 Gravity included
 OpenCloth
 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 designed
 Not suitable for the project
 Next 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 appearance
 Code is now OO
Stephen Spinks
09012036
The Development Phase: Adding Wind
 First improvement was to add wind
 Shows this implementation can deal with natural forces
 Still looks realistic
 Working out the right wind
strength was challenging
 Simulation 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 added
 A new mesh and an ellipsoid were required
 Must be rectangular
 If 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 the




application
Different textures were used for the flag and
the cloth
Paul Angel’s texture loading function
was used
A simple light was added
A 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 particles
 Solution – change the weight of each particle so all cloths




weigh the same no matter how many particles in a mesh
Second problem – no ability to click and drag particles
Solution – none in available time
Third problem – cloth falling speed too slow
Partial 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 code
 A test example



Turn on collision when the cloth is
in 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 expected
 Objective 2 – not initially met well, but greatly improved
 Objective 3 – achieved as originally imagined
 Objective 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
Thank you for listening
P L E A S E F E E L F R E E TO A S K A N Y Q U E S T I O N S YO U H AV E