.. _stdlib_noise_core: ============ 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 +++++++++ * :ref:`noise (pos: float) : float ` * :ref:`noise (pos: float2) : float ` * :ref:`noise (pos: float3) : float ` * :ref:`noise (pos: float4) : float ` * :ref:`noise_2d (pos: float) : float2 ` * :ref:`noise_2d (pos: float2) : float2 ` * :ref:`noise_2d (pos: float3) : float2 ` * :ref:`noise_2d (pos: float4) : float2 ` * :ref:`noise_3d (pos: float) : float3 ` * :ref:`noise_3d (pos: float2) : float3 ` * :ref:`noise_3d (pos: float3) : float3 ` * :ref:`noise_3d (pos: float4) : float ` * :ref:`noise_4d (pos: float) : float4 ` * :ref:`noise_4d (pos: float2) : float4 ` * :ref:`noise_4d (pos: float3) : float4 ` * :ref:`noise_4d (pos: float4) : float4 ` * :ref:`perlin_noise (pos: float) : float ` * :ref:`perlin_noise (pos: float2) : float ` * :ref:`perlin_noise (pos: float3) : float ` * :ref:`perlin_noise (pos: float4) : float ` * :ref:`fractal_noise (pos: float; scale: float; roughness: float; octaves: float) : float ` * :ref:`fractal_noise (pos: float2; scale: float; roughness: float; octaves: float) : float ` * :ref:`fractal_noise (pos: float3; scale: float; roughness: float; octaves: float) : float ` * :ref:`fractal_noise (pos: float4; scale: float; roughness: float; octaves: float) : float ` .. _function-noise_core_noise_float: .. das:function:: noise(pos: float) : float Returns a pseudo-random value between 0.0 and 1.0 based on the input position. :Arguments: * **pos** : float .. _function-noise_core_noise_float2: .. das:function:: noise(pos: float2) : float Returns a pseudo-random value between 0.0 and 1.0 based on the input position. :Arguments: * **pos** : float2 .. _function-noise_core_noise_float3: .. das:function:: noise(pos: float3) : float Returns a pseudo-random value between 0.0 and 1.0 based on the input position. :Arguments: * **pos** : float3 .. _function-noise_core_noise_float4: .. das:function:: noise(pos: float4) : float Returns a pseudo-random value between 0.0 and 1.0 based on the input position. :Arguments: * **pos** : float4 .. _function-noise_core_noise_2d_float: .. das:function:: 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 .. _function-noise_core_noise_2d_float2: .. das:function:: 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 .. _function-noise_core_noise_2d_float3: .. das:function:: 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 .. _function-noise_core_noise_2d_float4: .. das:function:: 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 .. _function-noise_core_noise_3d_float: .. das:function:: 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 .. _function-noise_core_noise_3d_float2: .. das:function:: 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 .. _function-noise_core_noise_3d_float3: .. das:function:: 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 .. _function-noise_core_noise_3d_float4: .. das:function:: 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 .. _function-noise_core_noise_4d_float: .. das:function:: 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 .. _function-noise_core_noise_4d_float2: .. das:function:: 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 .. _function-noise_core_noise_4d_float3: .. das:function:: 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 .. _function-noise_core_noise_4d_float4: .. das:function:: 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 .. _function-public_noise_perlin_noise_float: .. das:function:: 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) .. _function-public_noise_perlin_noise_float2: .. das:function:: 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) .. _function-public_noise_perlin_noise_float3: .. das:function:: 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) .. _function-public_noise_perlin_noise_float4: .. das:function:: 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) .. _function-public_noise_fractal_noise_float_float_float_float: .. das:function:: 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) .. _function-public_noise_fractal_noise_float2_float_float_float: .. das:function:: 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) .. _function-public_noise_fractal_noise_float3_float_float_float: .. das:function:: 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) .. _function-public_noise_fractal_noise_float4_float_float_float: .. das:function:: 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)