PDA

View Full Version : Retrieve the depth value from depth map?



autumn
09-17-2003, 04:38 AM
I have create a depth map of a human model using Render To Texture.
First I bulit a bounding box of the model ,then I placed a camera at the centre of the front face of the model's BB.
The camera far clipping plane is set to the back face of BB, and the near clipping plane is set to the front face.
At last I used the orthographic projection to create the depth map.
the orthographic projection code is :

glortho(fLeft , fRight , fBottom , fTop ,0,m_fModelDepth);

1.I want to read the depth value from the map,but the value is clamped into [0,1].How does it be calculated ?

2.How does the depth value be saved in texture? Does it be saved into each component of texel or only into R component?

the answer is very important to me , thank you very much!!!!!


[This message has been edited by autumn (edited 09-17-2003).]

Ostsol
09-17-2003, 04:51 AM
Well, here's the answer to question 1:
http://www.cs.unc.edu/~hoff/techrep/openglz.html

A depth texture is a single component texture. The precision of that single component depends on the depth that the depth texture is set to (which should be equal to the z-depth that was set when you decided on a pixel format for you window).

autumn
09-17-2003, 05:20 PM
thank you very much!!!



A depth texture is a single component texture.
What you said means that in the depth value is only stored in R component?


[This message has been edited by autumn (edited 09-17-2003).]

Ostsol
09-17-2003, 07:04 PM
I think so. . . I haven't actually worked with depth textures in the fragment shader, yet. . . http://www.opengl.org/discussion_boards/ubb/redface.gif