Experience with Simulation of Primitives for Cloud Animation
Hua Yuan
yuan@cs.umbc.edu
Computer Science Department
University of Maryland Baltimore County
1 Background
Modeling and animating clouds is a difficult task because of their complex, amorphous, three-dimensional structure[1]. Most previous graphics techniques fail to accurately represent the detailed three-dimensional structure and appearance of clouds. Dr. Ebert proposes a new way of cloud modeling called volumetric procedural modeling[1]. Clouds have high-level and low-level structure, so he proposes a two-step modeling approach. The first step is to model the high-level shape of the cloud, and a particle system is suggested to be used in this step. In the second step, procedural techniques can be used to add the detail, by adding noise and turbulence. Physics-based simulations of cloud are very costly, but if we can incorporate some high level physics knowledge to guide our simulation of particle system, it will cheaply produce clouds that may not be physically-accurate, but will be visually convincing [2]. This project experiments with Dr. Ebert's new method of cloud modeling- "volumetric procedural modeling". The project takes the two-step modeling of clouds. In the first step of the modeling process, the new method tries to incorporate some high level physics knowledge of clouds in the particle system.
2 Introduction
Many previous approaches have used semi-transparent surfaces to produce convincing images of clouds[1]. For example, Gardner[4] proposed textured ellipsoids covered with a procedural noise opacity which fades on the horizon of the shape. The method produced convincing image of cloud, but the method just modeled the surface of the cloud. To capture the three-dimensional structure of the cloud, volumetric density-based models must be used[1]. Kajiya[6] produced the first volumetric cloud model in computer graphics. Stam[5] used white noise filtering to generate a wind field with a mass conservation property and having defined statistical properties. Foster[7] and Ebert[8] also produced convincing volumetric models of smoke and steam, but have not done substantial work on cloud modeling. Ebert[1] presented a cloud animation which demonstrated that you can fly through the clouds, because he used volume data to described the clouds. Neyret[2] proposed a way to model convective clouds with some physics in consideration; however, his main point is to model the convective surface of the cloud, not the volume.
To develop a new cloud modeling and animation system, Ebert[1] has chosen to build upon his recent work on advanced modeling techniques and volumetric procedural modeling. Many advanced modeling techniques such as fractal, implicit surface, grammar-based modeling and volumetric procedural models/hypertextures use procedural method to model the details and give the designer control at the high level[8]. The procedural method can implement data amplification, abstraction of details, and ease of parametric control. Because time can be inputted as a parameter, it's also easy to implement animation using procedural methods.
Ebert[1] proposed volumetric procedural models for clouds. Volumetric procedural models use procedural methods to produce the three-dimensional volume data for the cloud. The volume data is generally a density field. Since a procedure is used to produce the density[1], any advanced procedural techniques, such as physics simulation, mathematical function or artistic algorithms, can be included in the model. In this model, the implicit function is used to merge the final density field from the primitives' fields. Implicit functions have been used successfully to model smoothly blended surfaces for many years[9]. Now the new volumetric procedural models use implicit function to model the volumetric density field of cloud. So, in this model, there are two places we can use procedural techniques: first, when we construct the macro-structure of the cloud, we can do some simple physics simulation, then, when we use implicit functions to generate the density field, we can add turbulence and noise to make the cloud realistic.
3 Method
The experimental method taken in this project is to write some small simulation programs to simulate the shape and movement of clouds. The cloud was formed by a set of primitives(particles) in the simulation program stage. The primitives could be spheres and superquadrics. The simulation program can generate successive frames.
A software previewer can be used to view the "raw" impression of the output. The previewer is programmed in OpenGL, and it treats each primitive as a sphere. After a satisfactory shape is produced on the criteria of the previewer's output, each frame of the primitives data can be fed to a volume renderer which uses volumetric procedural technology to add turbulence and uses implicit functions to form a volume density field for the clouds. At the same time the volume renderer is in charge of rendering the volume data (density field). After image files (format is .rle) for each frame are rendered, the software, Makemovie, is used to make an animation of these image files and Movieplayer is used to view the final animation.
The following figure shows the process of the experiment, we can get feedback at three points: previewer, volume rendered output and movie. The most accurate and intuitive feedback is the movie, but, it needs a lot of time to be produced.
3.1 Simulation program
The simulation programs are simple particle system simulation programs. They're all small programs with simple control. Dr. Ebert has done many simulations by himself. During my project, I first did some modifications to the original programs and discovered that it's not easy to modify and control the programs to generate the kind of cloud I expect to create. Then, I wrote some even simpler simulation programs which consider just simple physics such as velocity, gravity, and friction, etc. After I got some shapes which were similar to what I expected to see, I added some randomness to the movement and growth of the primitives to make the results more realistic.
Neyret[2] summarizes a lot of cloud's specific structures and macroscopic physics rules. I discovered it's not easy to incorporate these knowledges into my simple particle system simulation programs. The idea that a bubble has two levels of sub-structures was incorporated into my simulation programs to reduce the number of primitives in my simulation stage.
3.2 Previewer
Because the volume renderer will handle volume data which is three-dimensional, the magnitude of the data set is O(n^3) and the rendering process is slow. We have to visualize the result in a quick way during our experimenting stage to get fast feedback. So I wrote a previewer in OpenGL to view the primitives. OpenGL is a set of programming APIs for a z-buffer renderer. In the previewer, we treat each primitive as a sphere with its position and radius. After setting up the material of the spheres and setting up the light, we can have a "raw" impression of the result. We say it's "raw" because it can not give a very good preview of the final result, but it's useful in this project.
This picture shows the previewer's image. You can see there are some spheres in the air:
3.3 Volume Renderer
The volume renderer is provided by Dr. Ebert. The name of the renderer is "avoid". We can feed a text input file to this renderer. In the input file, we should specify the following information by parameters:
(1) observer position and light position information;
(2) all the information of the primitives such as position and radius,
blend, etc;
(3) other illumination and rendering information.
The volume renderer is very flexible because you can specify a lot of parameters to control the effects. If we feed the same data for the above image to the volume renderer with appropriate parameters, we can get a picture like this:
4 High Level Physics Knowledges of the cloud
Neyret[2] Summarizes a lot of physics knowledges of the cloud. He thinks that in computer graphics, the accurate simulation of the cloud is difficult, because what you can get is the large scale result of complex non linear physical phenomena, combining the effects of fluid mechanics and thermodynamics. However, using the macroscopic approach, we can simulate some specific structures and characteristics of the cloud. He enumerates some structures such as Rayleigh-Taylor instability, bubbles, jets and volume, Bernard Cells, Kelvin-Helmholtz instability[2]. Even to simulate these specific structures is not easy, but this macroscopic approach reduces the complexity greatly.
We can summarize the formation of clouds like this: at first, a bubble is generated on the ground, then it flows up because of the force generated by the gradient temperature difference. As it flows up, it grows and maybe merges with other bubbles into a big bubble. At some height, it cools off and changes into small visible particle. During the process of moving up, the bubbles may spread in the horizontal directions. My simulation programs are based on the assumption that clouds are formed in this way.
5 Particle System
Reeves[3] proposes a popular approach to produce animation as particle system. According to Reeves, a particle system is a large collection of primitives which have finite life-spans. Each primitive can move and produce new primitives in its life. Also, the primitives may be terminated. The primitives have some typical attributes, such as :
(1) position
(2) velocity
(3) shape parameters
(4) color
(5) transparency
(6) lifetime
So, at each frame, some primitives are born and some are terminated, and some change their attributes according to the appropriate rules. Generally, these rules are the approximations of the physics rules. So, the particle system is very suitable for cloud simulation in this project. In my simulation program the primitives have attributes such as velocity, radius, lifetime, position.
6 Volumetric procedural modeling :macrostructure and microstructure
According to Ebert's volumetric procedural modeling[1], the two components of the cloud's model are macrostructure and microstructure. They are separately modeled by implicit functions and turbulence models.
The cloud's microstructure is modeled by procedural turbulence and noise functions[8]. Using procedural methods you can have easy parametric control to simulate the level of detail you need.
Implicit functions were proposed to smoothly blend density distribution[10]. Here, we use spheres as the primitives and each sphere stands for a density volume in our final model. We also need a way to blend them. Implicit functions provide a easy way to combine them smoothly. You just need to specify the weight for each primitives. The summed weight of all the primitives using the implicit blending function is our final density model.
The density weighting function(blending function) generally used is the following:
r is the distance to the primitive. The equation shows that when r=0, it's 1, when r=R, it's 0.
7 Sub-structure for a bubble
To reduce the number of the primitives in the particle system, I introduced the idea of sub-structure for bubble from Neyret[2]'s paper. In his paper, Neyret describes that the a bubble has two levels sub-structures. On each level, a big particle is replaced by a bunch of small particles which are distributed on the big particle's surface.
In my simulation program, I added just one level sub-structure to the bubble. What's more, only big bubbles have sub-structures. Small bubbles need not be sub-divided because doing subdivision for small bubbles won't effectively increase the realistic details for the cloud surface, but it greatly increase the number of spheres in the final result. The number of spheres will affect the rendering speed. The bubbles are sorted into "big" and "small" according to their radii. The number of bubbles affects the speed of volume rendering. So, if a bubble is very big, it's actually a "virtual bubble" because when the program writes output file it writes a bunch of small bubbles instead. For convenience of notation, we can call this "virtual particle" the parent particle and call the generated small particles the child particles.
Because in the simulation programs the movement ranges of the child particles are confined by the parent particle's position and size, the child particles which form a big one won't drift too far away from each other in their lives. On the other hand, the child particles can do some procedural movements, such as drifting a little bit or rotating around the center of the parent particle. In this way, we can make that the cloud has rich surface details. In the volumetric procedural models of the cloud, the finer details of the cloud should be generated by the turbulence. We can think that the sub-structure of the bubble generates some surface details which are a little bit more high-level than the details generated by the turbulence method. The big advantage of procedural method is to use computer's ability to mimic the details which are overwhelmingly complex if not done with computer.
How to control the child particles' movements in the parent particle's confinement is something which needs further consideration. In the simulation program. I just let the child particles evenly distribute on the big "virtual" particle's surface and rotate a little bit in some directions (all the child particles who have the same parent particle move in the same direction). On this basis, the program adds some randomness to the position of each child particle. After the movie was made throughout the process, we discovered that the movements of the child particles were very artificial because you can feel that a "virtual particle" is spinning around there. Even if we slow down the rotations of the child particles you can still feel that.
8 Result
This is an image of the cloud generated by the project.
This image is one frame of a movie which was made for this project. The program is like this :
List :
Parse all control parameters from command arguments
Generate some bubbles with initial lifetime, radius, position, up speed
and horizontal speed, the horizontal speed is small compared to the up
speed, at the beginning all the bubbles stick together in the origin point
of the space
For Each Frame
Move Each primitive according to its speed and increase its radius
if it's alive
Slow down the up velocity of the bubble a little bit considering the friction
and make some random changes to the horizontal speed. The control of the
speed is the key to the shape of the final cloud.
For each bubble decide whether to create a new bubble for it, if a new
bubble is created, initialize the new bubble's attributes.
Decrease the lifetime of the bubble.
Write out all the bubbles for this frame. During the writing out, for each big bubble, replace it with a bunch of small child particles and add some procedural movements and rotations around the center of its parent bubble to each child particle; for each small bubble, just write it out.
End For
You can see that you can add a lot of randomness and physics knowledge in many stages of this simulation program, but, how to add it effectively is not an easy question.
The project also produced two animations.
9 Conclusion
Volumetric procedural modeling provides a very flexible way to model cloud and cloud animation. This project uses particle system to simulate the macrostructure of the cloud and cloud animation. The programs are simple-physics based simulations. This project generates some clouds and cloud animations.
10 Acknowledgement
Thanks to my project's advisor, Dr. Ebert, for his patient guidance in this project and his flexible volume renderer "avoid".
11 Reference
[1]Dr Ebert "A volumetric Procedural Cloud Model ", Spring 1998.
[2]Fabrice Neyret "Qualitative Simulation of Convective Cloud Formation and Evolution". IN Eighteen International Workshop on Computer Animation and Simulation . Eurographics,September 1997.
[3]Reeves, W., "Particle Systems - A Technique for Modeling a Class of Fuzzy Objects," SIGGRAPH'83, pp. 359-376.
[4]Geoffrey Y.Gardner. Forest Fire Simulation . In Forest Baskett,editor, Computer Graphics (SIGGRAPH'90 Proceedings) Volume 24, Page 430,August 1990.
[5]Jos Stam and Eugene Fiume. Depicting fire and other gaseous phenomena using diffusion process. In Robert Cook,editor, SIGGRAPH 95 conference Proceedings, Annual Conference Series,Pages 129-136. ACM SIGGRAPH, Addison Wesley, August 1995, Held in Los Angeles, California,06-11 August 1995.
[6] James T.Kajiya and Brian P.Von Herzen. Raytracing volume densities. IN Hank Christiansen,editor, Computer Graphics (SIGGRAPH'84 Proceedings),volume 18,Page 165-174,July 1984.
[7]Nick Foster and Dimitris Metaxas. Modeling the motion of a hot,turbulence gas. In Turner Whitted,editor, SIGGRAPH 97 Conference Proceedings, Annual Conference Series, pages 181-188. ACM SIGGRAPH, Addison Wesley, August 1997. ISBN 0-89791-896-7.
[8]David Ebert, F.Kenton Musgrave, Darwyn Peachey, Ken Perlin,and Steve Worley. Textureing and Modeling: A Procedural Approach. Academic Press, October 1994. ISBN 0-12-228760-6.
[9]Jules Bloomenthal, Chandrajit Bajaj, Jim Blinn, Marie-PaulCani-Gascuel, Alyn Rockwood, Brian Wyvill, and Geoff Wyvill, Introduction to implicit Surfaces. Morgan Kaufman Publisher,Inc. 1997.
[10]Brian Wyvill, Craig McPheeters, and Geoff Wyvill. Data structure for soft objects. The Visual Computer,2(4):227-234,1986.