Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

field.noise

Deterministic value or gradient noise at a position field, scaled by frequency, summed over octaves and scaled by amplitude. kind = value gives [0, 1), gradient gives [-1, 1].

The octaves are summed by the noise prelude (zero_noise_fbm_value / zero_noise_fbm_gradient, and the ...2 plane forms): octave o draws from seed + o, doubles the frequency, halves the weight, and the sum is normalised by the weights. A Vec2 position reads the 2D lattice, equal to proc.noise.fbm2; a Vec3 the 3D one. The node is a field.call, so it is part of the chain its consumer evaluates in one dispatch. position has to be wired: g.field.position() reads the domain's positions, g.element.P the position leaf field.substitute replaces.

Inputs

  • position (Field<Vec2> | Field<Vec3>). Where in the noise each element reads from. Two elements at the same position sample the same value. A Vec2 position reads the 2D lattice, a Vec3 the 3D one.
  • frequency (Float). Default 1. Multiplies the sampled position: raising it shrinks the features. About 1 / frequency between one hill and the next.
  • amplitude (Float). Default 1. Multiplies the summed result: the output spans amplitude times [0, 1) for value and amplitude times [-1, 1] for gradient.
  • seed (Float). Default 1. Picks which noise this is. Each octave draws from seed + its own index.
  • octaves (Float). Default 1. How many layers are summed. Each layer after the first doubles the frequency and halves the weight. At least one layer is drawn.
  • kind (one of gradient, value). Default "value". value is unsigned over [0, 1); gradient is signed over [-1, 1] and exactly 0 at whole-number coordinates.

Outputs

  • field: a Float field.

Example

local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local out = g.attribute.set({ geometry = points, name = "v", value = g.field.noise({ position = g.field.position(), frequency = 0.7, octaves = 3, kind = "gradient" }) })