Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/shaders/gpu_shader_material.glsl
| Show First 20 Lines • Show All 3,016 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void node_tex_image_empty(vec3 co, out vec4 color, out float alpha) | void node_tex_image_empty(vec3 co, out vec4 color, out float alpha) | ||||
| { | { | ||||
| color = vec4(0.0); | color = vec4(0.0); | ||||
| alpha = 0.0; | alpha = 0.0; | ||||
| } | } | ||||
| 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; | |||||
| } | |||||
| float noise_fade(float t) | float noise_fade(float t) | ||||
| { | { | ||||
| return t * t * t * (t * (t * 6.0 - 15.0) + 10.0); | return t * t * t * (t * (t * 6.0 - 15.0) + 10.0); | ||||
| } | } | ||||
| float noise_scale3(float result) | float noise_scale3(float result) | ||||
| { | { | ||||
| return 0.9820 * result; | return 0.9820 * result; | ||||
| ▲ Show 20 Lines • Show All 780 Lines • Show Last 20 Lines | |||||