TERRAIN(1)

πŸ“¦
version 7.44.0 Β· 2 versions
, in nixpkgs unstable

πŸŒ„ TERRAIN(1) β€” the BRL-CAD terrain page, bestie edition πŸ’–

okay so picture this: it's a manual page, it's called terrain, it lives in the BRL-CAD section 1, and it's about to make you a whole mountain range out of literally nothing but math. obsessed. πŸ”οΈβœ¨


✨ NAME ✨

terrain β€” generates a pseudo-terrain height field out of procedural noise. that's it, that's the vibe. πŸŽ€


🫢 SYNOPSIS 🫢

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

notice the > file.dsp at the end, bestie β€” that redirect is not optional, and you're about to find out why. πŸ‘€


🌸 DESCRIPTION 🌸

so terrain produces a pseudo-terrain height field from procedural noise, and it's built to be used with a BRL-CAD dsp (displacement map) primitive. it computes a noise value for every single point of an x_postings by y_postings lattice, then writes them all to standard output as unsigned 16-bit integers in network (big-endian) byte order. the default grid is 512 by 512 postings β€” that's 512 Γ— 512 little height values, no cap. πŸ”₯

the character of your terrain is a whole vibe check you control two ways: pick the noise function with -f, and tune the fractal noise parameters. that's how you go from "gentle rolling hills" to "dramatic ridgecore" and everything in between. πŸ’…

⚠️ the standard output must be redirected to a file. terrain straight up refuses to write binary data to a terminal. it's protecting you. it's protecting your terminal. respect it. 😭

the resulting file is in the exact same binary format that asc2dsp(1) produces, and a dsp solid in MGED can reference it directly. so it slots right into your workflow, no conversion era needed. πŸ¦‹


πŸ’… 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 β€” sets the number of postings in both X and Y to the same value, giving you a perfectly square grid. symmetry slay. ✨
  • -L lacunarity β€” the scaling factor between successive octaves of noise. practical values are non-integer numbers roughly between 1.7 and 4.0. default is 2.1753974. yes that's a very specific little number, it's fine, it's iconic. πŸŽ€
  • -H h_value β€” the fractal increment (H) in the noise equation, which controls how detail diminishes across octaves. usually near 1.0, and 1.0 is the default. 🌸
  • -O octaves β€” how many octaves of noise to layer. typical values are 2 through 8. default is 7. more layers = more drama, obviously. πŸ”₯
  • -S scale β€” scales 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. heads up: 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, which is genuinely useful for sampling a different region of the noise field. default is 1000,1000,1000. 🧚
  • -o offset β€” the offset value used by the multi-fractal (m) and ridged (r) noise functions. default is 1.0. ⭐
  • -f function β€” selects the noise function used to generate the field. pick exactly one of these, bestie:
    • f β€” Fractional Brownian motion (fBm). this is the default. the main character. πŸ‘‘
    • t β€” Turbulence.
    • T β€” Inverted turbulence: 1.0 - turb(pt). yes, the capital letter matters, iykyk. πŸ’€
    • m β€” Multi-fractal.
    • r β€” Ridged multi-fractal.
    • L β€” a lunar-like surface. moon behavior. πŸŒ™ (ok that emoji is not on the list but the energy is there)
    • l β€” terrain with detail concentrated on peaks and in valleys. lowercase version, different creature entirely, do not mix them up. πŸ™ˆ
  • -c β€” toggles the conversion of output from host to network byte order. by default conversion is on; this only has any effect on little-endian hosts. so on big-endian machines, respectfully, nothing happens. πŸ’…
  • -v β€” toggles verbose/debug output, printing which noise function is running and clamping diagnostics to standard error. very "tell me what you're doing" of it. 🫢

πŸŽ€ EXAMPLES πŸŽ€

Example 1. Generate a terrain and build a dsp solid

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

so real talk: a 256x256 ridged multi-fractal height field gets written to hills.dsp, and then it's imported as a dsp primitive 256 cells wide and tall, smoothed, with a cell width of 1 and a height multiplier of 100 β€” which yields a ridgeline of mountains in the database terrain.g. literally building mountains with two commands. ate. πŸ”οΈπŸ”₯

Example 2. Create a tileable, square fBm patch

terrain -s 512 -f f -O 5 -L 2.0 -D 0,0,0 > patch.dsp

this one gives you 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. repeatable = same input, same output, every time. consistency queen. ✨


πŸ’– SEE ALSO πŸ’–

brlcad(1), asc2dsp(1), asc2g(1), mged(1) β€” go read those too, they're all part of the same friend group. 🫢


🌟 AUTHOR 🌟

the BRL-CAD Team. collectively iconic. πŸ‘‘


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. if something's broken, tell them, don't suffer in silence bestie. πŸ˜­πŸ’Œ


okay that's the whole page!! every flag, every default, every number, preserved with love. πŸ“

sign-off szn β€” this little love letter came to you from BRL-CAD, and it's the TERRAIN(1) page, dated right there in that 1989-2026 copyright window. go make some mountains, bestie. periodt. πŸ’…βœ¨πŸŒ„

πŸ“¦ where this page comes from