Blender V5.0
gabor.h File Reference
#include "kernel/svm/util.h"
#include "util/hash.h"

Go to the source code of this file.

Macros

#define IMPULSES_COUNT   8

Functions

ccl_device float2 compute_2d_gabor_kernel (const float2 position, const float frequency, const float orientation)
ccl_device float compute_2d_gabor_standard_deviation ()
ccl_device float2 compute_2d_gabor_noise_cell (float2 cell, const float2 position, const float frequency, const float isotropy, const float base_orientation)
ccl_device float2 compute_2d_gabor_noise (const float2 coordinates, const float frequency, const float isotropy, const float base_orientation)
ccl_device float2 compute_3d_gabor_kernel (const float3 position, const float frequency, const float3 orientation)
ccl_device float compute_3d_gabor_standard_deviation ()
ccl_device float3 compute_3d_orientation (const float3 orientation, const float isotropy, const float4 seed)
ccl_device float2 compute_3d_gabor_noise_cell (float3 cell, const float3 position, const float frequency, const float isotropy, const float3 base_orientation)
ccl_device float2 compute_3d_gabor_noise (const float3 coordinates, const float frequency, const float isotropy, const float3 base_orientation)
ccl_device_noinline int svm_node_tex_gabor (KernelGlobals kg, ccl_private float *stack, const uint type, const uint stack_offsets_1, const uint stack_offsets_2, int offset)

Macro Definition Documentation

◆ IMPULSES_COUNT

Function Documentation

◆ compute_2d_gabor_kernel()

ccl_device float2 compute_2d_gabor_kernel ( const float2 position,
const float frequency,
const float orientation )

Definition at line 62 of file gabor.h.

References angle(), ccl_device, cosf, dot(), expf, M_PI_F, and polar_to_cartesian().

Referenced by compute_2d_gabor_noise_cell().

◆ compute_2d_gabor_noise()

ccl_device float2 compute_2d_gabor_noise ( const float2 coordinates,
const float frequency,
const float isotropy,
const float base_orientation )

Definition at line 165 of file gabor.h.

References ccl_device, compute_2d_gabor_noise_cell(), floor, i, make_float2, and sum().

Referenced by svm_node_tex_gabor().

◆ compute_2d_gabor_noise_cell()

ccl_device float2 compute_2d_gabor_noise_cell ( float2 cell,
const float2 position,
const float frequency,
const float isotropy,
const float base_orientation )

◆ compute_2d_gabor_standard_deviation()

ccl_device float compute_2d_gabor_standard_deviation ( )

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 111 of file gabor.h.

References ccl_device, IMPULSES_COUNT, and sqrtf.

Referenced by svm_node_tex_gabor().

◆ compute_3d_gabor_kernel()

ccl_device float2 compute_3d_gabor_kernel ( const float3 position,
const float frequency,
const float3 orientation )

Definition at line 191 of file gabor.h.

References angle(), ccl_device, cosf, dot(), expf, M_PI_F, and polar_to_cartesian().

Referenced by compute_3d_gabor_noise_cell().

◆ compute_3d_gabor_noise()

ccl_device float2 compute_3d_gabor_noise ( const float3 coordinates,
const float frequency,
const float isotropy,
const float3 base_orientation )

Definition at line 280 of file gabor.h.

References ccl_device, compute_3d_gabor_noise_cell(), floor, i, make_float2, make_float3(), and sum().

Referenced by svm_node_tex_gabor().

◆ compute_3d_gabor_noise_cell()

ccl_device float2 compute_3d_gabor_noise_cell ( float3 cell,
const float3 position,
const float frequency,
const float isotropy,
const float3 base_orientation )

◆ compute_3d_gabor_standard_deviation()

ccl_device float compute_3d_gabor_standard_deviation ( )

Definition at line 208 of file gabor.h.

References ccl_device, IMPULSES_COUNT, M_SQRT2_F, and sqrtf.

Referenced by svm_node_tex_gabor().

◆ compute_3d_orientation()

ccl_device float3 compute_3d_orientation ( const float3 orientation,
const float isotropy,
const float4 seed )

◆ svm_node_tex_gabor()