Libraries & API
Planets
Noise

Noise

This library includes a couple of styles of noise to help generate interesting landscapes. The noise is based on a 3D simplex noise function.

The styles are based on this excellent blog series by Giliam de Carpentier (opens in a new tab).

More discussion about how to use noise in combinations will be covered in the ProcGen Terrain Cookbook.

Usage

import { Noise, NOISE_TYPES } from "@hello-worlds/planets"
 
new Noise({
  octaves: 13,
  persistence: 0.707,
  lacunarity: 1.8,
  exponentiation: 4.5,
  height: 300.0,
  scale: 1100.0,
  seed: "My Noise Seed",
  noiseType: NOISE_TYPES.FBM,
})
 
const { x, y, z } = new Vector3()
 
const value = Noise.get(x, y, z)
// returns some number

Props

:::note Defaults Although props are all optional, the defaults may not make sense for your usecase. Experiment! :::

PropTypeDefaultDescription
octavesnumber13How many layers of Noise?
persistencenumber0.707A multiplier that determines how quickly the amplitudes diminish for each successive octave.
lacunaritynumber1.8The frequency multiplier between octaves
exponentiationnumber4.5Raise the output by this exponent value
heightnumber300What's the min and max values?
scalenumber1100Scales the noise by a multiplier
seedstringgetSeed() from @hello-worlds/coreAllows passing a seed for consistency
noiseTypeNOISE_TYPES enumNOISE_TYPES.FMBWhich premade noise "style" to use? described below

Noise Types

Fractal Brownian Motion

The most generic type, which the other ones extend from.

Billowing

Create bubbling landscapes reminiscent of sand dunes.

Rigid

Create sharp peaks evoking mountainscapes.