diff options
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_material_magic.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material_magic.glsl | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material_magic.glsl b/source/blender/gpu/shaders/gpu_shader_material_magic.glsl new file mode 100644 index 00000000000..942c507cc38 --- /dev/null +++ b/source/blender/gpu/shaders/gpu_shader_material_magic.glsl @@ -0,0 +1,61 @@ +void node_tex_magic( + vec3 co, float scale, float distortion, float depth, out vec4 color, out float fac) +{ + vec3 p = co * scale; + float x = sin((p.x + p.y + p.z) * 5.0); + float y = cos((-p.x + p.y - p.z) * 5.0); + float z = -cos((-p.x - p.y + p.z) * 5.0); + + if (depth > 0) { + x *= distortion; + y *= distortion; + z *= distortion; + y = -cos(x - y + z); + y *= distortion; + if (depth > 1) { + x = cos(x - y - z); + x *= distortion; + if (depth > 2) { + z = sin(-x - y - z); + z *= distortion; + if (depth > 3) { + x = -cos(-x + y - z); + x *= distortion; + if (depth > 4) { + y = -sin(-x + y + z); + y *= distortion; + if (depth > 5) { + y = -cos(-x + y + z); + y *= distortion; + if (depth > 6) { + x = cos(x + y + z); + x *= distortion; + if (depth > 7) { + z = sin(x + y - z); + z *= distortion; + if (depth > 8) { + x = -cos(-x - y + z); + x *= distortion; + if (depth > 9) { + y = -sin(x - y + z); + y *= distortion; + } + } + } + } + } + } + } + } + } + } + if (distortion != 0.0) { + distortion *= 2.0; + x /= distortion; + y /= distortion; + z /= distortion; + } + + color = vec4(0.5 - x, 0.5 - y, 0.5 - z, 1.0); + fac = (color.x + color.y + color.z) / 3.0; +} |