xxxxxxxxxx
26
precision mediump float;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D noiseTexture;
const float threshold = 0.5;
const float range = 0.2;
varying vec2 pos;
void main() {
vec4 colour1 = texture2D(texture1, pos);
vec4 colour2 = texture2D(texture2, pos);
float noise = texture2D(noiseTexture, pos).r;
float t = smoothstep(threshold - range, threshold + range, noise);
gl_FragColor = mix(colour1, colour2, t);
}