[ create a new paste ] login | about

Link: http://codepad.org/3WErjAem    [ raw code | fork ]

C++, pasted on Dec 18:
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;
}


Create a new paste based on this one


Comments: