layout(binding=1) uniform sampler2D depth_texture;
uniform mat4 inverse_VP;
in vec2 tex_coord;
vec3 reconstruct_position(float depth, vec2 tex_coord)
{
vec4 position = vec4(tex_coord, depth, 1);
position.xyz = position.xyz*2-1;
position = inverse_VP*position;
position.xyz /= position.w;
return position.xyz;
}
void main()
{
float depth = texture(depth_texture, tex_coord).r;
vec3 position = reconstruct_position(depth, tex_coord);
}