Nodes: Improve isotropic Gabor noise UI controls

This patch improves the isotropic Gabor noise UI controls such that
variations happen in both directions of the base orientation, as opposed
to being biased in the positive direction only.

Thanks to Charlie Jolly for suggesting this improvement.
This commit is contained in:
Omar Emara
2024-08-14 15:26:03 +03:00
parent ce89d7949c
commit 075bdbcd63
4 changed files with 8 additions and 8 deletions

View File

@@ -124,9 +124,9 @@ vector2 compute_2d_gabor_noise_cell(
/* For isotropic noise, add a random orientation amount, while for anisotropic noise, use the
* base orientation. Linearly interpolate between the two cases using the isotropy factor. Note
* that the random orientation range is to pi as opposed to two pi, that's because the Gabor
* that the random orientation range spans pi as opposed to two pi, that's because the Gabor
* kernel is symmetric around pi. */
float random_orientation = hash_vector3_to_float(seed_for_orientation) * M_PI;
float random_orientation = (hash_vector3_to_float(seed_for_orientation) - 0.5) * M_PI;
float orientation = base_orientation + random_orientation * isotropy;
vector2 kernel_center = hash_vector3_to_vector2(seed_for_kernel_center);

View File

@@ -121,9 +121,9 @@ ccl_device float2 compute_2d_gabor_noise_cell(
/* For isotropic noise, add a random orientation amount, while for anisotropic noise, use the
* base orientation. Linearly interpolate between the two cases using the isotropy factor. Note
* that the random orientation range is to pi as opposed to two pi, that's because the Gabor
* that the random orientation range spans pi as opposed to two pi, that's because the Gabor
* kernel is symmetric around pi. */
float random_orientation = hash_float3_to_float(seed_for_orientation) * M_PI_F;
float random_orientation = (hash_float3_to_float(seed_for_orientation) - 0.5f) * M_PI_F;
float orientation = base_orientation + random_orientation * isotropy;
float2 kernel_center = hash_float3_to_float2(seed_for_kernel_center);

View File

@@ -2175,9 +2175,9 @@ static float2 compute_2d_gabor_noise_cell(const float2 cell,
/* For isotropic noise, add a random orientation amount, while for anisotropic noise, use the
* base orientation. Linearly interpolate between the two cases using the isotropy factor. Note
* that the random orientation range is to pi as opposed to two pi, that's because the Gabor
* that the random orientation range spans pi as opposed to two pi, that's because the Gabor
* kernel is symmetric around pi. */
const float random_orientation = noise::hash_float_to_float(seed_for_orientation) *
const float random_orientation = (noise::hash_float_to_float(seed_for_orientation) - 0.5f) *
math::numbers::pi;
const float orientation = base_orientation + random_orientation * isotropy;

View File

@@ -124,9 +124,9 @@ vec2 compute_2d_gabor_noise_cell(
/* For isotropic noise, add a random orientation amount, while for anisotropic noise, use the
* base orientation. Linearly interpolate between the two cases using the isotropy factor. Note
* that the random orientation range is to pi as opposed to two pi, that's because the Gabor
* that the random orientation range spans pi as opposed to two pi, that's because the Gabor
* kernel is symmetric around pi. */
float random_orientation = hash_vec3_to_float(seed_for_orientation) * M_PI;
float random_orientation = (hash_vec3_to_float(seed_for_orientation) - 0.5) * M_PI;
float orientation = base_orientation + random_orientation * isotropy;
vec2 kernel_center = hash_vec3_to_vec2(seed_for_kernel_center);