diff --git a/intern/cycles/kernel/osl/shaders/node_fractal_voronoi.h b/intern/cycles/kernel/osl/shaders/node_fractal_voronoi.h index 3e539f9deb9..934e9cd22e6 100644 --- a/intern/cycles/kernel/osl/shaders/node_fractal_voronoi.h +++ b/intern/cycles/kernel/osl/shaders/node_fractal_voronoi.h @@ -9,6 +9,8 @@ #define vector3 point +/* The fractalization logic is the same as for fBM Noise, except that some additions are replaced + * by lerps. */ #define FRACTAL_VORONOI_X_FX(T) \ VoronoiOutput fractal_voronoi_x_fx(VoronoiParams params, T coord) \ { \ @@ -20,7 +22,7 @@ Output.Distance = 0.0; \ Output.Color = color(0.0, 0.0, 0.0); \ Output.Position = vector4(0.0, 0.0, 0.0, 0.0); \ - int zero_input = params.detail == 0.0 || params.roughness == 0.0 || params.lacunarity == 0.0; \ + int zero_input = params.detail == 0.0 || params.roughness == 0.0; \ \ for (int i = 0; i <= ceil(params.detail); ++i) { \ VoronoiOutput octave; \ @@ -71,6 +73,8 @@ return Output; \ } +/* The fractalization logic is the same as for fBM Noise, except that some additions are replaced + * by lerps. */ #define FRACTAL_VORONOI_DISTANCE_TO_EDGE_FUNCTION(T) \ float fractal_voronoi_distance_to_edge(VoronoiParams params, T coord) \ { \ @@ -79,7 +83,7 @@ float scale = 1.0; \ float distance = 8.0; \ \ - int zero_input = params.detail == 0.0 || params.roughness == 0.0 || params.lacunarity == 0.0; \ + int zero_input = params.detail == 0.0 || params.roughness == 0.0; \ \ for (int i = 0; i <= ceil(params.detail); ++i) { \ float octave_distance = voronoi_distance_to_edge(params, coord * scale); \ diff --git a/intern/cycles/kernel/svm/voronoi.h b/intern/cycles/kernel/svm/voronoi.h index 3fdb608995e..cbbbc249e0c 100644 --- a/intern/cycles/kernel/svm/voronoi.h +++ b/intern/cycles/kernel/svm/voronoi.h @@ -880,6 +880,8 @@ ccl_device float voronoi_n_sphere_radius(ccl_private const VoronoiParams ¶ms /* **** Fractal Voronoi **** */ +/* The fractalization logic is the same as for fBM Noise, except that some additions are replaced + * by lerps. */ template ccl_device VoronoiOutput fractal_voronoi_x_fx(ccl_private const VoronoiParams ¶ms, const T coord) @@ -889,8 +891,7 @@ ccl_device VoronoiOutput fractal_voronoi_x_fx(ccl_private const VoronoiParams &p float scale = 1.0f; VoronoiOutput output; - const bool zero_input = params.detail == 0.0f || params.roughness == 0.0f || - params.lacunarity == 0.0f; + const bool zero_input = params.detail == 0.0f || params.roughness == 0.0f; for (int i = 0; i <= ceilf(params.detail); ++i) { VoronoiOutput octave = (params.feature == NODE_VORONOI_F2) ? @@ -936,6 +937,8 @@ ccl_device VoronoiOutput fractal_voronoi_x_fx(ccl_private const VoronoiParams &p return output; } +/* The fractalization logic is the same as for fBM Noise, except that some additions are replaced + * by lerps. */ template ccl_device float fractal_voronoi_distance_to_edge(ccl_private const VoronoiParams ¶ms, const T coord) @@ -945,8 +948,7 @@ ccl_device float fractal_voronoi_distance_to_edge(ccl_private const VoronoiParam float scale = 1.0f; float distance = 8.0f; - const bool zero_input = params.detail == 0.0f || params.roughness == 0.0f || - params.lacunarity == 0.0f; + const bool zero_input = params.detail == 0.0f || params.roughness == 0.0f; for (int i = 0; i <= ceilf(params.detail); ++i) { const float octave_distance = voronoi_distance_to_edge(params, coord * scale); diff --git a/source/blender/blenlib/intern/noise.cc b/source/blender/blenlib/intern/noise.cc index 6f9a1b00a58..ab5b8f388f9 100644 --- a/source/blender/blenlib/intern/noise.cc +++ b/source/blender/blenlib/intern/noise.cc @@ -2309,6 +2309,8 @@ float voronoi_n_sphere_radius(const VoronoiParams ¶ms, const float4 coord) /* **** Fractal Voronoi **** */ +/* The fractalization logic is the same as for fBM Noise, except that some additions are replaced + * by lerps. */ template VoronoiOutput fractal_voronoi_x_fx(const VoronoiParams ¶ms, const T coord, @@ -2319,8 +2321,7 @@ VoronoiOutput fractal_voronoi_x_fx(const VoronoiParams ¶ms, float scale = 1.0f; VoronoiOutput output; - const bool zero_input = params.detail == 0.0f || params.roughness == 0.0f || - params.lacunarity == 0.0f; + const bool zero_input = params.detail == 0.0f || params.roughness == 0.0f; for (int i = 0; i <= ceilf(params.detail); ++i) { VoronoiOutput octave = (params.feature == NOISE_SHD_VORONOI_F2) ? @@ -2367,6 +2368,8 @@ VoronoiOutput fractal_voronoi_x_fx(const VoronoiParams ¶ms, return output; } +/* The fractalization logic is the same as for fBM Noise, except that some additions are replaced + * by lerps. */ template float fractal_voronoi_distance_to_edge(const VoronoiParams ¶ms, const T coord) { @@ -2375,8 +2378,7 @@ float fractal_voronoi_distance_to_edge(const VoronoiParams ¶ms, const T coor float scale = 1.0f; float distance = 8.0f; - const bool zero_input = params.detail == 0.0f || params.roughness == 0.0f || - params.lacunarity == 0.0f; + const bool zero_input = params.detail == 0.0f || params.roughness == 0.0f; for (int i = 0; i <= ceilf(params.detail); ++i) { const float octave_distance = voronoi_distance_to_edge(params, coord * scale); diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_fractal_voronoi.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_fractal_voronoi.glsl index cc178a7e6f4..c8f70256823 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_fractal_voronoi.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_fractal_voronoi.glsl @@ -6,6 +6,8 @@ #pragma BLENDER_REQUIRE(gpu_shader_common_math_utils.glsl) #pragma BLENDER_REQUIRE(gpu_shader_material_voronoi.glsl) +/* The fractalization logic is the same as for fBM Noise, except that some additions are replaced + * by lerps. */ #define FRACTAL_VORONOI_X_FX(T) \ VoronoiOutput fractal_voronoi_x_fx(VoronoiParams params, T coord) \ { \ @@ -17,8 +19,7 @@ Output.Distance = 0.0; \ Output.Color = vec3(0.0, 0.0, 0.0); \ Output.Position = vec4(0.0, 0.0, 0.0, 0.0); \ - bool zero_input = params.detail == 0.0 || params.roughness == 0.0 || \ - params.lacunarity == 0.0; \ + bool zero_input = params.detail == 0.0 || params.roughness == 0.0; \ \ for (int i = 0; i <= ceil(params.detail); ++i) { \ VoronoiOutput octave; \ @@ -69,6 +70,8 @@ return Output; \ } +/* The fractalization logic is the same as for fBM Noise, except that some additions are replaced + * by lerps. */ #define FRACTAL_VORONOI_DISTANCE_TO_EDGE_FUNCTION(T) \ float fractal_voronoi_distance_to_edge(VoronoiParams params, T coord) \ { \ @@ -77,8 +80,7 @@ float scale = 1.0; \ float distance = 8.0; \ \ - bool zero_input = params.detail == 0.0 || params.roughness == 0.0 || \ - params.lacunarity == 0.0; \ + bool zero_input = params.detail == 0.0 || params.roughness == 0.0; \ \ for (int i = 0; i <= ceil(params.detail); ++i) { \ float octave_distance = voronoi_distance_to_edge(params, coord * scale); \