terrain [-w x_postings] [-n y_postings] [-s xy_postings]
[-L lacunarity] [-H h_value] [-O octaves] [-S scale]
[-V x_scale,y_scale,z_scale] [-D x_delta,y_delta,z_delta]
[-o offset] [-f function] [-c] [-v] > file.dsp
TERRAIN(1)
NAME
terrain - generate a pseudo-terrain height field from procedural noise
On this page
SYNOPSIS
DESCRIPTION
The terrain program produces a pseudo-terrain height field from procedural noise, suitable for use with a BRL-CAD dsp (displacement map) primitive. A noise value is computed for each point of an x_postings by y_postings lattice and written to the standard output as unsigned 16-bit integers in network (big-endian) byte order. The default grid is 512 by 512 postings.
The character of the terrain is controlled by selecting a noise function with -f and by tuning the fractal noise parameters. The standard output must be redirected to a file; terrain refuses to write binary data to a terminal. The resulting file is in the same binary format produced by asc2dsp(1) and can be referenced directly by a dsp solid in MGED.
OPTIONS
- -w x_postings
-
Number of grid points (postings) in the X dimension. Default is 512.
- -n y_postings
-
Number of grid points (postings) in the Y dimension. Default is 512.
- -s xy_postings
-
Set the number of postings in both X and Y to the same value, producing a square grid.
- -L lacunarity
-
Scaling factor between successive octaves of noise. Practical values are non-integer numbers between roughly 1.7 and 4.0. Default is 2.1753974.
- -H h_value
-
The fractal increment (H) in the noise equation, controlling how detail diminishes across octaves. Usually near 1.0, which is the default.
- -O octaves
-
Number of octaves of noise to layer. Typical values are 2 through 8. Default is 7.
- -S scale
-
Scale the noise uniformly in X, Y and Z by scale. Values below 1.0 make the noise pattern finer; values above 1.0 make it coarser. This sets all three components of the vector scale (see -V). Default is 1.0.
- -V x_scale,y_scale,z_scale
-
Non-uniform scaling of the X, Y and Z dimensions in noise space. Default is 0.0125,0.0125,0.0125.
- -D x_delta,y_delta,z_delta
-
Translation (offset) applied in noise space, useful for sampling a different region of the noise field. Default is 1000,1000,1000.
- -o offset
-
Offset value used by the multi-fractal (m) and ridged (r) noise functions. Default is 1.0.
- -f function
-
Select the noise function used to generate the field. One of:
- f
-
Fractional Brownian motion (fBm). This is the default.
- t
-
Turbulence.
- T
-
Inverted turbulence: 1.0 - turb(pt).
- m
-
Multi-fractal.
- r
-
Ridged multi-fractal.
- L
-
A lunar-like surface.
- l
-
Terrain with detail concentrated on peaks and in valleys.
- -c
-
Toggle the conversion of output from host to network byte order. By default conversion is on; this only has an effect on little-endian hosts.
- -v
-
Toggle verbose/debug output, printing which noise function is running and clamping diagnostics to standard error.
EXAMPLES
terrain -w 256 -n 256 -f r -O 8 -S 1.5 > hills.dsp
mged terrain.g <<'EOF'
in mountains.dsp dsp f hills.dsp 256 256 0 ad 1 100
EOF
A 256x256 ridged multi-fractal height field is written to hills.dsp, then imported as a dsp primitive 256 cells wide and tall, smoothed, with a cell width of 1 and a height multiplier of 100, yielding a ridgeline of mountains in the database terrain.g.
terrain -s 512 -f f -O 5 -L 2.0 -D 0,0,0 > patch.dsp
A 512x512 fractional Brownian motion field generated with five octaves and a lacunarity of 2.0, sampled at the origin of noise space for a repeatable result.
SEE ALSO
brlcad(1), asc2dsp(1), asc2g(1), mged(1)
AUTHOR
BRL-CAD Team
COPYRIGHT
This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.
BUG REPORTS
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org