#version 100 precision mediump float; varying vec2 texcoord; varying float v_position; uniform sampler2D u_image0; uniform sampler2D u_image1; uniform vec2 fog; void main() { float fogAmount = smoothstep(fog.x, fog.y, v_position); gl_FragColor = texture2D(u_image0, texcoord) * texture2D(u_image1, texcoord) * vec4(1.0 - fogAmount, 1.0 - fogAmount, 1.0 - fogAmount, 1.0 - fogAmount); if(gl_FragColor.a < 0.0000001) discard; }