cloud modeling - using partical system

Started by
3 comments, last by apit 20 years, 8 months ago
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 (randx * randx + randy * randy) ) { anal[0] = randx; anal[1] = randy; anal[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<TITIK; i++) glVertex3fv(dot); 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; } </i>
apit
Advertisement
*snigger* gas anal *snigger*
"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan
quote:Original post by JY
*snigger* gas anal *snigger*


*teehee* Populate(gas anal)
Beer - the love catalystgood ol' homepage
i''m not really understand..
can you describe it more detail...?
which formula should i use to animate this cloud model?
the code that i paste is for gas.. i just modify it and make it like a cloud...can i did that ?
apit
>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?

Hello earth. Animating clouds using particle systems is not as simple as rendering your particles with GL, learn to live with it.

But to put it simply: find "nice" velocities assigned for each particle in a point in space, and apply (position = position+velocity*deltaTime, for a massless particle) this to the particle position.

I suggest simple translations (a directional "wind" vector) or a little bit of rotations. Also using a stochastical model for turbulent velocities could be quite cool, though I''ve never managed to implement those myself.

- Mikko Kauppila

This topic is closed to new replies.

Advertisement