27#define SHD_GABOR_TYPE_2D 0.0f
28#define SHD_GABOR_TYPE_3D 1.0f
36#define IMPULSES_COUNT 8
68 float windowed_gaussian_envelope = gaussian_envelop * hann_window;
74 return windowed_gaussian_envelope * phasor;
105 float integral_of_gabor_squared = 0.25f;
106 float second_moment = 0.5f;
124 float3 seed_for_kernel_center =
float3(cell, i * 3 + 1);
132 float orientation = base_orientation + random_orientation * isotropy;
157 float base_orientation)
160 float2 local_position = coordinates - cell_position;
163 for (
int j = -1; j <= 1; j++) {
164 for (
int i = -1; i <= 1; i++) {
167 float2 current_cell_position = cell_position + cell_offset;
168 float2 position_in_cell_space = local_position - cell_offset;
171 current_cell_position, position_in_cell_space,
frequency, isotropy, base_orientation);
187 float windowed_gaussian_envelope = gaussian_envelop * hann_window;
193 return windowed_gaussian_envelope * phasor;
201 float integral_of_gabor_squared = 1.0f / (4.0f *
M_SQRT2);
202 float second_moment = 0.5f;
212 if (isotropy == 0.0f) {
217 float inclination =
acos(orientation.
z);
218 float azimuth =
sign(orientation.
y) *
acos(orientation.
x /
length(orientation.xy));
225 inclination += random_angles.
x * isotropy;
226 azimuth += random_angles.
y * isotropy;
230 sin(inclination) *
cos(azimuth),
sin(inclination) *
sin(azimuth),
cos(inclination));
241 float4 seed_for_kernel_center =
float4(cell, i * 3 + 1);
271 float3 local_position = coordinates - cell_position;
274 for (
int k = -1; k <= 1; k++) {
275 for (
int j = -1; j <= 1; j++) {
276 for (
int i = -1; i <= 1; i++) {
278 float3 current_cell_position = cell_position + cell_offset;
279 float3 position_in_cell_space = local_position - cell_offset;
281 current_cell_position, position_in_cell_space,
frequency, isotropy, base_orientation);
294 float orientation_2d,
299 float &output_intensity)
302 float isotropy = 1.0f -
clamp(anisotropy, 0.0f, 1.0f);
306 float standard_deviation = 1.0f;
319 float normalization_factor = 6.0f * standard_deviation;
323 output_value = (phasor.
y / normalization_factor) * 0.5f + 0.5f;
330 output_intensity =
length(phasor) / normalization_factor;
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
float3 hash_vec4_to_vec3(float4 k)
float hash_vec4_to_float(float4 k)
float2 hash_vec3_to_vec2(float3 k)
float hash_vec3_to_float(float3 k)
float2 hash_vec4_to_vec2(float4 k)
VecBase< float, D > normalize(VecOp< float, D >) RET
float dot(VecOp< float, D >, VecOp< float, D >) RET
constexpr T clamp(T, U, U) RET
float length(VecOp< float, D >) RET
float compute_3d_gabor_standard_deviation()
float compute_2d_gabor_standard_deviation()
float2 compute_3d_gabor_kernel(float3 position, float frequency, float3 orientation)
#define SHD_GABOR_TYPE_3D
#define SHD_GABOR_TYPE_2D
float2 compute_2d_gabor_noise_cell(float2 cell, float2 position, float frequency, float isotropy, float base_orientation)
float2 compute_2d_gabor_noise(float2 coordinates, float frequency, float isotropy, float base_orientation)
float2 compute_3d_gabor_noise(float3 coordinates, float frequency, float isotropy, float3 base_orientation)
float2 compute_3d_gabor_noise_cell(float3 cell, float3 position, float frequency, float isotropy, float3 base_orientation)
float2 compute_2d_gabor_kernel(float2 position, float frequency, float orientation)
float3 compute_3d_orientation(float3 orientation, float isotropy, float4 seed)
void node_tex_gabor(float3 coordinates, float scale, float frequency, float anisotropy, float orientation_2d, float3 orientation_3d, float type, float &output_value, float &output_phase, float &output_intensity)
float3x3 scale(float3x3 mat, float2 scale)
float distance_squared(VecT a, VecT b)
float length_squared(VecT a)