summary refs log tree commit diff
path: root/ppmforge.html
blob: 6e1f2fab1cdfb7b681042d6c5bfc64c9bed38a11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Ppmforge User Manual</title></head>
<body>
<h1>ppmforge</h1>
Updated: 27 March 2021
<br>
<a href="#index">Table Of Contents</a>

<h2>NAME</h2>

ppmforge - fractal forgeries of clouds, planets, and starry skies
<h2 id="synopsis">SYNOPSIS</h2>

<b>ppmforge</b>

[<b>-clouds</b>]
[<b>-night</b>]
[<b>-dimension</b> <i>dimen</i>]
[<b>-hour</b> <i>hour</i>]
[<b>-inclination|-tilt</b> <i>angle</i>]
[<b>-mesh</b> <i>size</i>]
[<b>-power</b> <i>factor</i>]
[<b>-glaciers</b> <i>level</i>]
[<b>-ice</b> <i>level</i>]
[<b>-saturation</b> <i>sat</i>]
[<b>-seed</b> <i>seed</i>]
[<b>-stars</b> <i>fraction</i>]
[{<b>-xsize</b>|<b>-width</b>} <i>width</i>]
[{<b>-ysize</b>|<b>-height</b>} <i>height</i>]

<h2 id="description">DESCRIPTION</h2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><b>ppmforge</b> 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 <b>ppmforge</b> are
essentially those given by Voss[1], particularly the technique of
spectral synthesis explained in more detail by Dietmar Saupe[2].

<p>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.

<p>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 <b>-mesh</b> 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
<b>-dimension</b> 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.

<p>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
<b>-power</b> 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).

<p>After these calculations, we have a array of the specified size
containing numbers that range from 0 to 1.  <b>ppmforge</b> generates
as follows:

<p>The randomness in the image is limited before Netpbm 10.37 (December
2006) -- if you run the program twice in the same second, you may get
identical output.

<dl compact>
<dt><b>Clouds</b>

<dd>
A color map is created that ranges from pure blue to white by
increasing admixture (desaturation) of blue with white.  Numbers less
than 0.5 are colored blue, numbers between 0.5 and 1.0 are colored
with corresponding levels of white, with 1.0 being pure white.

<dt><b>Planet</b>

<dd>
The mesh is projected onto a sphere.  Values less than 0.5 are treated
as water and values between 0.5 and 1.0 as land.  The water areas are
colored based upon the water depth, and land based on its elevation.
The random depth data are used to create clouds over the oceans.  An
atmosphere approximately like the Earth's is simulated; its light
absorption is calculated to create a blue cast around the limb of the
planet.  A function that rises from 0 to 1 based on latitude is
modulated by the local elevation to generate polar ice caps--high
altitude terrain carries glaciers farther from the pole.  Based on the
position of the star with respect to the observer, the apparent color
of each pixel of the planet is calculated by ray-tracing from the star
to the planet to the observer and applying a lighting model that sums
ambient light and diffuse reflection (for most planets ambient light
is zero, as their primary star is the only source of illumination).
Additional random data are used to generate stars around the planet.

<dt><b>Night</b>

<dd>
A sequence of pseudorandom numbers is used to generate stars with a
user specified density.
</dl>

<p>Cloud pictures always contain 256 or fewer colors and may be
displayed on most color mapped devices without further processing.
Planet pictures often contain tens of thousands of colors which must
be compressed with <b>pnmquant</b> or <b>ppmdither</b> before encoding
in a color mapped format.  If the display resolution is high enough,
<b>ppmdither</b> generally produces better looking planets.
<b>pnmquant</b> tends to create discrete color bands, particularly in
the oceans, which are unrealistic and distracting.  The number of
colors in starry sky pictures generated with the <b>-night</b> option
depends on the value specified for <b>-saturation</b>.  Small values
limit the color temperature distribution of the stars and reduce the
number of colors in the image.  If the <b>-saturation</b> is set to
0, none of the stars will be colored and the resulting image will
never contain more than 256 colors.  Night sky pictures with many
different star colors often look best when color compressed by
<b>pamdepth</b> rather than <b>pnmquant</b> or <b>ppmdither</b>.  Try
<i>newmaxval</i> settings of 63, 31, or 15 with <b>pamdepth</b> to
reduce the number of colors in the picture to 256 or fewer.


<h2 id="options">OPTIONS</h2>

<p>In addition to the options common to all programs based on libnetpbm
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
Common Options</a>), <b>ppmforge</b> recognizes the following
command line options:

<p>You can abbreviate any options to its shortest unique prefix.

<dl compact>
<dt><b>-clouds</b>

<dd>
Generate clouds.  An image of fractal clouds is generated.  Selecting clouds
sets the default for fractal dimension to 2.15 and power scale factor
to 0.75.

<dt><b>-dimension</b> <i>dimen</i>

<dd> Sets the fractal dimension to the specified <i>dimen</i>, which may be
any real number between 0 and 5 inclusive.  Higher fractal dimensions create
more ``chaotic'' images, which require higher resolution output and a larger
FFT mesh size to look good.  If no dimension is specified, the program uses
2.4 when generating planets and 2.15 for clouds.

<dt><b>-glaciers</b> <i>level</i>

<dd>The floating point <i>level</i> setting controls the extent to
which terrain elevation causes ice to appear at lower latitudes.  The
default value of 0.75 makes the polar caps extend toward the equator
across high terrain and forms glaciers in the highest mountains, as on
Earth.  Higher values make ice sheets that cover more and more of the
land surface, simulating planets in the midst of an ice age.  Lower
values tend to be boring, resulting in unrealistic
geometrically-precise ice cap boundaries.

<dt><b>-hour</b> <i>hour</i>

<dd>When generating a planet, <b>ppmforge</b> uses <i>hour</i> as the
"hour angle at the central meridian."  If you specify <b>-hour
12</b>, for example, the planet will be fully illuminated,
corresponding to high noon at the longitude at the center of the
screen.  You can specify any floating point value between 0 and 24 for
<i>hour</i>, but values which place most of the planet in darkness (0
to 4 and 20 to 24) result in crescents which, while pretty, don't give
you many illuminated pixels for the amount of computing that's
required.  If no <b>-hour</b> option is specified, a random hour angle
is chosen, biased so that only 25% of the images generated will be
crescents.

<dt><b>-ice</b> <i>level</i>

<dd>Sets the extent of the polar ice caps to the given floating point
<i>level</i>.  The default level of 0.4 produces ice caps similar to
those of the Earth.  Smaller values reduce the amount of ice, while
larger <b>-ice</b> settings create more prominent ice caps.
Sufficiently large values, such as 100 or more, in conjunction with
small settings for <b>-glaciers</b> (try 0.1) create "ice
balls" like Europa.

<dt><b>-inclination|-tilt</b> <i>angle</i>

<dd>The inclination angle of the planet with regard to its primary
star is set to <i>angle</i>, which can be any floating point value
from -90 to 90.  The inclination angle can be thought of as
specifying, in degrees, the ``season'' the planet is currently
experiencing or, more precisely, the latitude at which the star
transits the zenith at local noon.  If 0, the planet is at equinox;
the star is directly overhead at the equator.  Positive values
represent summer in the northern hemisphere, negative values summer in
the southern hemisphere.  The Earth's inclination angle, for example,
is about 23.5 at the June solstice, 0 at the equinoxes in March and
September, and -23.5 at the December solstice.  If no inclination
angle is specified, a random value between -21.6 and 21.6 degrees is
chosen.

<dt><b>-mesh</b> <i>size</i>

<dd>A mesh of <i>size</i> by <i>size</i> will be used for the fast
Fourier transform (FFT).  Note that memory requirements and
computation speed increase as the square of <i>size</i>; if you double
the mesh size, the program will use four times the memory and run four
times as long.  The default mesh is 256x256, which produces reasonably
good looking pictures while using half a megabyte for the 256x256
array of single precision complex numbers required by the FFT.  On
machines with limited memory capacity, you may have to reduce the mesh
size to avoid running out of RAM.  Increasing the mesh size produces
better looking pictures; the difference becomes particularly
noticeable when generating high resolution images with relatively high
fractal dimensions (between 2.2 and 3).

<dt><b>-night</b>

<dd>A starry sky is generated.  The stars are created by the same
algorithm used for the stars that surround planet pictures, but the
output consists exclusively of stars.

<dt><b>-power</b> <i>factor</i>

<dd>Sets the "power factor" used to scale elevations
synthesised from the FFT to <i>factor</i>, which can be any floating
point number greater than zero.  If no factor is specified a default
of 1.2 is used if a planet is being generated, or 0.75 if clouds are
selected by the <b>-clouds</b> option.  The result of the FFT image
synthesis is an array of elevation values between 0 and 1.  A
non-unity power factor exponentiates each of these elevations to the
specified power.  For example, a power factor of 2 squares each value,
while a power factor of 0.5 replaces each with its square root.  (Note
that exponentiating values between 0 and 1 yields values that remain
within that range.)  Power factors less than 1 emphasise large-scale
elevation changes at the expense of small variations.  Power factors
greater than 1 increase the roughness of the terrain and, like high
fractal dimensions, may require a larger FFT mesh size and/or higher
screen resolution to look good.

<dt><b>-saturation</b> <i>sat</i>

<dd>Controls the degree of color saturation of the stars that surround
planet pictures and fill starry skies created with the <b>-night</b>
option.  The default value of 125 creates stars which resemble the sky
as seen by the human eye from Earth's surface.  Stars are dim; only
the brightest activate the cones in the human retina, causing color to
be perceived.  Higher values of <i>sat</i> approximate the appearance
of stars from Earth orbit, where better dark adaptation, absence of
skyglow, and the concentration of light from a given star onto a
smaller area of the retina thanks to the lack of atmospheric
turbulence enhances the perception of color.  Values greater than 250
create ``science fiction'' skies that, while pretty, don't occur in
this universe.

<p>Thanks to the inverse square law combined with Nature's love of
mediocrity, there are many, many dim stars for every bright one.  This
population relationship is accurately reflected in the skies created
by <b>ppmforge</b>.  Dim, low mass stars live much longer than bright
massive stars, consequently there are many reddish stars for every
blue giant.  This relationship is preserved by <b>ppmforge</b>.  You
can reverse the proportion, simulating the sky as seen in a starburst
galaxy, by specifying a negative <i>sat</i> value.

<dt><b>-seed</b> <i>num</i>

<dd>Sets the seed for the random number generator to the integer
<i>num</i>.  The seed used to create each picture is displayed on
standard output (unless suppressed with the <b>-quiet</b> option).
Pictures generated with the same seed will be identical.  If no
<b>-seed</b> is specified, a random seed derived from the date and
time will be chosen.  Specifying an explicit seed allows you to
re-render a picture you particularly like at a higher resolution or
with different viewing parameters.

<dt><b>-stars</b> <i>fraction</i>

<dd>Specifies the percentage of pixels, in tenths of a percent, which
will appear as stars, either surrounding a planet or filling the
entire frame if <b>-night</b> is specified.  The default
<i>fraction</i> is 100.

<dt><b>-xsize|-width</b><i> width</i>

<dd>Sets the width of the generated image to <i>width</i> pixels.  The
default width is 256 pixels.  Images must be at least as wide as they
are high; if a width less than the height is specified, it will be
increased to equal the height.  If you must have a long skinny image,
make a square one with <b>ppmforge</b>, then use <b>pamcut</b> to
extract a portion of the shape and size you require.

<dt><b>-ysize|-height</b> <i>height</i>

<dd>Sets the height of the generated image to <i>height</i> pixels.
The default height is 256 pixels.  If the height specified exceeds the
width, the width will be increased to equal the height.

</dl>

<h2 id="limitations">LIMITATIONS</h2>

<p>The algorithms require the output image 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
image if necessary.

<p>You may have to reduce the FFT mesh size on machines with 16 bit
integers and segmented pointer architectures.

<h2 id="seealso">SEE ALSO</h2>

<b><a href="pamcut.html">pamcut</a></b>,
<b><a href="pamdepth.html">pamdepth</a></b>,
<b><a href="ppmdither.html">ppmdither</a></b>,
<b><a href="pnmquant.html">pnmquant</a></b>,
<b><a href="ppm.html">ppm</a></b>

<dl compact>
<dt>[1] 
<dd>
Voss, Richard F., ``Random Fractal Forgeries,'' in Earnshaw
et. al., Fundamental Algorithms for Computer Graphics, Berlin:
Springer-Verlag, 1985.

<dt>[2]
<dd>
Peitgen, H.-O., and Saupe, D. eds., The Science Of Fractal Images,
New York: Springer Verlag, 1988.

</dl>

<h2 id="author">AUTHOR</h2>

<pre>
John Walker
Autodesk SA
Avenue des Champs-Montants 14b
CH-2074 MARIN
Suisse/Schweiz/Svizzera/Svizra/Switzerland
    <b>Usenet:</b><a href="mailto:kelvin@Autodesk.com">kelvin@Autodesk.com</a>
    <b>Fax:</b>038/33 88 15
    <b>Voice:</b>038/33 76 33
</pre>

<p>
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.

<h3>PLUGWARE!</h3>

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.

<hr>
<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#synopsis">SYNOPSIS</a>
<li><a href="#description">DESCRIPTION</a>
<li><a href="#options">OPTIONS</a>
<li><a href="#limitations">LIMITATIONS</a>
<li><a href="#seealso">SEE ALSO</a>
<li><a href="#author">AUTHOR</a>
</ul>
</body>
</html>