Quote: "When you touch a green bug, the base of you glowy line would start from that position."
cool idea just not sure how to change the start position
this is the shader for anyone that wants to have a go at adding a start position
fw=OpenToWrite("thingy.ps")
WriteLine(fw,"#ifdef GL_ES")
WriteLine(fw,"precision mediump float;")
WriteLine(fw,"#endif")
WriteLine(fw,"#extension GL_OES_standard_derivatives : enable")
WriteLine(fw,"")
WriteLine(fw,"uniform float speed; ")
WriteLine(fw,"uniform vec3 color; ")
WriteLine(fw,"uniform float width; ")
WriteLine(fw,"uniform float time; ")
WriteLine(fw,"uniform vec2 mouse; // mouse pixel coords. xy:")
WriteLine(fw,"uniform vec2 resolution; // viewport resolution (in pixels)")
WriteLine(fw,"uniform sampler2D backbuffer;")
WriteLine(fw,"float Hash( vec2 p, float s)")
WriteLine(fw,"{")
WriteLine(fw," vec3 p2 = vec3(p.xy,10.0 * abs(sin(s)));")
WriteLine(fw," return fract(sin(dot(p2,vec3(27.1,61.7, 12.4)))*273758.5453123);")
WriteLine(fw,"}")
WriteLine(fw,"float noise(vec2 p, float s)")
WriteLine(fw,"{")
WriteLine(fw," vec2 i = floor(p);")
WriteLine(fw," vec2 f = fract(p);")
WriteLine(fw," f *= f * f * (3.0-2.0*f);")
WriteLine(fw," return mix(mix(Hash(i + vec2(0.,0.), s), Hash(i + vec2(1.,0.), s),f.x),")
WriteLine(fw," mix(Hash(i + vec2(0.,1.), s), Hash(i + vec2(1.,1.), s),f.x),")
WriteLine(fw," f.y) * s;")
WriteLine(fw,"}")
WriteLine(fw,"float factor(float len, float s, float e){")
WriteLine(fw," float v1 = 1.0 - 1.0 / exp(pow((s-len) * 6.0,2.0));")
WriteLine(fw," v1 = clamp(v1, 0.0, 1.0);")
WriteLine(fw," float v2 = 1.0 - 1.0 / exp(pow((len-e) * 6.0,2.0));")
WriteLine(fw," v2 = clamp(v2, 0.0, 1.0);")
WriteLine(fw," return (1.0-step(len,s))*v1 * (step(len,e))*v2;")
WriteLine(fw,"}")
WriteLine(fw,"float fbm(vec2 uv,float t,float len){")
WriteLine(fw," float v = 0.0;")
WriteLine(fw," vec2 p = uv+t;")
WriteLine(fw," v += noise(p*.5, 0.35);")
WriteLine(fw," v -= noise(p*2., 0.25);")
WriteLine(fw," v -= noise(p*4., 0.125);")
WriteLine(fw," v += noise(p*8., 0.0625);")
WriteLine(fw," return v*factor(length(uv),0.0,len);")
WriteLine(fw,"}")
WriteLine(fw,"vec2 rotate(vec2 uv,float degree){")
WriteLine(fw," mat2 rot = mat2(cos(degree),-sin(degree),sin(degree),cos(degree));")
WriteLine(fw," return rot*uv;")
WriteLine(fw,"}")
WriteLine(fw,"void main( void ) {")
WriteLine(fw," float size = min(resolution.x, resolution.y);")
WriteLine(fw," vec2 uv = gl_FragCoord.xy / size * 2.0 - resolution/size;")
WriteLine(fw," uv.x *= resolution.y/ resolution.x;")
WriteLine(fw," vec2 touch = vec2(1.0) - 2.0 * mouse/resolution;")
WriteLine(fw," uv = rotate(uv,atan(touch.y,-touch.x));")
WriteLine(fw," float t = width / distance(uv, vec2(clamp(uv.x,0.0,length(touch)),fbm(uv,time*speed,length(touch))));")
WriteLine(fw," vec3 finalColor = 0.3 * texture2D(backbuffer,gl_FragCoord.xy).rgb + t * color;")
WriteLine(fw," gl_FragColor = vec4( finalColor, 1.0 );")
WriteLine(fw,"}")
CloseFile(fw)
fubar