Fragment Shader Eye-Space unscaled depth coordinate

Posted by Ben Jones on Stack Overflow See other posts from Stack Overflow or by Ben Jones
Published on 2010-04-26T03:47:33Z Indexed on 2010/04/26 3:53 UTC
Read the original article Hit count: 444

Filed under:
|
|

I'm trying to use the unscaled (true distance from the front clipping plane) distance to objects in my scene in a GLSL fragment shader. The gl_FragCoord.z value is smaller than I expect. In my vertex shader, I just use ftransform() to set gl_Position. I'm seeing values between 2 and 3 when I expect them to be between 15 and 20.

How can I get the real eye-space depth? Thanks!

© Stack Overflow or respective owner

Related posts about opengl

Related posts about glsl