cloud modeling - partical system

i have model a cloud…
the problem is, how to animate it…
i don’t really understand about the partical system…
which formula should i used to animate the cloud?
below is my cloud model source code ::

#include <glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#define TITIK 2000
typedef GLfloat point3D[3];
typedef point3D gas[TITIK];

gas dot;

void Populate(gas anal)
{
int i=0;
GLfloat randx, randy;
{
while(i<TITIK)
{
randx = 2 * ((GLfloat)rand()/RAND_MAX) -1;
randy = 2 * ((GLfloat)rand()/RAND_MAX) -1;

// if not true, then (x,y) lies outside of the unit circle, so do not keep
if( 1.0 > (randx * randx + randy * randy) )
{
anal[i][0] = randx;
anal[i][1] = randy;
anal[i][2] = 0;
i++;
}
}
}
}

void MyInit()
{
Populate(dot);

}

int Update()
{

}

void Display(void)
{
int i;

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
        
gluLookAt(100.0, 200.0, 100.0,    // eye point
          1.0, 0.0, 0.0,      // center of view
          5.0, 0.0, 1.3);     // up	
glPushMatrix();

glScalef(10.0,10.0,10.0);
 
glColor3f(1.0, 1.0, 1.0);

glBegin(GL_QUADS);
for (i=0; i&lt;TITIK; i++)
    glVertex3fv(dot[i]);
glEnd();

glutSwapBuffers();

}

void Reshape(int w,int h)
{
glViewport(0,0,(GLsizei)w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(25.0, 0.3, 1.0, 300.0);
}

void Animate()
{

}

int main(int argc, char** argv)
{

glutInit(&argc,argv);
glutInitDisplayMode (GLUT_DOUBLE |GLUT_RGB | GLUT_DEPTH); 
glutInitWindowSize(600,400);
glutInitWindowPosition(50,50);
glutCreateWindow("Awan");
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
MyInit();
glutMainLoop();  
return 0;

}

maybe you should explain what exactly you want to do, instead of pasting code no one understands (and why do you call your variables “anal”???)… which effect you want to achieve.

Jan

“anal” really suggests that you want to program a farting simulation, to visualize “gas” clouds… is this true?

Jan

I remember that there was a small programm on the c64 which did this acustically… it asked parameters for time, “dry” or “wet” and number of “bubbles”, and then produced a really realistic fart. really, that’s no joke…

yes jahn…i study the gas code and try to convert it to cloud…

Originally posted by JanHH:
I remember that there was a small programm on the c64 which did this acustically… it asked parameters for time, “dry” or “wet” and number of “bubbles”, and then produced a really realistic fart. really, that’s no joke…

I remember that one too… that was a cool application. Why not port it and add some visualization with the code from apit?

Ok, getting serious. In your anal-array you will also need direction an velocity of each particle. Then you need a function you call each frame to calculate the new position of each particle depending on direction an velocity and also change both. You could begin with simple sinus / cosinus patterns.

Kilam.

so…what should i do now? which formula should i use to generate cloud animation? can you give me some idea and guide?

a reason why this question might be hard to answer is that clouds (the ones up in the sky) are in fact not very animated… they are rather static objects. Another point might be how to arrange particles that they make up the shape of a cloud, I had to solve this recently, but I guess that’s not what you mean. So you should first find out what kind of thing you want to visualize, maybe smoke thrown up by the wheels of a car or something like that, particles that are actually MOVING, what ordinary clouds don’t do. And I guess there are a lot of formulas how to do this then.

maybe look into volume rendering and perlin noise?

i’ve used perlin noise to generate animated 2d cloud textures, and the same technique can be used for 3d textures. however i havn’t played with animated clouds since i’ve learnt about volume rendering.

the only problem u may find, is generating the textures is quite cpu intensive, but this would be the first thing i try.

maybe a simple formula to move the cloud…
do you have any suggestion which formula to use(in partical system case)?

can you please say why and in which style you want to move your cloud, as, as I repeatedly said, clouds simply don’t move (at least, not the particles in it)? It’s hard to give a formula to animate something which just is not animated.

http://expert.ics.purdue.edu/~schpokj/research/purpl/clouds/index.html

-SirKnight

Originally posted by JanHH:
[b]can you please say why and in which style you want to move your cloud, as, as I repeatedly said, clouds simply don’t move (at least, not the particles in it)? It’s hard to give a formula to animate something which just is not animated.

[/b]

And what planet does this occur? Not Earth I know that.

-SirKnight

the clouds I see in the sky are not very animated, they might move, but do not really change their shape, are rather static objects… is this different on your planet?

Originally posted by JanHH:
the clouds I see in the sky are not very animated, they might move, but do not really change their shape, are rather static objects… is this different on your planet?

Surely not…stop frame animation of a rain cloud shows that they move and radically alter their shape over time. Even within an hour or two a cloud can look completely different. Its just a question of scale (physical and timeline).

This is the case on earth amd on other planets too just the physical constant alter (gravity, density, max wind speed etc.

The poster needs to provide much more information though and not just copy/paste code that he/she does not understand.

JAMAC

Originally posted by JanHH:
the clouds I see in the sky are not very animated, they might move, but do not really change their shape, are rather static objects… is this different on your planet?

Clouds in the real world earth are very dynamic, their boundaries can change as fast, and often faster the prevailing wind speed. I know as I have often thermalled up underneath cumulus and soared the leading edges of lenticular clouds whilst hang gliding. Even when not airborne much of hang glider pilots life is spent gazing skywards at clouds. Clouds are dynamic changing from second to second.

In realtime graphics you can’t model the full complexity of the atmosphere so you have to decide how accurate your want to model and visualise them. Static billboards that float off down wind might be good enough for some apps. A simply skydome might be good enough for others. A series of infiinite planes might be good for yet more…

For those interested in more realistic clouds Mark Harris’s work should be of interest:
http://www.cs.unc.edu/~harrism/

Robert.

in my case, i just want to make a simple cloud… it just a class assignment…i just need to model a simple cloud and animate it… so for beginner, what is your suggestion to me? it just to make i understand the partical system technic…( just a basic one…no need advance rendering like mark j. harris)… i hope all expert in this forum can help and guide me… thanks for your concern…

of course clouds are dynamic, but not so fast that they really change their shape in realtime, so the particals that make up a cloud are rather static. I think what the poster needs is not animation, but simply creation, how to put up particles so that they look like a cloud (mark harris clouds are not animated as well ).

I would recommend to bother with perlin noise (try google, or search the advanced forum here), I have created my particle clouds with it.

These are my clouds, just in fact that it is something like that you are looking for:
http://de.geocities.com/westphj2003/clouds.html

Jan