Is there anyway to do this? because when I tried
this:
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch27.html
and this:
https://www.opengl.org/discussion_boards/showthread.php/185571-Convert-to-Worldspace-from-depth-buffer
and this:
and this:
https://www.opengl.org/discussion_boards/showthread.php/179823-Help-reconstructing-pixel-position-from-depth
I got nothing!!!
those guys gets the world position, even its kinda weird, but why not me?
is it just because BGE doesn’t support so I have to create my own alternatives?
if so, can you please tell me how to do it?
My code:
vec4 pos = vec4( gl_TexCoord[0].st * 2.0 - 1.0, texture(bgl_DepthTexture, gl_TexCoord[0].st).r * 2.0 - 1.0, 1.0 );
pos = viewMatrixInverse * gl_ProjectionMatrixInverse * pos;
pos.xyz / pos.w;
gl_FragColor = pos;