import msp_interface; import _sky; uniform sampler2D distant; #pragma MSP stage(vertex) void main() { gl_Position = vec4(vertex.xy, 1.0, 1.0); mat4 inv_projection = inverse(projection_matrix); out vec4 view_dir = inv_projection*vec4(vertex.xy, -1.0, 1.0); view_dir /= view_dir.w; view_dir = inverse(eye_world_matrix)*vec4(view_dir.xyz, 0.0); } #pragma MSP stage(fragment) void main() { vec3 nview = normalize(view_dir.xyz); float azimuth = atan(nview.y, nview.x); frag_color = texture(distant, vec2(azimuth/(2*pi), nview.z*0.5+0.5))*light_color; }