when rendering a mesh, why is it that faces that intersect the image
plane (so I can see parts of the inside of the mesh) don't produce
pixel depth values equal to 0? I'm experiencing that the depth values
of the pixels of such faces lie somewhere between 0.00x and 0.1x
(using GL_FLOAT for glReadPixels()). I'm asking this because I want to
find the pixels in the depth buffer belonging to the intersection
contour on the screen.
thanks!
Alex
Your not being clear. Are you really talking about faces? If a face is
visible, its Z has to be non-zero.
Are you talking about the edge that is being clipped? yeah, they aren't
going to be 0. What is there is
the last pixel before the one that is clipped during pixel fill, which
depends on the slope of the triangle as
it intersects the front clip.
You could get the clipped coordinates of the triangle from feedback mode,
but that would give you just corner points and it would probably be faster
for you to do it analytically.
jbw
This simply won't work, for many different reasons.
Unfortunately you didn't say what you're trying to achieve
so I can't suggest an alternative.
--
<\___/>
/ O O \
\_____/ FTB.
http://www.topaz3d.com/ - New 3D editor for real time simulation
thanks...
what I'm trying to do is to hide the inside of the mesh by rendering a
black polygon on top of the intersection contour (if the image plane
is completely inside the mesh, I can render a black polygon covering
the whole screen).
right now I'm doing this by finding the pixels carrying the minimal
depth values below some threshold along each of the four screen
borders, and then connecting those points with a black polygon (this
is of cours a pretty rough approximation of the intersection contour
but seems to be sufficient for my app). this works quite well
actually, but I need that threshold value, because -as I described- no
pixel seems to have a depth value of 0.
any hint on an alternative solution is appreciated!
thanks,
alex
How do you turn pixels into a polygon?
Try switching to a 2D view (orthographic) with near=0 and
far=1, set depth test function to "less than" and draw a
fullscreen black polygon with depth value 2.0/(2^b) where
'b' is the number of bits in your depth buffer.