Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Depth buffer values

0 views
Skip to first unread message

Alexander Rautenberg

unread,
Dec 4, 2009, 8:33:33 AM12/4/09
to
hi,

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

jbwest

unread,
Dec 4, 2009, 5:34:54 PM12/4/09
to

"Alexander Rautenberg" <raute...@googlemail.com> wrote in message
news:ea813d5e-f0ae-4097...@m25g2000yqc.googlegroups.com...

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


fungus

unread,
Dec 5, 2009, 3:19:53 AM12/5/09
to
On Dec 4, 2:33 pm, Alexander Rautenberg <rautena...@googlemail.com>
wrote:

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

Alexander Rautenberg

unread,
Dec 6, 2009, 6:42:02 AM12/6/09
to

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

fungus

unread,
Dec 6, 2009, 2:41:26 PM12/6/09
to
On Dec 6, 12:42 pm, Alexander Rautenberg <rautena...@googlemail.com>
wrote:
>

> 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

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.

0 new messages