31#define IMPULSES_COUNT 8
60 float distance_squared =
dot(position, position);
61 float hann_window = 0.5f + 0.5f *
cosf(
M_PI_F * distance_squared);
62 float gaussian_envelop =
expf(-
M_PI_F * distance_squared);
63 float windowed_gaussian_envelope = gaussian_envelop * hann_window;
66 float angle = 2.0f *
M_PI_F *
dot(position, frequency_vector);
69 return windowed_gaussian_envelope * phasor;
100 float integral_of_gabor_squared = 0.25f;
101 float second_moment = 0.5f;
112 float2 cell,
float2 position,
float frequency,
float isotropy,
float base_orientation)
127 float orientation = base_orientation + random_orientation * isotropy;
130 float2 position_in_kernel_space = position - kernel_center;
134 if (
dot(position_in_kernel_space, position_in_kernel_space) >= 1.0f) {
152 float base_orientation)
155 float2 local_position = coordinates - cell_position;
158 for (
int j = -1; j <= 1; j++) {
159 for (
int i = -1; i <= 1; i++) {
161 float2 current_cell_position = cell_position + cell_offset;
162 float2 position_in_cell_space = local_position - cell_offset;
164 current_cell_position, position_in_cell_space, frequency, isotropy, base_orientation);
177 float distance_squared =
dot(position, position);
178 float hann_window = 0.5f + 0.5f *
cosf(
M_PI_F * distance_squared);
179 float gaussian_envelop =
expf(-
M_PI_F * distance_squared);
180 float windowed_gaussian_envelope = gaussian_envelop * hann_window;
182 float3 frequency_vector = frequency * orientation;
183 float angle = 2.0f *
M_PI_F *
dot(position, frequency_vector);
186 return windowed_gaussian_envelope * phasor;
194 float integral_of_gabor_squared = 1.0f / (4.0f * M_SQRT2_F);
195 float second_moment = 0.5f;
205 if (isotropy == 0.0f) {
210 float inclination = acos(orientation.
z);
211 float azimuth = (orientation.
y < 0.0f ? -1.0f : 1.0f) *
219 inclination += random_angles.
x * isotropy;
220 azimuth += random_angles.
y * isotropy;
228 float3 cell,
float3 position,
float frequency,
float isotropy,
float3 base_orientation)
234 float4 seed_for_orientation =
make_float4(cell.
x, cell.
y, cell.
z, i * 3);
235 float4 seed_for_kernel_center =
make_float4(cell.
x, cell.
y, cell.
z, i * 3 + 1);
236 float4 seed_for_weight =
make_float4(cell.
x, cell.
y, cell.
z, i * 3 + 2);
241 float3 position_in_kernel_space = position - kernel_center;
245 if (
dot(position_in_kernel_space, position_in_kernel_space) >= 1.0f) {
265 float3 local_position = coordinates - cell_position;
268 for (
int k = -1; k <= 1; k++) {
269 for (
int j = -1; j <= 1; j++) {
270 for (
int i = -1; i <= 1; i++) {
272 float3 current_cell_position = cell_position + cell_offset;
273 float3 position_in_cell_space = local_position - cell_offset;
275 current_cell_position, position_in_cell_space, frequency, isotropy, base_orientation);
287 uint stack_offsets_1,
288 uint stack_offsets_2,
291 uint coordinates_stack_offset;
292 uint scale_stack_offset;
293 uint frequency_stack_offset;
294 uint anisotropy_stack_offset;
295 uint orientation_2d_stack_offset;
296 uint orientation_3d_stack_offset;
299 &coordinates_stack_offset,
301 &frequency_stack_offset,
302 &anisotropy_stack_offset);
304 stack_offsets_2, &orientation_2d_stack_offset, &orientation_3d_stack_offset);
308 uint value_stack_offset;
309 uint phase_stack_offset;
310 uint intensity_stack_offset;
314 node_1.
x, &value_stack_offset, &phase_stack_offset, &intensity_stack_offset);
323 float3 scaled_coordinates = coordinates * scale;
324 float isotropy = 1.0f -
clamp(anisotropy, 0.0f, 1.0f);
325 frequency =
max(0.001f, frequency);
328 float standard_deviation = 1.0f;
348 float normalization_factor = 6.0f * standard_deviation;
353 stack_store_float(stack, value_stack_offset, (phasor.
y / normalization_factor) * 0.5f + 0.5f);
359 float phase = (atan2(phasor.
y, phasor.
x) +
M_PI_F) / (2.0f *
M_PI_F);
static T sum(const btAlignedObjectArray< T > &items)
static unsigned long seed
SIMD_FORCE_INLINE btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
additional_info("compositor_sum_squared_difference_float_shared") .push_constant(Type output_img float dot(value.rgb, luminance_coefficients)") .define("LOAD(value)"
const KernelGlobalsCPU *ccl_restrict KernelGlobals
#define ccl_device_noinline
#define CCL_NAMESPACE_END
ccl_device float2 compute_2d_gabor_noise(float2 coordinates, float frequency, float isotropy, float base_orientation)
ccl_device float compute_3d_gabor_standard_deviation()
ccl_device float2 compute_3d_gabor_noise_cell(float3 cell, float3 position, float frequency, float isotropy, float3 base_orientation)
ccl_device float2 compute_2d_gabor_kernel(float2 position, float frequency, float orientation)
ccl_device float3 compute_3d_orientation(float3 orientation, float isotropy, float4 seed)
ccl_device float compute_2d_gabor_standard_deviation()
ccl_device float2 compute_2d_gabor_noise_cell(float2 cell, float2 position, float frequency, float isotropy, float base_orientation)
ccl_device float2 compute_3d_gabor_kernel(float3 position, float frequency, float3 orientation)
ccl_device_noinline int svm_node_tex_gabor(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, uint type, uint stack_offsets_1, uint stack_offsets_2, int offset)
ccl_device float2 compute_3d_gabor_noise(float3 coordinates, float frequency, float isotropy, float3 base_orientation)
ccl_device_inline float3 hash_float4_to_float3(float4 k)
ccl_device_inline float hash_float4_to_float(float4 k)
ccl_device_inline float2 hash_float3_to_float2(float3 k)
ccl_device_inline float hash_float3_to_float(float3 k)
ccl_device_inline float2 hash_float4_to_float2(float4 k)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 stack_load_float3(ccl_private float *stack, uint a)
ccl_device_inline uint4 read_node(KernelGlobals kg, ccl_private int *offset)
ccl_device_forceinline void svm_unpack_node_uchar3(uint i, ccl_private uint *x, ccl_private uint *y, ccl_private uint *z)
ccl_device_forceinline void svm_unpack_node_uchar2(uint i, ccl_private uint *x, ccl_private uint *y)
ccl_device_inline float stack_load_float_default(ccl_private float *stack, uint a, uint value)
ccl_device_inline void stack_store_float(ccl_private float *stack, uint a, float f)
ccl_device_forceinline void svm_unpack_node_uchar4(uint i, ccl_private uint *x, ccl_private uint *y, ccl_private uint *z, ccl_private uint *w)
ccl_device_inline bool stack_valid(uint a)
ccl_device_inline float2 floor(const float2 a)
ccl_device_inline int clamp(int a, int mn, int mx)