Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

texture.noise (procNode)

A procedural noise texture, value or gradient noise mapped between two colours: a Texture whose texels are drawn on the device, each one colour. The same seed gives the same texels on every run, machine and platform.

Inputs

  • width (Float, default 64, min 1): texels across.
  • height (Float, default 64, min 1): texels down.
  • scale (Float, default 8): how many noise lattice cells span the image, the feature size. 1 stretches a single cell over the whole texture (one broad blob), 32 packs 32 cells across it (fine grain). The count is the same on both axes in texture space, so a non-square image stretches its cells with it.
  • seed (Float, default 0): which noise field is drawn. Changing it draws an unrelated field at the same scale.
  • kind (String, default "value"): "value", "gradient" or "fbm". "gradient" is Perlin-style gradient noise, signed and remapped onto the colour range, which reads smoother and more isotropic; "value" and "fbm" both draw value noise off the lattice corners.
  • octaves (Float, default 1, min 1): how many layers of the noise are summed, each at twice the frequency and half the amplitude of the one before it. 1 draws the bare noise at scale; raising it lays finer detail over the same large shapes. This, for every kind, is what makes the noise fractal.
  • low (Vec4, default (0, 0, 0, 1)): the colour a noise value of 0 takes, as { r, g, b, a } in 0-1. Alpha is interpolated with the colour, so a low alpha of 0 leaves the dark parts transparent.
  • high (Vec4, default (1, 1, 1, 1)): the colour a noise value of 1 takes. Every texel lands between this and low.

Outputs

  • texture (Texture): { width, height, format = "rgba32f", texels }, the texels one Vec4 per texel row by row from the top left.

g.texture.noise(...) calls this node. In a graph built with proc.graph, g:node("<id>", "texture.noise") names a different operation of the same name, which makes the pixels on the CPU.

Example

local clouds = g.texture.noise({ width = 128, height = 128, kind = "gradient", octaves = 5, scale = 4,
    low = { 0.1, 0.2, 0.5, 1 }, high = { 1, 1, 1, 1 } })