Blender V5.0
blender::noise Namespace Reference

Classes

struct  VoronoiParams
struct  VoronoiOutput

Functions

Hash Functions

Create a randomized hash from the given inputs. Contrary to hash functions in BLI_hash.hh these functions produce better randomness but are more expensive to compute.

uint32_t hash (uint32_t kx)
uint32_t hash (uint32_t kx, uint32_t ky)
uint32_t hash (uint32_t kx, uint32_t ky, uint32_t kz)
uint32_t hash (uint32_t kx, uint32_t ky, uint32_t kz, uint32_t kw)
uint32_t hash_float (float kx)
uint32_t hash_float (float2 k)
uint32_t hash_float (float3 k)
uint32_t hash_float (float4 k)
uint32_t hash_float (const float4x4 &k)
float hash_to_float (uint32_t kx)
float hash_to_float (uint32_t kx, uint32_t ky)
float hash_to_float (uint32_t kx, uint32_t ky, uint32_t kz)
float hash_to_float (uint32_t kx, uint32_t ky, uint32_t kz, uint32_t kw)
float hash_float_to_float (float k)
float hash_float_to_float (float2 k)
float hash_float_to_float (float3 k)
float hash_float_to_float (float4 k)
float2 hash_float_to_float2 (float2 k)
float2 hash_float_to_float2 (float3 k)
float2 hash_float_to_float2 (float4 k)
float3 hash_float_to_float3 (float k)
float3 hash_float_to_float3 (float2 k)
float3 hash_float_to_float3 (float3 k)
float3 hash_float_to_float3 (float4 k)
float4 hash_float_to_float4 (float4 k)
Jenkins Lookup3 Hash Functions
BLI_INLINE uint32_t hash_bit_rotate (uint32_t x, uint32_t k)
BLI_INLINE void hash_bit_mix (uint32_t &a, uint32_t &b, uint32_t &c)
BLI_INLINE void hash_bit_final (uint32_t &a, uint32_t &b, uint32_t &c)
BLI_INLINE uint32_t float_as_uint (float f)
static ATTR_NO_SIGNED_INT_OVERFLOW int2 hash_pcg2d_i (int2 v)
static ATTR_NO_SIGNED_INT_OVERFLOW int3 hash_pcg3d_i (int3 v)
static ATTR_NO_SIGNED_INT_OVERFLOW int4 hash_pcg4d_i (int4 v)
BLI_INLINE float uint_to_float_01 (uint32_t k)
static float int_to_float_01 (int32_t k)
static float2 hash_int2_to_float2 (int2 k)
static float3 hash_int3_to_float3 (int3 k)
static float4 hash_int4_to_float4 (int4 k)
static float3 hash_int2_to_float3 (int2 k)
static float3 hash_int4_to_float3 (int4 k)

Perlin Noise

Perlin, Ken. "Improving noise." Proceedings of the 29th annual conference on Computer graphics and interactive techniques. 2002.

This implementation is functionally identical to the implementations in EEVEE, OSL, and SVM. So any changes should be applied in all relevant implementations.

enum  {
  NOISE_SHD_PERLIN_MULTIFRACTAL = 0 , NOISE_SHD_PERLIN_FBM = 1 , NOISE_SHD_PERLIN_HYBRID_MULTIFRACTAL = 2 , NOISE_SHD_PERLIN_RIDGED_MULTIFRACTAL = 3 ,
  NOISE_SHD_PERLIN_HETERO_TERRAIN = 4
}
float perlin_signed (float position)
float perlin_signed (float2 position)
float perlin_signed (float3 position)
float perlin_signed (float4 position)
float perlin (float position)
float perlin (float2 position)
float perlin (float3 position)
float perlin (float4 position)
template<typename T>
float perlin_fbm (T p, float detail, float roughness, float lacunarity, bool normalize)
template<typename T>
float perlin_fractal_distorted (T position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)
float3 perlin_float3_fractal_distorted (float position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)
float3 perlin_float3_fractal_distorted (float2 position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)
float3 perlin_float3_fractal_distorted (float3 position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)
float3 perlin_float3_fractal_distorted (float4 position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)
template<typename T>
static T mix (T v0, T v1, float x)
BLI_INLINE float mix (float v0, float v1, float v2, float v3, float x, float y)
BLI_INLINE float mix (float v0, float v1, float v2, float v3, float v4, float v5, float v6, float v7, float x, float y, float z)
BLI_INLINE float mix (float v0, float v1, float v2, float v3, float v4, float v5, float v6, float v7, float v8, float v9, float v10, float v11, float v12, float v13, float v14, float v15, float x, float y, float z, float w)
BLI_INLINE float fade (float t)
BLI_INLINE float negate_if (float value, uint32_t condition)
BLI_INLINE float noise_grad (uint32_t hash, float x)
BLI_INLINE float noise_grad (uint32_t hash, float x, float y)
BLI_INLINE float noise_grad (uint32_t hash, float x, float y, float z)
BLI_INLINE float noise_grad (uint32_t hash, float x, float y, float z, float w)
BLI_INLINE float floor_fraction (float x, int &i)
BLI_INLINE float perlin_noise (float position)
BLI_INLINE float perlin_noise (float2 position)
BLI_INLINE float perlin_noise (float3 position)
BLI_INLINE float perlin_noise (float4 position)
template float perlin_fbm< float3 > (float3 p, const float detail, const float roughness, const float lacunarity, const bool normalize)
template float perlin_fbm< float2 > (float2 p, const float detail, const float roughness, const float lacunarity, const bool normalize)
template<typename T>
float perlin_multi_fractal (T p, const float detail, const float roughness, const float lacunarity)
template<typename T>
float perlin_hetero_terrain (T p, const float detail, const float roughness, const float lacunarity, const float offset)
template<typename T>
float perlin_hybrid_multi_fractal (T p, const float detail, const float roughness, const float lacunarity, const float offset, const float gain)
template<typename T>
float perlin_ridged_multi_fractal (T p, const float detail, const float roughness, const float lacunarity, const float offset, const float gain)
template<typename T>
float perlin_select (T p, float detail, float roughness, float lacunarity, float offset, float gain, int type, bool normalize)
BLI_INLINE float random_float_offset (float seed)
BLI_INLINE float2 random_float2_offset (float seed)
BLI_INLINE float3 random_float3_offset (float seed)
BLI_INLINE float4 random_float4_offset (float seed)
BLI_INLINE float perlin_distortion (float position, float strength)
BLI_INLINE float2 perlin_distortion (float2 position, float strength)
BLI_INLINE float3 perlin_distortion (float3 position, float strength)
BLI_INLINE float4 perlin_distortion (float4 position, float strength)
template float perlin_fractal_distorted< float > (float position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)
template float perlin_fractal_distorted< float2 > (float2 position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)
template float perlin_fractal_distorted< float3 > (float3 position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)
template float perlin_fractal_distorted< float4 > (float4 position, float detail, float roughness, float lacunarity, float offset, float gain, float distortion, int type, bool normalize)

Voronoi Noise

Note
Ported from Cycles code.

Original code is under the MIT License, Copyright (c) 2013 Inigo Quilez.

Smooth Voronoi:

Distance To Edge based on:

With optimization to change -2..2 scan window to -1..1 for better performance, as explained in https://www.shadertoy.com/view/llG3zy.

enum  { NOISE_SHD_VORONOI_EUCLIDEAN = 0 , NOISE_SHD_VORONOI_MANHATTAN = 1 , NOISE_SHD_VORONOI_CHEBYCHEV = 2 , NOISE_SHD_VORONOI_MINKOWSKI = 3 }
enum  {
  NOISE_SHD_VORONOI_F1 = 0 , NOISE_SHD_VORONOI_F2 = 1 , NOISE_SHD_VORONOI_SMOOTH_F1 = 2 , NOISE_SHD_VORONOI_DISTANCE_TO_EDGE = 3 ,
  NOISE_SHD_VORONOI_N_SPHERE_RADIUS = 4
}
float voronoi_distance (const float a, const float b)
float voronoi_distance (const float2 a, const float2 b, const VoronoiParams &params)
float voronoi_distance (const float3 a, const float3 b, const VoronoiParams &params)
float voronoi_distance (const float4 a, const float4 b, const VoronoiParams &params)
float4 voronoi_position (const float coord)
VoronoiOutput voronoi_f1 (const VoronoiParams &params, const float coord)
VoronoiOutput voronoi_smooth_f1 (const VoronoiParams &params, const float coord, const bool calc_color)
VoronoiOutput voronoi_f2 (const VoronoiParams &params, const float coord)
float voronoi_distance_to_edge (const VoronoiParams &params, const float coord)
float voronoi_n_sphere_radius (const VoronoiParams &params, const float coord)
float4 voronoi_position (const float2 coord)
VoronoiOutput voronoi_f1 (const VoronoiParams &params, const float2 coord)
VoronoiOutput voronoi_smooth_f1 (const VoronoiParams &params, const float2 coord, const bool calc_color)
VoronoiOutput voronoi_f2 (const VoronoiParams &params, const float2 coord)
float voronoi_distance_to_edge (const VoronoiParams &params, const float2 coord)
float voronoi_n_sphere_radius (const VoronoiParams &params, const float2 coord)
float4 voronoi_position (const float3 coord)
VoronoiOutput voronoi_f1 (const VoronoiParams &params, const float3 coord)
VoronoiOutput voronoi_smooth_f1 (const VoronoiParams &params, const float3 coord, const bool calc_color)
VoronoiOutput voronoi_f2 (const VoronoiParams &params, const float3 coord)
float voronoi_distance_to_edge (const VoronoiParams &params, const float3 coord)
float voronoi_n_sphere_radius (const VoronoiParams &params, const float3 coord)
float4 voronoi_position (const float4 coord)
VoronoiOutput voronoi_f1 (const VoronoiParams &params, const float4 coord)
VoronoiOutput voronoi_smooth_f1 (const VoronoiParams &params, const float4 coord, const bool calc_color)
VoronoiOutput voronoi_f2 (const VoronoiParams &params, const float4 coord)
float voronoi_distance_to_edge (const VoronoiParams &params, const float4 coord)
float voronoi_n_sphere_radius (const VoronoiParams &params, const float4 coord)
template<typename T>
VoronoiOutput fractal_voronoi_x_fx (const VoronoiParams &params, const T coord, const bool calc_color)
template<typename T>
float fractal_voronoi_distance_to_edge (const VoronoiParams &params, const T coord)
template<typename T>
static float voronoi_distance_bound (const T a, const T b, const VoronoiParams &params)
template VoronoiOutput fractal_voronoi_x_fx< float > (const VoronoiParams &params, const float coord, const bool calc_color)
template VoronoiOutput fractal_voronoi_x_fx< float2 > (const VoronoiParams &params, const float2 coord, const bool calc_color)
template VoronoiOutput fractal_voronoi_x_fx< float3 > (const VoronoiParams &params, const float3 coord, const bool calc_color)
template VoronoiOutput fractal_voronoi_x_fx< float4 > (const VoronoiParams &params, const float4 coord, const bool calc_color)
template float fractal_voronoi_distance_to_edge< float > (const VoronoiParams &params, const float coord)
template float fractal_voronoi_distance_to_edge< float2 > (const VoronoiParams &params, const float2 coord)
template float fractal_voronoi_distance_to_edge< float3 > (const VoronoiParams &params, const float3 coord)
template float fractal_voronoi_distance_to_edge< float4 > (const VoronoiParams &params, const float4 coord)

Gabor Noise

Implements Gabor noise based on the paper:

Lagae, Ares, et al. "Procedural noise using sparse Gabor convolution." ACM Transactions on Graphics (TOG) 28.3 (2009): 1-10.

But with the improvements from the paper:

Tavernier, Vincent, et al. "Making gabor noise fast and normalized." Eurographics 2019-40th Annual Conference of the European Association for Computer Graphics. 2019.

And compute the Phase and Intensity of the Gabor based on the paper:

Tricard, Thibault, et al. "Procedural phasor noise." ACM Transactions on Graphics (TOG) 38.4 (2019): 1-13.

static constexpr int gabor_impulses_count = 8
void gabor (const float2 coordinates, const float scale, const float frequency, const float anisotropy, const float orientation, float *r_value, float *r_phase, float *r_intensity)
void gabor (const float3 coordinates, const float scale, const float frequency, const float anisotropy, const float3 orientation, float *r_value, float *r_phase, float *r_intensity)
static float2 compute_2d_gabor_kernel (const float2 position, const float frequency, const float orientation)
static float compute_2d_gabor_standard_deviation ()
static float2 compute_2d_gabor_noise_cell (const float2 cell, const float2 position, const float frequency, const float isotropy, const float base_orientation)
static float2 compute_2d_gabor_noise (const float2 coordinates, const float frequency, const float isotropy, const float base_orientation)
static float2 compute_3d_gabor_kernel (const float3 position, const float frequency, const float3 orientation)
static float compute_3d_gabor_standard_deviation ()
static float3 compute_3d_orientation (const float3 orientation, const float isotropy, const float4 seed)
static float2 compute_3d_gabor_noise_cell (const float3 cell, const float3 position, const float frequency, const float isotropy, const float3 base_orientation)
static float2 compute_3d_gabor_noise (const float3 coordinates, const float frequency, const float isotropy, const float3 base_orientation)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NOISE_SHD_VORONOI_EUCLIDEAN 
NOISE_SHD_VORONOI_MANHATTAN 
NOISE_SHD_VORONOI_CHEBYCHEV 
NOISE_SHD_VORONOI_MINKOWSKI 

Definition at line 1149 of file noise.cc.

◆ anonymous enum

anonymous enum
Enumerator
NOISE_SHD_VORONOI_F1 
NOISE_SHD_VORONOI_F2 
NOISE_SHD_VORONOI_SMOOTH_F1 
NOISE_SHD_VORONOI_DISTANCE_TO_EDGE 
NOISE_SHD_VORONOI_N_SPHERE_RADIUS 

Definition at line 1156 of file noise.cc.

◆ anonymous enum

anonymous enum
Enumerator
NOISE_SHD_PERLIN_MULTIFRACTAL 
NOISE_SHD_PERLIN_FBM 
NOISE_SHD_PERLIN_HYBRID_MULTIFRACTAL 
NOISE_SHD_PERLIN_RIDGED_MULTIFRACTAL 
NOISE_SHD_PERLIN_HETERO_TERRAIN 

Definition at line 843 of file noise.cc.

Function Documentation

◆ compute_2d_gabor_kernel()

float2 blender::noise::compute_2d_gabor_kernel ( const float2 position,
const float frequency,
const float orientation )
static

◆ compute_2d_gabor_noise()

float2 blender::noise::compute_2d_gabor_noise ( const float2 coordinates,
const float frequency,
const float isotropy,
const float base_orientation )
static

Definition at line 2362 of file noise.cc.

References compute_2d_gabor_noise_cell(), blender::math::floor(), i, and sum().

Referenced by gabor().

◆ compute_2d_gabor_noise_cell()

float2 blender::noise::compute_2d_gabor_noise_cell ( const float2 cell,
const float2 position,
const float frequency,
const float isotropy,
const float base_orientation )
static

◆ compute_2d_gabor_standard_deviation()

float blender::noise::compute_2d_gabor_standard_deviation ( )
static

Computes the approximate standard deviation of the zero mean normal distribution representing the amplitude distribution of the noise based on Equation (9) in the original Gabor noise paper. For simplicity, the Hann window is ignored and the orientation is fixed since the variance is orientation invariant. We start integrating the squared Gabor kernel with respect to x:

\int_{-\infty}^{-\infty} (e^{- \pi (x^2 + y^2)} cos(2 \pi f_0 x))^2 dx

Which gives:

\frac{(e^{2 \pi f_0^2}-1) e^{-2 \pi y^2 - 2 pi f_0^2}}{2^\frac{3}{2}}

Then we similarly integrate with respect to y to get:

\frac{1 - e^{-2 \pi f_0^2}}{4}

Secondly, we note that the second moment of the weights distribution is 0.5 since it is a fair Bernoulli distribution. So the final standard deviation expression is square root the integral multiplied by the impulse density multiplied by the second moment.

Note however that the integral is almost constant for all frequencies larger than one, and converges to an upper limit as the frequency approaches infinity, so we replace the expression with the following limit:

\lim_{x \to \infty} \frac{1 - e^{-2 \pi f_0^2}}{4}

To get an approximation of 0.25.

Definition at line 2307 of file noise.cc.

References gabor_impulses_count, and blender::math::sqrt().

Referenced by gabor().

◆ compute_3d_gabor_kernel()

float2 blender::noise::compute_3d_gabor_kernel ( const float3 position,
const float frequency,
const float3 orientation )
static

◆ compute_3d_gabor_noise()

float2 blender::noise::compute_3d_gabor_noise ( const float3 coordinates,
const float frequency,
const float isotropy,
const float3 base_orientation )
static

Definition at line 2481 of file noise.cc.

References compute_3d_gabor_noise_cell(), blender::math::floor(), i, and sum().

Referenced by gabor().

◆ compute_3d_gabor_noise_cell()

float2 blender::noise::compute_3d_gabor_noise_cell ( const float3 cell,
const float3 position,
const float frequency,
const float isotropy,
const float3 base_orientation )
static

◆ compute_3d_gabor_standard_deviation()

float blender::noise::compute_3d_gabor_standard_deviation ( )
static

Definition at line 2407 of file noise.cc.

References gabor_impulses_count, blender::math::sqrt(), and blender::math::numbers::sqrt2.

Referenced by gabor().

◆ compute_3d_orientation()

float3 blender::noise::compute_3d_orientation ( const float3 orientation,
const float isotropy,
const float4 seed )
static

◆ fade()

BLI_INLINE float blender::noise::fade ( float t)

Definition at line 462 of file noise.cc.

References BLI_INLINE.

Referenced by perlin_noise(), perlin_noise(), perlin_noise(), and perlin_noise().

◆ float_as_uint()

BLI_INLINE uint32_t blender::noise::float_as_uint ( float f)

Definition at line 142 of file noise.cc.

References BLI_INLINE, and i.

Referenced by hash_float(), hash_float(), hash_float(), and hash_float().

◆ floor_fraction()

BLI_INLINE float blender::noise::floor_fraction ( float x,
int & i )

Definition at line 505 of file noise.cc.

References BLI_INLINE, blender::math::floor(), i, and x.

Referenced by perlin_noise(), perlin_noise(), perlin_noise(), and perlin_noise().

◆ fractal_voronoi_distance_to_edge()

template<typename T>
float blender::noise::fractal_voronoi_distance_to_edge ( const VoronoiParams & params,
const T coord )

Definition at line 2137 of file noise.cc.

References ceilf, distance(), floorf, i, blender::math::min(), mix, params, T, and voronoi_distance_to_edge().

◆ fractal_voronoi_distance_to_edge< float >()

◆ fractal_voronoi_distance_to_edge< float2 >()

◆ fractal_voronoi_distance_to_edge< float3 >()

◆ fractal_voronoi_distance_to_edge< float4 >()

◆ fractal_voronoi_x_fx()

template<typename T>
VoronoiOutput blender::noise::fractal_voronoi_x_fx ( const VoronoiParams & params,
const T coord,
const bool calc_color )

◆ fractal_voronoi_x_fx< float >()

template VoronoiOutput blender::noise::fractal_voronoi_x_fx< float > ( const VoronoiParams & params,
const float coord,
const bool calc_color )

◆ fractal_voronoi_x_fx< float2 >()

template VoronoiOutput blender::noise::fractal_voronoi_x_fx< float2 > ( const VoronoiParams & params,
const float2 coord,
const bool calc_color )

◆ fractal_voronoi_x_fx< float3 >()

template VoronoiOutput blender::noise::fractal_voronoi_x_fx< float3 > ( const VoronoiParams & params,
const float3 coord,
const bool calc_color )

◆ fractal_voronoi_x_fx< float4 >()

template VoronoiOutput blender::noise::fractal_voronoi_x_fx< float4 > ( const VoronoiParams & params,
const float4 coord,
const bool calc_color )

◆ gabor() [1/2]

void blender::noise::gabor ( const float2 coordinates,
const float scale,
const float frequency,
const float anisotropy,
const float orientation,
float * r_value,
float * r_phase,
float * r_intensity )

◆ gabor() [2/2]

void blender::noise::gabor ( const float3 coordinates,
const float scale,
const float frequency,
const float anisotropy,
const float3 orientation,
float * r_value,
float * r_phase,
float * r_intensity )

◆ hash() [1/4]

◆ hash() [2/4]

uint32_t blender::noise::hash ( uint32_t kx,
uint32_t ky )

Definition at line 101 of file noise.cc.

References b, and hash_bit_final().

◆ hash() [3/4]

uint32_t blender::noise::hash ( uint32_t kx,
uint32_t ky,
uint32_t kz )

Definition at line 113 of file noise.cc.

References b, and hash_bit_final().

◆ hash() [4/4]

uint32_t blender::noise::hash ( uint32_t kx,
uint32_t ky,
uint32_t kz,
uint32_t kw )

Definition at line 126 of file noise.cc.

References b, hash_bit_final(), and hash_bit_mix().

◆ hash_bit_final()

BLI_INLINE void blender::noise::hash_bit_final ( uint32_t & a,
uint32_t & b,
uint32_t & c )

Definition at line 72 of file noise.cc.

References b, BLI_INLINE, and hash_bit_rotate().

Referenced by hash(), hash(), hash(), and hash().

◆ hash_bit_mix()

BLI_INLINE void blender::noise::hash_bit_mix ( uint32_t & a,
uint32_t & b,
uint32_t & c )

Definition at line 50 of file noise.cc.

References b, BLI_INLINE, and hash_bit_rotate().

Referenced by hash().

◆ hash_bit_rotate()

BLI_INLINE uint32_t blender::noise::hash_bit_rotate ( uint32_t x,
uint32_t k )

Definition at line 45 of file noise.cc.

References BLI_INLINE, and x.

Referenced by hash_bit_final(), and hash_bit_mix().

◆ hash_float() [1/5]

uint32_t blender::noise::hash_float ( const float4x4 & k)

Definition at line 221 of file noise.cc.

References hash, and hash_float().

◆ hash_float() [2/5]

◆ hash_float() [3/5]

uint32_t blender::noise::hash_float ( float2 k)

Definition at line 206 of file noise.cc.

References float_as_uint(), and hash.

◆ hash_float() [4/5]

uint32_t blender::noise::hash_float ( float3 k)

Definition at line 211 of file noise.cc.

References float_as_uint(), and hash.

◆ hash_float() [5/5]

uint32_t blender::noise::hash_float ( float4 k)

Definition at line 216 of file noise.cc.

References float_as_uint(), and hash.

◆ hash_float_to_float() [1/4]

◆ hash_float_to_float() [2/4]

float blender::noise::hash_float_to_float ( float2 k)

Definition at line 260 of file noise.cc.

References hash_float(), and uint_to_float_01().

◆ hash_float_to_float() [3/4]

float blender::noise::hash_float_to_float ( float3 k)

Definition at line 265 of file noise.cc.

References hash_float(), and uint_to_float_01().

◆ hash_float_to_float() [4/4]

float blender::noise::hash_float_to_float ( float4 k)

Definition at line 270 of file noise.cc.

References hash_float(), and uint_to_float_01().

◆ hash_float_to_float2() [1/3]

float2 blender::noise::hash_float_to_float2 ( float2 k)

Definition at line 275 of file noise.cc.

References hash_float_to_float().

Referenced by compute_2d_gabor_noise_cell(), and compute_3d_orientation().

◆ hash_float_to_float2() [2/3]

float2 blender::noise::hash_float_to_float2 ( float3 k)

Definition at line 280 of file noise.cc.

References hash_float_to_float().

◆ hash_float_to_float2() [3/3]

float2 blender::noise::hash_float_to_float2 ( float4 k)

Definition at line 286 of file noise.cc.

References hash_float_to_float().

◆ hash_float_to_float3() [1/4]

◆ hash_float_to_float3() [2/4]

float3 blender::noise::hash_float_to_float3 ( float2 k)

Definition at line 299 of file noise.cc.

References hash_float_to_float().

◆ hash_float_to_float3() [3/4]

float3 blender::noise::hash_float_to_float3 ( float3 k)

Definition at line 306 of file noise.cc.

References hash_float_to_float().

◆ hash_float_to_float3() [4/4]

float3 blender::noise::hash_float_to_float3 ( float4 k)

Definition at line 313 of file noise.cc.

References hash_float_to_float().

◆ hash_float_to_float4()

float4 blender::noise::hash_float_to_float4 ( float4 k)

Definition at line 320 of file noise.cc.

References hash_float_to_float().

◆ hash_int2_to_float2()

float2 blender::noise::hash_int2_to_float2 ( int2 k)
inlinestatic

◆ hash_int2_to_float3()

float3 blender::noise::hash_int2_to_float3 ( int2 k)
inlinestatic

Definition at line 354 of file noise.cc.

References hash_int3_to_float3().

Referenced by voronoi_f1(), voronoi_f2(), and voronoi_smooth_f1().

◆ hash_int3_to_float3()

float3 blender::noise::hash_int3_to_float3 ( int3 k)
inlinestatic

◆ hash_int4_to_float3()

float3 blender::noise::hash_int4_to_float3 ( int4 k)
inlinestatic

Definition at line 359 of file noise.cc.

References hash_int4_to_float4(), and blender::VecBase< T, Size >::xyz().

Referenced by voronoi_f1(), voronoi_f2(), and voronoi_smooth_f1().

◆ hash_int4_to_float4()

float4 blender::noise::hash_int4_to_float4 ( int4 k)
inlinestatic

◆ hash_pcg2d_i()

ATTR_NO_SIGNED_INT_OVERFLOW int2 blender::noise::hash_pcg2d_i ( int2 v)
inlinestatic

Definition at line 160 of file noise.cc.

References v.

Referenced by hash_int2_to_float2().

◆ hash_pcg3d_i()

ATTR_NO_SIGNED_INT_OVERFLOW int3 blender::noise::hash_pcg3d_i ( int3 v)
inlinestatic

Definition at line 172 of file noise.cc.

References v.

Referenced by hash_int3_to_float3().

◆ hash_pcg4d_i()

ATTR_NO_SIGNED_INT_OVERFLOW int4 blender::noise::hash_pcg4d_i ( int4 v)
inlinestatic

Definition at line 186 of file noise.cc.

References v.

Referenced by hash_int4_to_float4().

◆ hash_to_float() [1/4]

◆ hash_to_float() [2/4]

float blender::noise::hash_to_float ( uint32_t kx,
uint32_t ky )

Definition at line 238 of file noise.cc.

References hash, and uint_to_float_01().

◆ hash_to_float() [3/4]

float blender::noise::hash_to_float ( uint32_t kx,
uint32_t ky,
uint32_t kz )

Definition at line 243 of file noise.cc.

References hash, and uint_to_float_01().

◆ hash_to_float() [4/4]

float blender::noise::hash_to_float ( uint32_t kx,
uint32_t ky,
uint32_t kz,
uint32_t kw )

Definition at line 248 of file noise.cc.

References hash, and uint_to_float_01().

◆ int_to_float_01()

float blender::noise::int_to_float_01 ( int32_t k)
inlinestatic

Definition at line 330 of file noise.cc.

References float.

Referenced by hash_int2_to_float2(), hash_int3_to_float3(), and hash_int4_to_float4().

◆ mix() [1/4]

BLI_INLINE float blender::noise::mix ( float v0,
float v1,
float v2,
float v3,
float v4,
float v5,
float v6,
float v7,
float v8,
float v9,
float v10,
float v11,
float v12,
float v13,
float v14,
float v15,
float x,
float y,
float z,
float w )

Definition at line 436 of file noise.cc.

References BLI_INLINE, mix, v2, w(), x, y, and z().

◆ mix() [2/4]

BLI_INLINE float blender::noise::mix ( float v0,
float v1,
float v2,
float v3,
float v4,
float v5,
float v6,
float v7,
float x,
float y,
float z )

Definition at line 416 of file noise.cc.

References BLI_INLINE, v2, x, y, and z().

◆ mix() [3/4]

BLI_INLINE float blender::noise::mix ( float v0,
float v1,
float v2,
float v3,
float x,
float y )

Definition at line 392 of file noise.cc.

References BLI_INLINE, v2, x, and y.

◆ mix() [4/4]

template<typename T>
T blender::noise::mix ( T v0,
T v1,
float x )
static

Definition at line 377 of file noise.cc.

References T, and x.

Referenced by fractal_voronoi_x_fx().

◆ negate_if()

BLI_INLINE float blender::noise::negate_if ( float value,
uint32_t condition )

Definition at line 467 of file noise.cc.

References BLI_INLINE.

Referenced by noise_grad(), noise_grad(), noise_grad(), and noise_grad().

◆ noise_grad() [1/4]

BLI_INLINE float blender::noise::noise_grad ( uint32_t hash,
float x )

Definition at line 472 of file noise.cc.

References BLI_INLINE, hash(), negate_if(), and x.

Referenced by perlin_noise(), perlin_noise(), perlin_noise(), and perlin_noise().

◆ noise_grad() [2/4]

BLI_INLINE float blender::noise::noise_grad ( uint32_t hash,
float x,
float y )

Definition at line 479 of file noise.cc.

References BLI_INLINE, hash(), negate_if(), v, x, and y.

◆ noise_grad() [3/4]

BLI_INLINE float blender::noise::noise_grad ( uint32_t hash,
float x,
float y,
float z )

Definition at line 487 of file noise.cc.

References BLI_INLINE, ELEM, hash(), negate_if(), v, x, y, and z().

◆ noise_grad() [4/4]

BLI_INLINE float blender::noise::noise_grad ( uint32_t hash,
float x,
float y,
float z,
float w )

Definition at line 496 of file noise.cc.

References BLI_INLINE, hash(), negate_if(), v, w(), x, y, and z().

◆ perlin() [1/4]

float blender::noise::perlin ( float position)

Definition at line 665 of file noise.cc.

References perlin_signed().

Referenced by BKE_paint_randomize_color().

◆ perlin() [2/4]

float blender::noise::perlin ( float2 position)

Definition at line 670 of file noise.cc.

References perlin_signed().

◆ perlin() [3/4]

float blender::noise::perlin ( float3 position)

Definition at line 675 of file noise.cc.

References perlin_signed().

◆ perlin() [4/4]

float blender::noise::perlin ( float4 position)

Definition at line 680 of file noise.cc.

References perlin_signed().

◆ perlin_distortion() [1/4]

◆ perlin_distortion() [2/4]

BLI_INLINE float2 blender::noise::perlin_distortion ( float2 position,
float strength )

Definition at line 923 of file noise.cc.

References BLI_INLINE, perlin_signed(), and random_float2_offset().

◆ perlin_distortion() [3/4]

BLI_INLINE float3 blender::noise::perlin_distortion ( float3 position,
float strength )

Definition at line 929 of file noise.cc.

References BLI_INLINE, perlin_signed(), and random_float3_offset().

◆ perlin_distortion() [4/4]

BLI_INLINE float4 blender::noise::perlin_distortion ( float4 position,
float strength )

Definition at line 936 of file noise.cc.

References BLI_INLINE, perlin_signed(), and random_float4_offset().

◆ perlin_fbm()

template<typename T>
float blender::noise::perlin_fbm ( T p,
float detail,
float roughness,
float lacunarity,
bool normalize )

Definition at line 696 of file noise.cc.

References i, mix, normalize, perlin_signed(), sum(), and T.

Referenced by fcm_noise_evaluate(), and perlin_select().

◆ perlin_fbm< float2 >()

template float blender::noise::perlin_fbm< float2 > ( float2 p,
const float detail,
const float roughness,
const float lacunarity,
const bool normalize )

References normalize.

◆ perlin_fbm< float3 >()

template float blender::noise::perlin_fbm< float3 > ( float3 p,
const float detail,
const float roughness,
const float lacunarity,
const bool normalize )

◆ perlin_float3_fractal_distorted() [1/4]

float3 blender::noise::perlin_float3_fractal_distorted ( float position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

◆ perlin_float3_fractal_distorted() [2/4]

float3 blender::noise::perlin_float3_fractal_distorted ( float2 position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

Definition at line 1032 of file noise.cc.

References normalize, perlin_distortion(), perlin_select(), and random_float2_offset().

◆ perlin_float3_fractal_distorted() [3/4]

float3 blender::noise::perlin_float3_fractal_distorted ( float3 position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

Definition at line 1063 of file noise.cc.

References normalize, perlin_distortion(), perlin_select(), and random_float3_offset().

◆ perlin_float3_fractal_distorted() [4/4]

float3 blender::noise::perlin_float3_fractal_distorted ( float4 position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

Definition at line 1094 of file noise.cc.

References normalize, perlin_distortion(), perlin_select(), and random_float4_offset().

◆ perlin_fractal_distorted()

template<typename T>
float blender::noise::perlin_fractal_distorted ( T position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

◆ perlin_fractal_distorted< float >()

template float blender::noise::perlin_fractal_distorted< float > ( float position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

References normalize.

◆ perlin_fractal_distorted< float2 >()

template float blender::noise::perlin_fractal_distorted< float2 > ( float2 position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

References normalize.

◆ perlin_fractal_distorted< float3 >()

template float blender::noise::perlin_fractal_distorted< float3 > ( float3 position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

References normalize.

◆ perlin_fractal_distorted< float4 >()

template float blender::noise::perlin_fractal_distorted< float4 > ( float4 position,
float detail,
float roughness,
float lacunarity,
float offset,
float gain,
float distortion,
int type,
bool normalize )

References normalize.

◆ perlin_hetero_terrain()

template<typename T>
float blender::noise::perlin_hetero_terrain ( T p,
const float detail,
const float roughness,
const float lacunarity,
const float offset )

Definition at line 758 of file noise.cc.

References floorf, i, perlin_signed(), and T.

Referenced by perlin_select().

◆ perlin_hybrid_multi_fractal()

template<typename T>
float blender::noise::perlin_hybrid_multi_fractal ( T p,
const float detail,
const float roughness,
const float lacunarity,
const float offset,
const float gain )

Definition at line 784 of file noise.cc.

References floorf, i, perlin_signed(), and T.

Referenced by perlin_select().

◆ perlin_multi_fractal()

template<typename T>
float blender::noise::perlin_multi_fractal ( T p,
const float detail,
const float roughness,
const float lacunarity )

Definition at line 738 of file noise.cc.

References floorf, i, perlin_signed(), and T.

Referenced by perlin_select().

◆ perlin_noise() [1/4]

BLI_INLINE float blender::noise::perlin_noise ( float position)

Definition at line 512 of file noise.cc.

References BLI_INLINE, fade(), floor_fraction(), hash, mix, noise_grad(), and X.

Referenced by perlin_signed(), perlin_signed(), perlin_signed(), and perlin_signed().

◆ perlin_noise() [2/4]

BLI_INLINE float blender::noise::perlin_noise ( float2 position)

Definition at line 525 of file noise.cc.

References BLI_INLINE, fade(), floor_fraction(), hash, mix, noise_grad(), v, X, and Y.

◆ perlin_noise() [3/4]

BLI_INLINE float blender::noise::perlin_noise ( float3 position)

Definition at line 545 of file noise.cc.

References BLI_INLINE, fade(), floor_fraction(), hash, mix, noise_grad(), v, w(), X, Y, and Z.

◆ perlin_noise() [4/4]

BLI_INLINE float blender::noise::perlin_noise ( float4 position)

Definition at line 572 of file noise.cc.

References BLI_INLINE, fade(), floor_fraction(), hash, mix, noise_grad(), v, W, X, Y, and Z.

◆ perlin_ridged_multi_fractal()

template<typename T>
float blender::noise::perlin_ridged_multi_fractal ( T p,
const float detail,
const float roughness,
const float lacunarity,
const float offset,
const float gain )

Definition at line 816 of file noise.cc.

References i, perlin_signed(), and T.

Referenced by perlin_select().

◆ perlin_select()

◆ perlin_signed() [1/4]

◆ perlin_signed() [2/4]

float blender::noise::perlin_signed ( float2 position)

Definition at line 624 of file noise.cc.

References blender::math::abs(), blender::math::mod(), and perlin_noise().

◆ perlin_signed() [3/4]

float blender::noise::perlin_signed ( float3 position)

Definition at line 636 of file noise.cc.

References blender::math::abs(), blender::math::mod(), and perlin_noise().

◆ perlin_signed() [4/4]

float blender::noise::perlin_signed ( float4 position)

Definition at line 649 of file noise.cc.

References blender::math::abs(), blender::math::mod(), and perlin_noise().

◆ random_float2_offset()

BLI_INLINE float2 blender::noise::random_float2_offset ( float seed)

Definition at line 895 of file noise.cc.

References BLI_INLINE, hash_float_to_float(), and seed.

Referenced by perlin_distortion(), and perlin_float3_fractal_distorted().

◆ random_float3_offset()

BLI_INLINE float3 blender::noise::random_float3_offset ( float seed)

Definition at line 901 of file noise.cc.

References BLI_INLINE, hash_float_to_float(), and seed.

Referenced by perlin_distortion(), and perlin_float3_fractal_distorted().

◆ random_float4_offset()

BLI_INLINE float4 blender::noise::random_float4_offset ( float seed)

Definition at line 908 of file noise.cc.

References BLI_INLINE, hash_float_to_float(), and seed.

Referenced by perlin_distortion(), and perlin_float3_fractal_distorted().

◆ random_float_offset()

BLI_INLINE float blender::noise::random_float_offset ( float seed)

Definition at line 890 of file noise.cc.

References BLI_INLINE, hash_float_to_float(), and seed.

Referenced by perlin_distortion(), and perlin_float3_fractal_distorted().

◆ uint_to_float_01()

BLI_INLINE float blender::noise::uint_to_float_01 ( uint32_t k)

◆ voronoi_distance() [1/4]

◆ voronoi_distance() [2/4]

float blender::noise::voronoi_distance ( const float2 a,
const float2 b,
const VoronoiParams & params )

◆ voronoi_distance() [3/4]

float blender::noise::voronoi_distance ( const float3 a,
const float3 b,
const VoronoiParams & params )

◆ voronoi_distance() [4/4]

float blender::noise::voronoi_distance ( const float4 a,
const float4 b,
const VoronoiParams & params )

◆ voronoi_distance_bound()

template<typename T>
float blender::noise::voronoi_distance_bound ( const T a,
const T b,
const VoronoiParams & params )
static

◆ voronoi_distance_to_edge() [1/4]

float blender::noise::voronoi_distance_to_edge ( const VoronoiParams & params,
const float coord )

Definition at line 1356 of file noise.cc.

References fabsf, floorf, hash_float_to_float(), blender::math::min(), and params.

Referenced by fractal_voronoi_distance_to_edge().

◆ voronoi_distance_to_edge() [2/4]

float blender::noise::voronoi_distance_to_edge ( const VoronoiParams & params,
const float2 coord )

◆ voronoi_distance_to_edge() [3/4]

float blender::noise::voronoi_distance_to_edge ( const VoronoiParams & params,
const float3 coord )

◆ voronoi_distance_to_edge() [4/4]

float blender::noise::voronoi_distance_to_edge ( const VoronoiParams & params,
const float4 coord )

◆ voronoi_f1() [1/4]

◆ voronoi_f1() [2/4]

◆ voronoi_f1() [3/4]

◆ voronoi_f1() [4/4]

◆ voronoi_f2() [1/4]

◆ voronoi_f2() [2/4]

◆ voronoi_f2() [3/4]

◆ voronoi_f2() [4/4]

◆ voronoi_n_sphere_radius() [1/4]

float blender::noise::voronoi_n_sphere_radius ( const VoronoiParams & params,
const float coord )

◆ voronoi_n_sphere_radius() [2/4]

float blender::noise::voronoi_n_sphere_radius ( const VoronoiParams & params,
const float2 coord )

◆ voronoi_n_sphere_radius() [3/4]

float blender::noise::voronoi_n_sphere_radius ( const VoronoiParams & params,
const float3 coord )

◆ voronoi_n_sphere_radius() [4/4]

float blender::noise::voronoi_n_sphere_radius ( const VoronoiParams & params,
const float4 coord )

◆ voronoi_position() [1/4]

◆ voronoi_position() [2/4]

float4 blender::noise::voronoi_position ( const float2 coord)

Definition at line 1411 of file noise.cc.

◆ voronoi_position() [3/4]

float4 blender::noise::voronoi_position ( const float3 coord)

Definition at line 1616 of file noise.cc.

◆ voronoi_position() [4/4]

float4 blender::noise::voronoi_position ( const float4 coord)

Definition at line 1835 of file noise.cc.

◆ voronoi_smooth_f1() [1/4]

◆ voronoi_smooth_f1() [2/4]

◆ voronoi_smooth_f1() [3/4]

◆ voronoi_smooth_f1() [4/4]

Variable Documentation

◆ gabor_impulses_count

int blender::noise::gabor_impulses_count = 8
staticconstexpr