From cce4b6501dc0e8afacece8c79c2929ced0e6420b Mon Sep 17 00:00:00 2001 From: s-ol Date: Sat, 25 Jan 2020 18:13:23 +0100 Subject: remove offset default uniform --- shaders/test.frag | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'shaders') diff --git a/shaders/test.frag b/shaders/test.frag index d9b76c1..9dd03ea 100644 --- a/shaders/test.frag +++ b/shaders/test.frag @@ -6,7 +6,24 @@ out vec4 color; uniform float offset; uniform float r; +uniform float radius = 1.; +uniform float pitch = 440.; + +vec3 getcol() { + vec2 c = vec2(0.8, 0.2); + if (pitch > 4.0) + return c.xyy; + else if (pitch > 3.0) + return c.yxy; + else + return c.yxx; +} + void main() { - color = vec4(mod(uv.xyx + offset + vec2(0,0.5).xxy, vec3(1)), 1); - color.r = r; + vec2 p = uv*2.-1.; + p.y *= 16./9.; + + color = vec4(mod(p.xyx + offset + vec2(0,0.5).xxy, vec3(1)), 1); + color.r = r; + color.rgb = mix(color.rgb, getcol(), smoothstep(1, 0.9, length(p) / pow(radius, 0.4))); } -- cgit v1.2.3