1 2 3 4 5 6 7 8
vec3 reconstruct_position(float depth, vec2 tex_coord) { vec4 position = vec4(tex_coord, depth, 1); position.xyz = position.xyz*2-1; position = inverse_MVP*position; position.xyz /= position.w; return position.xyz; }