API ReferenceGE Extensionsflowgraphnodesutil
Perlin Noise (Flowgraph Node)
- **Node Name:** `Perlin Noise`
Overview
- Node Name:
Perlin Noise - Category:
repeat_instant - File:
extensions/flowgraph/nodes/util/perlinNoise.lua
Generates coherent random numbers using Perlin noise. Produces smooth, natural-looking random values suitable for procedural content.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
flow | flow | - | Input flow |
value | number | - | Input seed value (e.g., time or distance) |
octaves | number (hidden) | 6 | Number of detail levels |
amplitude | number (hidden) | 128 | Output value range |
frequency | number (hidden) | 4 | Detail density per octave |
normalize | bool (hidden) | false | Normalize output to -0.5 to 0.5 range |
randomStartSeed | bool (hidden) | true | Randomize seed each run for varied patterns |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Output flow |
value | number | The generated noise value |
Internals
Key Methods
| Method | Description |
|---|---|
init() | Initializes graph data, debug settings, scale range |
drawCustomProperties() | Provides "Smooth preset" and "Natural preset" buttons |
drawMiddle(builder, style) | Renders a debug graph of recent output values |
_executionStarted() | Initializes permutation table, sets random start seed |
work() | Computes octave Perlin noise from input value, maintains debug graph |
OctavePerlin(x, y, z, octaves, amplitude, frequency) | Multi-octave noise accumulator |
noise(x, y, z) | Core Perlin noise function using permutation hash |
grad(hash, x, y, z) | Gradient function using dot product lookup |
fade(t) | Smoothstep fade: 6t⁵ - 15t⁴ + 10t³ |
lerp(t, a, b) | Linear interpolation |
Presets
| Preset | Frequency | Amplitude | Octaves |
|---|---|---|---|
| Smooth | 0.15 | 64 | 1 |
| Natural | 0.5 | 128 | 6 |
Debug
When data.debug is true, the node displays a scrolling graph of the last 1000 output values in the editor.
How It Works
- On execution start, builds the permutation table (classic Perlin noise permutation) and optionally generates a random start seed.
- Each frame, computes
OctavePerlin(randomStartSeed + inputValue, 0, 0, ...). - Octave noise sums multiple noise passes at increasing frequency and decreasing amplitude.
- Core
noise()function hashes unit cube coordinates and interpolates gradients using the fade function. - If
normalizeis enabled, divides the result by the maximum possible value to produce -0.5 to 0.5 range.
Usage Example
-- Generate smooth terrain-like variation:
-- [Timer] → elapsed → value → [Perlin Noise] octaves=6, frequency=0.5
-- → value → [Scale] → [Set Terrain Height]
-- Use for vehicle body sway animation:
-- [Frame Counter] → count → value → [Perlin Noise] preset=Smooth
-- → value → [Apply Camera Offset]Key Dependencies
bit(bit32) - bitwise operations for permutation hash- Classic Perlin noise permutation table (Ken Perlin's reference implementation)
See Also
- Route Distance (Flowgraph Node) - Related reference
- Closest Road (Flowgraph Node) - Related reference
- Custom Lua (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide