Jump to content
Posted 22 February 2012 - 07:48 PM
Posted 22 February 2012 - 08:25 PM
Posted 25 February 2012 - 02:27 AM
linearDepth = 1.0 / gl_FragCoord.w; // get view space depth scaled = (linearDepth - BoxNear) / (BoxFar – BoxNear); // normalize to [0..1]gl_FragCoord.w stores the reciprocal of the depth in view space (positive in front of the camera).
Indeed, it may already be correct (in case you're slicing), but not scaled properly to let you see it. You could try to scale the depths a little so that the front of the box is mapped to black and the back to white (as I have done above).
Is depth being output as a color? is the color the only info you are going on? the values may be very close together and may look the same, but may not be.