Class Noise
Procedural noise built from ShaderNode math, so it runs in either stage
on every backend and needs no texture. Every function takes a VEC2
coordinate; scale it to set the feature size.
The hashes avoid sin, whose precision differs between GPUs, and use
only additions, multiplications and fract.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ShaderNodebumpNormal(ShaderNode p, int octaves, float strength) The slope of fractal noise, as a tangent space normal forShaderNode.perturbNormal: bumps without a normal map.static ShaderNodeCellular (Worley) noise: the distance to the nearest of one random point per cell.static ShaderNodecellular(ShaderNode p, ShaderNode phase) Cellular noise whose feature points drift in circles over time, for moving water light and bubbling surfaces.static ShaderNodefbm(ShaderNode p, int octaves) Fractal value noise:octaveslayers, each twice the frequency and half the weight of the one before.static ShaderNodehash(ShaderNode p) A pseudo randomFLOATin [0, 1) for each point, constant over no region: feed itfloorof a coordinate for one value per cell.static ShaderNodehash2(ShaderNode p) Two independent pseudo random values in [0, 1).static ShaderNoderidged(ShaderNode p, int octaves) Ridged fractal noise: sharp creases where plain noise crosses its middle.static ShaderNodevalue(ShaderNode p) Smooth value noise in [0, 1], one feature per unit.
-
Method Details
-
hash
A pseudo random
FLOATin [0, 1) for each point, constant over no region: feed itfloorof a coordinate for one value per cell.Parameters
p: aVEC2
Returns
a
FLOAT -
hash2
Two independent pseudo random values in [0, 1).
Parameters
p: aVEC2
Returns
a
VEC2 -
value
Smooth value noise in [0, 1], one feature per unit.
Parameters
p: aVEC2
Returns
a
FLOAT -
fbm
Fractal value noise:
octaveslayers, each twice the frequency and half the weight of the one before. Clouds, terrain, dirt.Parameters
-
p: aVEC2 -
octaves: 1 to 6
Returns
a
FLOATin about [0, 1] -
-
ridged
Ridged fractal noise: sharp creases where plain noise crosses its middle. Mountain ridges, lightning, cracks.
Parameters
-
p: aVEC2 -
octaves: 1 to 6
Returns
a
FLOATin [0, 1] -
-
cellular
Cellular (Worley) noise: the distance to the nearest of one random point per cell. Foam, caustics, scales, cobbles, lava crust.
Parameters
p: aVEC2
Returns
a
FLOAT, 0 at a feature point and about 1 at most -
cellular
Cellular noise whose feature points drift in circles over time, for moving water light and bubbling surfaces.
Parameters
-
p: aVEC2 -
phase: aFLOATthat animates the points, such astime(), or null for still points
Returns
a
FLOAT -
-
bumpNormal
The slope of fractal noise, as a tangent space normal for
ShaderNode.perturbNormal: bumps without a normal map.Parameters
-
p: aVEC2 -
octaves: 1 to 6 -
strength: how steep the bumps are
Returns
a
VEC3 -
-