Short question:
If I am in clip space (unless I've misunderstood, that's where I am after multiplying with the WorldViewProjection matrix), should I not be able to get the z-coordinate of any one pixel from the gl_FragCoord.z value?
3 replies to this topic
Ad:
#2 Moderators - Reputation: 4633
Posted 14 November 2012 - 10:38 AM
Your assumption is correct, you are in clip space after the modelview and the projection matrix, but that does not mean that the fragment coordinate is in clip space. The perspective division stage separates the two. The fragment coordinate is the window coordinate (not sure if it's the normalized or pixel coordinate though) of the fragment, and consequently the depth coordinate is effectively the depth buffer value.
#3 Members - Reputation: 255
Posted 14 November 2012 - 01:02 PM
Your assumption is correct, you are in clip space after the modelview and the projection matrix, but that does not mean that the fragment coordinate is in clip space. The perspective division stage separates the two. The fragment coordinate is the window coordinate (not sure if it's the normalized or pixel coordinate though) of the fragment, and consequently the depth coordinate is effectively the depth buffer value.
So the gl_FragCoord.xy coordinates are screen coordinates? And by depth coordinate, may I assume you mean gl_FragCoord.z?






