Initial import.
[featherfall2.git] / src / data / shaders / noisyblocks.frag
1 /* This is free and unencumbered software released into the public
2 domain. To the extent possible under law, the author of this file
3 waives all copyright and related or neighboring rights to it.
4 */
5
6 precision highp float;
7
8 varying vec2 fTexCoord;
9 varying vec4 fColor;
10 uniform sampler2D tex;
11
12 uniform vec2 resolution;
13 uniform float cut;
14 uniform float range;
15
16 void main(void) {
17 vec2 coord = floor(fTexCoord * resolution);
18 vec3 n = vec3(coord.xy, cut);
19 float p = 1.0 - range * abs(snoise(n));
20 vec3 modulated = fColor.rgb * p;
21 vec4 texColor = texture2D(tex, fTexCoord);
22 gl_FragColor = vec4(modulated * fColor.a, fColor.a) * texColor;
23 }