uniform sampler2D background_tex; uniform sampler2D noise_tex; uniform float radius; varying vec2 tex_coord; void main() { float x_dist = tex_coord.x - 0.5f; float y_dist = tex_coord.y - 0.5f; float dist = sqrt(x_dist*x_dist + y_dist*y_dist); if (dist > radius || dist < radius - 164.0/512.0) { //gl_FragColor = texture2D(background_tex, tex_coord.xy); discard; } else { vec4 uv_col = texture2D(noise_tex, tex_coord.xy*1.5f); float b = 1.0f - clamp((radius - dist)*512.0f/164.0f, 0, 1.0f); float h = b * b; float highlight = 1.0f - clamp((radius - dist)*512.0f/32.0f, 0, 1.0f); vec4 col2 = texture2D(background_tex, tex_coord.xy + (uv_col.rb * uv_col.g) * h * 0.3f); vec4 col = col2; col += vec4(h * uv_col.r + highlight*0.9, h * uv_col.r + highlight*0.9, h*1.5f * uv_col.r + highlight, h); col.a = pow(b, 0.5); gl_FragColor = col; } }