mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Skybox: replace sphere-mesh approach with a fullscreen triangle that reconstructs the world-space ray direction analytically via inverse projection/view matrices. Eliminates clip.w=0 degeneracy at the horizon and correctly maps altitude to dir.z in the Z-up coordinate system. Clouds: hemisphere mesh was storing altitude in aPos.y (Y-up convention); the Z-up view matrix projected this sideways, making clouds appear vertical. Store altitude in aPos.z and update the fragment shader to read dir.z as altitude and dir.xy as the horizontal UV plane.
12 lines
405 B
GLSL
12 lines
405 B
GLSL
#version 450
|
|
|
|
// Fullscreen triangle sky — no vertex buffer, no mesh.
|
|
// Draws 3 vertices covering the entire screen, depth forced to 1.0 (far plane).
|
|
|
|
layout(location = 0) out vec2 TexCoord;
|
|
|
|
void main() {
|
|
// Produces triangle covering NDC [-1,1]² with depth = 1.0 (far)
|
|
TexCoord = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
|
|
gl_Position = vec4(TexCoord * 2.0 - 1.0, 1.0, 1.0);
|
|
}
|