2015/06/24

Equation of motion for smoke particle

I have been trying to make smoke with particle in Metal. I suppose its particle should move to direction by its initial velocity vector at first, and its horizontal velocity decreases, and finally it moves upward. How can I implement this kind of movement in code?
So I simply use equation of motion for a particle which receives resistance (by air) which is in proportion to its velocity.

The equation of motion is here (written in Japanese) :
equation of motion

You can see [E] below at this page. And this equations are written as 2 dimensional coordinate, so I added it for z coordinate. And its solution is here :

Solution of motion equation

U0,V0,W0 is each initial velocity for x,y and z.
g means vertical acceleration (originally this means gravity off course, but this works particle as upward force).
Vt is final speed.
There are 5 coefficients (p1 to p5), which are sent to shader. I guess there would be more good way… Anyway, the smoke is here :



This smoke is written by 1000 particles, but iPhone 6 shows this in 60 FPS.
There are many parameters to show smoke, so this may not look good, but I suppose particle can show nice smoke with proper parameters’ setting.
e
Develop | Comments(0) | Trackback(0)
Comment

管理者のみに表示