PDA

View Full Version : world space z coords from depth buffer



pixelate
01-08-2004, 08:14 PM
Hi!

is it possible to derive the world space z-coordinate of a point from its z value in the depth buffer? meaning that after rendering the scene, i wan to noe the value of the 3d coords of each point on the screen....

thanks!

mikael_aronsson
01-10-2004, 12:30 AM
There is no easy way to do it, the only functions in openGL that can do the conversion for you is gluProject/gluUnproject, as the values in the depth buffer is not linear it is a bit tricky to convert the values back to it's true depth value by hand, at least there is no simple way that I know of.

Mikael

pixelate
01-10-2004, 12:53 AM
hmm.... the problem is that the depth buffer values are quantized according to the precision of the zbuffer right? thats why the infomation is lost once we get to the depth buffer...

what about fragment programs? the values that it get are still before the quantization operation? if so is it possible to output the values during that stage via some textures?