Hi,
I'm tring to reconstruct eye space position from depth buffer, but my result doesn't look correct.
This is my current and one of the shortest implementations i found:
(from: http://www.gamedev.net/topic/577382-...on-from-depth/)Code :float depth = texture2D(depthBuffer, texCoord).r; vec2 xy = texCoord * 2.0 - 1.0; vec4 clipPos = vec4(xy, depth, 1.0); // I pass inverseProjectionMatrix as uniform vec4 homo = inverseProjectionMatrix * clipPos; vec3 position = homo.xyz / homo.w; gl_FragColor = vec4(position, 1.0);
This gives me only green-yellow-red colors and no visible 3D objects:
But the correct result should look like this (top right)?
I have tried out many examples. Some of them were too difficult and others gave also artifacts etc. If i visualize depth texture, then everything looks correct.
Can anybody see mistake in above code?






