Noise module
This module provides functions for generating pseudo-random values based on input positions. The functions are overloaded for different types of input positions (1D, 2D, and 3D) and return values between 0.0 and 1.0.
To use this module, include the following line in your project file:
require engine.math.noise_core // or require engine.core
Functions
fractal_noise (pos: float; scale: float; roughness: float; octaves: float) : float
fractal_noise (pos: float2; scale: float; roughness: float; octaves: float) : float
fractal_noise (pos: float3; scale: float; roughness: float; octaves: float) : float
fractal_noise (pos: float4; scale: float; roughness: float; octaves: float) : float
- noise(pos: float): float
Returns a pseudo-random value between 0.0 and 1.0 based on the input position.
- Arguments:
pos : float
- noise(pos: float2): float
Returns a pseudo-random value between 0.0 and 1.0 based on the input position.
- Arguments:
pos : float2
- noise(pos: float3): float
Returns a pseudo-random value between 0.0 and 1.0 based on the input position.
- Arguments:
pos : float3
- noise(pos: float4): float
Returns a pseudo-random value between 0.0 and 1.0 based on the input position.
- Arguments:
pos : float4
- noise_2d(pos: float): float2
Returns a pseudo-random value in square [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float
- noise_2d(pos: float2): float2
Returns a pseudo-random value in square [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float2
- noise_2d(pos: float3): float2
Returns a pseudo-random value in square [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float3
- noise_2d(pos: float4): float2
Returns a pseudo-random value in square [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float4
- noise_3d(pos: float): float3
Returns a pseudo-random value in cube [0, 1] x [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float
- noise_3d(pos: float2): float3
Returns a pseudo-random value in cube [0, 1] x [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float2
- noise_3d(pos: float3): float3
Returns a pseudo-random value in cube [0, 1] x [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float3
- noise_3d(pos: float4): float
Returns a pseudo-random value in cube [0, 1] x [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float4
- noise_4d(pos: float): float4
Returns a pseudo-random value in hypercube [0, 1] x [0, 1] x [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float
- noise_4d(pos: float2): float4
Returns a pseudo-random value in hypercube [0, 1] x [0, 1] x [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float2
- noise_4d(pos: float3): float4
Returns a pseudo-random value in hypercube [0, 1] x [0, 1] x [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float3
- noise_4d(pos: float4): float4
Returns a pseudo-random value in hypercube [0, 1] x [0, 1] x [0, 1] x [0, 1] based on the input position.
- Arguments:
pos : float4
- perlin_noise(pos: float): float
- Arguments:
pos : float - coordinate of sample point
- Returns:
float - value of Perlin noise in range [0..1]
Usage example:
let scale = 0.1
let value = perlin_noise(x * scale)
- perlin_noise(pos: float2): float
- Arguments:
pos : float2 - coordinate of sample point
- Returns:
float - value of Perlin noise in range [0..1]
Usage example:
let scale = 0.1
let value = perlin_noise(float2(x, y) * scale)
- perlin_noise(pos: float3): float
- Arguments:
pos : float3 - coordinate of sample point
- Returns:
float - value of Perlin noise in range [0..1]
Usage example:
let scale = 0.1
let value = perlin_noise(float3(x, y, z) * scale)
- perlin_noise(pos: float4): float
- Arguments:
pos : float4 - coordinate of sample point
- Returns:
float - value of Perlin noise in range [0..1]
Usage example:
let scale = 0.1
let value = perlin_noise(float4(x, y, z, time) * scale)
- fractal_noise(pos: float; scale: float; roughness: float; octaves: float): float
- Arguments:
pos : float - coordinate of sample point
scale : float - scale of the first octave
roughness : float - how much the amplitude decreases with each octave
octaves : float - number of octaves (can be fractional)
- Returns:
float - fractal noise value in range [0..1]
Usage example:
let scale = 0.1
let value = fractal_noise(x, scale, 0.5, 4.0)
- fractal_noise(pos: float2; scale: float; roughness: float; octaves: float): float
- Arguments:
pos : float2 - coordinate of sample point
scale : float - scale of the first octave
roughness : float - how much the amplitude decreases with each octave
octaves : float - number of octaves (can be fractional)
- Returns:
float - fractal noise value in range [0..1]
Usage example:
let scale = 0.1
let value = fractal_noise(float2(x, y), scale, 0.5, 4.0)
- fractal_noise(pos: float3; scale: float; roughness: float; octaves: float): float
- Arguments:
pos : float3 - coordinate of sample point
scale : float - scale of the first octave
roughness : float - how much the amplitude decreases with each octave
octaves : float - number of octaves (can be fractional)
- Returns:
float - fractal noise value in range [0..1]
Usage example:
let scale = 0.1
let value = fractal_noise(float3(x, y, z), scale, 0.5, 4.0)
- fractal_noise(pos: float4; scale: float; roughness: float; octaves: float): float
- Arguments:
pos : float4 - coordinate of sample point
scale : float - scale of the first octave
roughness : float - how much the amplitude decreases with each octave
octaves : float - number of octaves (can be fractional)
- Returns:
float - fractal noise value in range [0..1]
Usage example:
let scale = 0.1
let value = fractal_noise(float4(x, y, z, time), scale, 0.5, 4.0)