shader_type canvas_item; uniform sampler2D noise; uniform float threshold : hint_range(0,0.5)= .5; uniform float strength : hint_range(-0.5,0.5) = 0; float random (vec2 uv) { return fract(sin(dot(uv.xy, vec2(12.9898,78.233))) * 43758.5453123); } void vertex() { // Called for every vertex the material is visible on. } void fragment() { // Called for every pixel the material is visible on. vec2 uv = UV; vec2 rv = vec2(mod(TIME, 1.0), uv.y); vec4 val = texture(noise, rv); uv.x += .01 * (val.x - 0.5) * 2.0; float extrema = abs(val.x - 0.5); //if(extrema > threshold){ //uv.x += sign(val.x - 0.5) * mix(0,strength, (extrema) / (.5 - threshold)); //} if(extrema > threshold){ uv.x -= strength * (val.x - 0.5) * 2.0; } vec4 col = texture(TEXTURE, uv); col.rgb *= COLOR.rgb; COLOR = col; //* COLOR; //COLOR = val; } //void light() { // // Called for every pixel for every light affecting the CanvasItem. // // Uncomment to replace the default light processing function with this one. //}