4 uniform sampler2D distant;
6 #pragma MSP stage(vertex)
9 gl_Position = vec4(vertex.xy, 1.0, 1.0);
10 mat4 inv_projection = inverse(projection_matrix);
11 out vec4 view_dir = inv_projection*vec4(vertex.xy, -1.0, 1.0);
12 view_dir /= view_dir.w;
13 view_dir = inverse(eye_world_matrix)*vec4(view_dir.xyz, 0.0);
16 #pragma MSP stage(fragment)
19 vec3 nview = normalize(view_dir.xyz);
20 float azimuth = atan(nview.y, nview.x);
21 frag_color = texture(distant, vec2(azimuth/(2*pi), nview.z*0.5+0.5))*light_color;