project 2
play

Project 2: Basic particle system Constrained Particle System - PowerPoint PPT Presentation

Requirements Project 2: Basic particle system Constrained Particle System Tinkertoys Requirements for Particle system particle system Implement following components Particle structure The particle system is attached to a


  1. Requirements Project 2: • Basic particle system Constrained Particle System • Tinkertoys Requirements for Particle system particle system • Implement following components • Particle structure • The particle system is attached to a node of your hierarchical model other than the root node • Force structure • There are at least two distinctive forces acting on the • ODE solver particle system. For example, gravity and spring forces • Particle system that has accesses to particles, forces, and an instance of ODE solver

  2. Skeleton code ParticleSystem • Provide high level particle system structure in • constructor, destructor, and etc. ParticleSystem class • computeForcesAndUpdateParticles() • A Euler step is executed every time • drawParticles() ParticleSystem::computeForcesAndUpdateParticles() is called from ModelerView::draw() • startSimulation() • ODE solver is called from • stopSimulation() computeForcesAndUpdateParticles() Other structures Other structures • ODE solver • Particle class • Ideally, ODE solver should be independent from the particle system • Force class • Particle system instantiates an ODE solver and • An elegant implementation would include a keeps the pointer as a data member generic force class and a variety of distinct forces • When an ODE solver is created, a void pointer that inherit from it that points to the particle system is passed to the ODE constructor

  3. Embedding in Tinkertoy animation system • Store particles as coordinates in world space • Extend the basic particle system with constraints • Attach a particle emitter to a node in the model • Implement following two types of constraints hierarchy • Constraint that keeps the bead on the circle • need to calculate the world coordinates of the particle emitter every time a particle is spawned • Constraint that keeps two particles at a fixed distance apart from each other • glGetFloatv(MODELVIEW_MATRIX, m) Requirements for Skeleton code Tinkertoys • Implement a particle that is constrained to move along a circle • Implement a second particle that is kept a fixed distance apart from the particle on the circle • There is no skeleton code for this part of the assignment • Simulate the particles under the gravity and the interactive force applied using the mouse • Experiment the coefficients for the constraint feedback

  4. Where do you start? Constraints • Draw a circle on the screen • Implement constraints in a similar way as forces • Rewrite robotarm.cpp by taking out all the • Define a base class for constraints and inherit controls and drawing a 2D circle on the screen from it when you implement each specific type of constraints • Define global structures in ParticleSystem • Number your constraints and particles so you can • Need to allocate space for structure such as index them easily Jacobian matrix Solving constraint Jacobian matrix forces n blocks • 2D array • Build a linear system • VL matrix class • Loop over each constraint to evaluate the C i m blocks constraint function and its various derivatives • Sparse matrix • Solve the final linear system by • computing the inverse matrix • using linear system solvers provided by VL x j x k

  5. Hooking up to basic VL: Vector library particle system • VL provides a set of vector and matrix classes, as well as a number of functions for performing arithmetic with them • Constraint forces are calculated after ordinary forces • Most arithmetic operators and functions for vectors and before updating the derivative of the current and matrices are supported (+, -, *, /, dot(), len(), state cross(), trans(), inv(), etc) • Everything happens in • VL also provides two linear system solvers: computeForcesAndUpdateParticles() SolveOverRelax() and SolveConjGrad() • Include “VLd.h” in your code Mouse interaction Experiments • Each time the mouse button and the shift key are • Add feedback term to the constraint acceleration pressed at the same time, find the particle closest to the mouse and apply the force directly on that C = − k s C − k d ˙ ¨ particle C • Apply an attractive spring force between the particle • Play with the coefficients k s and k d to find the and the mouse until the button is released optimal values • Add code in ModelerView::handle() to catch the • Do these experiments from the UI, instead of event when left button and the shift key are pushed recompiling the entire code every time you change the coefficients • Create and delete “mouse forces” on the fly

  6. Bells and whistles Bells and whistles • Implement additional types of constraints • Realistic looking particles • Constraints that output more than one scalar • Billboard technique • Initialize the velocity of particles • Alpha blending • Helicopter with a cannon launching packages out Bells and whistles Bells and whistles • Implement a more sophisticated ODE solver • Implement collision detection • Adaptive step size • Provide control of the restitution constant • Midpoint method • Allow particles to bounce off each other • 4th order Runge-Kutta methd • Create an interactive billboard game • Implicit Euler’s method

  7. Bells and whistles Bells and whistles • Add flocking behaviors to simulate creatures moving • Create a chain reaction machine in flocks, herds, or schools • Simulate complicated interaction between the • You might need to implement a rigid body character and the particles simulator • Design a set of tools to build arbitrary tinkertoys on • Cloth simulation the fly • Read the literature in this area first • building blocks: beads, rings, sticks, springs, etc. Introduce: Introduce: monstrous bell monstrous bell =

  8. Demos

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend