Section: User Commands (1)
Updated: 25 October 1991
ppmforge [-clouds] [-night] [-dimension dimen] [-hour hour] [-inclination|-tilt angle] [-mesh size] [-power factor] [-glaciers level] [-ice level] [-saturation sat] [-seed seed] [-stars fraction] [-xsize|-width width] [-ysize|-height height]
ppmforge generates three kinds of ``random fractal forgeries,'' the term coined by Richard F. Voss of the IBM Thomas J. Watson Research Center for seemingly realistic pictures of natural objects generated by simple algorithms embodying randomness and fractal self-similarity. The techniques used by ppmforge are essentially those given by Voss, particularly the technique of spectral synthesis explained in more detail by Dietmar Saupe.
The program generates two varieties of pictures: planets and clouds, which are just different renderings of data generated in an identical manner, illustrating the unity of the fractal structure of these very different objects. A third type of picture, a starry sky, is synthesised directly from pseudorandom numbers.
The generation of planets or clouds begins with the preparation of an array of random data in the frequency domain. The size of this array, the ``mesh size,'' can be set with the -mesh option; the larger the mesh the more realistic the pictures but the calculation time and memory requirement increases as the square of the mesh size. The fractal dimension, which you can specify with the -dimension option, determines the roughness of the terrain on the planet or the scale of detail in the clouds. As the fractal dimension is increased, more high frequency components are added into the random mesh.
Once the mesh is generated, an inverse two dimensional Fourier transform is performed upon it. This converts the original random frequency domain data into spatial amplitudes. We scale the real components that result from the Fourier transform into numbers from 0 to 1 associated with each point on the mesh. You can further modify this number by applying a ``power law scale'' to it with the -power option. Unity scale leaves the numbers unmodified; a power scale of 0.5 takes the square root of the numbers in the mesh, while a power scale of 3 replaces the numbers in the mesh with their cubes. Power law scaling is best envisioned by thinking of the data as representing the elevation of terrain; powers less than 1 yield landscapes with vertical scarps that look like glacially-carved valleys; powers greater than one make fairy-castle spires (which require large mesh sizes and high resolution for best results).
After these calculations, we have a array of the specified size containing numbers that range from 0 to 1. The pixmaps are generated as follows:
Cloud pictures always contain 256 or fewer colours and may be displayed on most colour mapped devices without further processing. Planet pictures often contain tens of thousands of colours which must be compressed with ppmquant or ppmdither before encoding in a colour mapped format. If the display resolution is high enough, ppmdither generally produces better looking planets. ppmquant tends to create discrete colour bands, particularly in the oceans, which are unrealistic and distracting. The number of colours in starry sky pictures generated with the -night option depends on the value specified for -saturation. Small values limit the colour temperature distribution of the stars and reduce the number of colours in the image. If the -saturation is set to 0, none of the stars will be coloured and the resulting image will never contain more than 256 colours. Night sky pictures with many different star colours often look best when colour compressed by pnmdepth rather than ppmquant or ppmdither. Try newmaxval settings of 63, 31, or 15 with pnmdepth to reduce the number of colours in the picture to 256 or fewer.
The algorithms require the output pixmap to be at least as wide as it is high, and the width to be an even number of pixels. These constraints are enforced by increasing the size of the requested pixmap if necessary.
John Walker Autodesk SA Avenue des Champs-Montants 14b CH-2074 MARIN Suisse/Schweiz/Svizzera/Svizra/Switzerland
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, without any conditions or restrictions. This software is provided ``as is'' without express or implied warranty.
PLUGWARE! If you like this kind of stuff, you may also enjoy ``James Gleick's Chaos--The Software for MS-DOS, available for $59.95 from your local software store or directly from Autodesk, Inc., Attn: Science Series, 2320 Marinship Way, Sausalito, CA 94965, USA. Telephone: (800) 688-2344 toll-free or, outside the U.S. (415) 332-2344 Ext 4886. Fax: (415) 289-4718. ``Chaos--The Software includes a more comprehensive fractal forgery generator which creates three-dimensional landscapes as well as clouds and planets, plus five more modules which explore other aspects of Chaos. The user guide of more than 200 pages includes an introduction by James Gleick and detailed explanations by Rudy Rucker of the mathematics and algorithms used by each program.
Tutoriais de Tecnologia Web