Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / games / voxels / src / main / rust / shaders / sky.vert
sky.vert11 lines · 564 BRaw
| 1 | #version 450 |
| 2 | // Fullscreen triangle; passes clip-space NDC to the fragment shader for ray reconstruction. |
| 3 | layout(location=0) out vec2 vNdc; |
| 4 | void main() { |
| 5 | vec2 p = vec2(float((gl_VertexIndex << 1) & 2), float(gl_VertexIndex & 2)); |
| 6 | vec2 ndc = p * 2.0 - 1.0; // (-1,-1), (3,-1), (-1,3) covers the screen |
| 7 | vNdc = ndc; |
| 8 | // z = 1.0 (far): the sky is drawn after terrain with a LEQUAL depth test, so it only fills |
| 9 | // pixels with no terrain (depth still at the cleared far value) — clouds skip occluded pixels. |
| 10 | gl_Position = vec4(ndc, 1.0, 1.0); |
| 11 | } |