| 1 |
////////////////////////////////////////////////////////////////////// |
| 2 |
// |
| 3 |
// Ambient occlusion shader for sphere impostors |
| 4 |
// |
| 5 |
// This fragment shader is used for rendering the depth texture from |
| 6 |
// the light source's view. |
| 7 |
// |
| 8 |
////////////////////////////////////////////////////////////////////// |
| 9 |
|
| 10 |
// |
| 11 |
// Input |
| 12 |
// |
| 13 |
|
| 14 |
// normalized corner: [-1, 1] |
| 15 |
#version 400 |
| 16 |
precision highp float; |
| 17 |
|
| 18 |
in vec2 v_corner; |
| 19 |
|
| 20 |
out vec4 outColor; |
| 21 |
|
| 22 |
void main() |
| 23 |
{ |
| 24 |
// figure out if we are inside our sphere |
| 25 |
float zz = 1.0 - v_corner.x * v_corner.x - v_corner.y * v_corner.y; |
| 26 |
if (zz <= 0.0) |
| 27 |
discard; |
| 28 |
|
| 29 |
// draw buffer is not attached, output any color |
| 30 |
outColor = vec4(1.0, 1.0, 1.0, 1.0); |
| 31 |
} |