/* This is free and unencumbered software released into the public domain. To the extent possible under law, the author of this file waives all copyright and related or neighboring rights to it. */ precision highp float; varying vec2 fTexCoord; varying vec4 fColor; uniform sampler2D tex; uniform vec2 resolution; uniform float cut; uniform float range; void main(void) { vec2 coord = floor(fTexCoord * resolution); vec3 n = vec3(coord.xy, cut); float p = 1.0 - range * abs(snoise(n)); vec3 modulated = fColor.rgb * p; vec4 texColor = texture2D(tex, fTexCoord); gl_FragColor = vec4(modulated * fColor.a, fColor.a) * texColor; }