next up previous contents
Next: 17.6 Water Up: 17 Natural Phenomena Previous: 17.4 Explosions   Contents

17.5 Clouds

Clouds, like smoke, have an amorphous structure without well defined surfaces and boundaries. In recent times, computationally intensive physical modeling techniques have given way to simplified mathematical models which are both computationally tractable and aesthetically pleasing [34,28].

The main idea behind these techniques involves generating a realistic 2D or 3D texture function $t$ using a fractal or spectral based function. Gardner suggests a Fourier-like sum of sine waves with phase shifts

\begin{displaymath}t(x,y) = k \sum_{i=1}^{n}\left (c_{i}\sin(fx_ix+px_{i}) + t_{...
...um_{i=1}^{n}\left ( c_{i}\sin(fy_{i}y + py_{i}) + t_{0} \right)\end{displaymath}

with the relationships

fx_{i+1} & = & 2fx_{i} \\
fy_{i+1} & = & 2fy_{i} \\
c_{i+1} ...
...}y), i > 1 \\
py_{i} & = & {\pi \over 2} \sin(fx_{i-1}x), i > 1

Care must be taken using this technique to choose values to avoid a regular pattern in the texture. Alternatively, texture generation techniques described in Section 6.20.2 can be used.

A stochastic method, based on work by Fournier and Miller [32,66], uses a midpoint displacement technique called Diamond-Square for generating a set of random values on a uniform grid. These generated values are interpreted as opacity values and correspond to the cloud density at a given point. The algorithm is iterative and during each iteration two steps are executed. The first, the diamond step takes four corners of a square and produces a new value at the center of the square by averaging the values at the four corners and adding a random number in the range $[-1,1]$. The second step, the square step, consists of taking the corners of the four diamonds that were generated in the diamond step (they share the center point of the diamond step) and generating a new center value for each diamond by averaging its four corners and adding a random number in the range $[-1,1]$. During the square step, attention must be paid to diamonds at the edges of the grid as they will wrap around to the opposite side of the grid. During each iteration the number of squares processed is increased by a factor of four. To produce smooth variations in the generated values, the range of the random value added during the generation of center points is reduced by some fraction for each iteration.

Seed values for the first few iterations of the algorithm may be used to control the overall shape of the cloud.

Any of these techniques can be used to produce a 2D texture which can be used to render a cloud layer. A cloud layer is simulated by drawing a large textured polygon in the sky at a fixed altitude. A luminance cloud texture is used to blend a white constant texture environment color into a blue sky polygon.

Some of the dynamic aspects of clouds can be simulated by vary parameters over time. Cloud development can be simulated by scaling and biasing the luminance values in the texture. Drifting can be simulated by moving the texture pattern across the sky, i.e., transforming the texture coordinates. Ground fog can be simulated by drawing the thin cloud layer between the viewer and ground rather than the viewer and the sky.

Gardner also suggests using ellipsoids to simulate 3D cloud structures. The texture data is generated using a 3-dimensional extension of the Fourier synthesis method outlined above and the textures are applied with increasing transparency near the boundary of the ellipsoid. These 3D textures can also be combined with the volume rendering techniques described in Section 16.2 to produce 3D cloud images. In order to improve the performance of the rendering, the full volume rendering algorithm need not be used. In particular, the cloud may be assumed to be elliptical and opaque at the center. Therefore, the interior of the cloud can be drawn as a polygonal shell and the outer edges of the cloud using the volume rendering techniques.

next up previous contents
Next: 17.6 Water Up: 17 Natural Phenomena Previous: 17.4 Explosions   Contents