Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/shaders/material/gpu_shader_material_tex_noise.glsl')
-rw-r--r--source/blender/gpu/shaders/material/gpu_shader_material_tex_noise.glsl64
1 files changed, 44 insertions, 20 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_tex_noise.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_tex_noise.glsl
index 6aeb23b1f99..d8d9ecdf287 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_tex_noise.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_tex_noise.glsl
@@ -32,23 +32,35 @@ vec4 random_vec4_offset(float seed)
100.0 + hash_vec2_to_float(vec2(seed, 3.0)) * 100.0);
}
-void node_noise_texture_1d(
- vec3 co, float w, float scale, float detail, float distortion, out float value, out vec4 color)
+void node_noise_texture_1d(vec3 co,
+ float w,
+ float scale,
+ float detail,
+ float roughness,
+ float distortion,
+ out float value,
+ out vec4 color)
{
float p = w * scale;
if (distortion != 0.0) {
p += snoise(p + random_float_offset(0.0)) * distortion;
}
- value = fractal_noise(p, detail);
+ value = fractal_noise(p, detail, roughness);
color = vec4(value,
- fractal_noise(p + random_float_offset(1.0), detail),
- fractal_noise(p + random_float_offset(2.0), detail),
+ fractal_noise(p + random_float_offset(1.0), detail, roughness),
+ fractal_noise(p + random_float_offset(2.0), detail, roughness),
1.0);
}
-void node_noise_texture_2d(
- vec3 co, float w, float scale, float detail, float distortion, out float value, out vec4 color)
+void node_noise_texture_2d(vec3 co,
+ float w,
+ float scale,
+ float detail,
+ float roughness,
+ float distortion,
+ out float value,
+ out vec4 color)
{
vec2 p = co.xy * scale;
if (distortion != 0.0) {
@@ -56,15 +68,21 @@ void node_noise_texture_2d(
snoise(p + random_vec2_offset(1.0)) * distortion);
}
- value = fractal_noise(p, detail);
+ value = fractal_noise(p, detail, roughness);
color = vec4(value,
- fractal_noise(p + random_vec2_offset(2.0), detail),
- fractal_noise(p + random_vec2_offset(3.0), detail),
+ fractal_noise(p + random_vec2_offset(2.0), detail, roughness),
+ fractal_noise(p + random_vec2_offset(3.0), detail, roughness),
1.0);
}
-void node_noise_texture_3d(
- vec3 co, float w, float scale, float detail, float distortion, out float value, out vec4 color)
+void node_noise_texture_3d(vec3 co,
+ float w,
+ float scale,
+ float detail,
+ float roughness,
+ float distortion,
+ out float value,
+ out vec4 color)
{
vec3 p = co * scale;
if (distortion != 0.0) {
@@ -73,15 +91,21 @@ void node_noise_texture_3d(
snoise(p + random_vec3_offset(2.0)) * distortion);
}
- value = fractal_noise(p, detail);
+ value = fractal_noise(p, detail, roughness);
color = vec4(value,
- fractal_noise(p + random_vec3_offset(3.0), detail),
- fractal_noise(p + random_vec3_offset(4.0), detail),
+ fractal_noise(p + random_vec3_offset(3.0), detail, roughness),
+ fractal_noise(p + random_vec3_offset(4.0), detail, roughness),
1.0);
}
-void node_noise_texture_4d(
- vec3 co, float w, float scale, float detail, float distortion, out float value, out vec4 color)
+void node_noise_texture_4d(vec3 co,
+ float w,
+ float scale,
+ float detail,
+ float roughness,
+ float distortion,
+ out float value,
+ out vec4 color)
{
vec4 p = vec4(co, w) * scale;
if (distortion != 0.0) {
@@ -91,9 +115,9 @@ void node_noise_texture_4d(
snoise(p + random_vec4_offset(3.0)) * distortion);
}
- value = fractal_noise(p, detail);
+ value = fractal_noise(p, detail, roughness);
color = vec4(value,
- fractal_noise(p + random_vec4_offset(4.0), detail),
- fractal_noise(p + random_vec4_offset(5.0), detail),
+ fractal_noise(p + random_vec4_offset(4.0), detail, roughness),
+ fractal_noise(p + random_vec4_offset(5.0), detail, roughness),
1.0);
}