stk-code_catmod/data/shaders/utils/getPosFromUVDepth.frag

9 lines
347 B
GLSL
Raw Normal View History

vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix)
{
2016-06-27 07:39:20 -04:00
vec4 pos = 2.0 * vec4(uvDepth, 1.0) - 1.0;
pos.xy *= vec2(InverseProjectionMatrix[0][0], InverseProjectionMatrix[1][1]);
pos.zw = vec2(pos.z * InverseProjectionMatrix[2][2] + pos.w, pos.z * InverseProjectionMatrix[2][3] + pos.w);
pos /= pos.w;
return pos;
}