Archived

This topic is now archived and is closed to further replies.

KoalaGerch

Depth-Buffer modes

Recommended Posts

I was wondering if anyone knew of a way to draw polygons which checked the Depth-Buffer to see if pixels were able to be drawn but didn''t actually record any information in the buffer. I''m thinking that this would eliminate the need to depth-sort transparent polys.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
glDepthMask( GL_FALSE ) will make the depth buffer read-only.

> I''m thinking that this would eliminate the need to depth-sort transparent polys.

No, you still have to sort them, or your blending operation will not work as expected. Unless you use additive blending, then you could skip the sort.

Share this post


Link to post
Share on other sites
How does additive blending work ? does it still take into account the z-buffer ?

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------

Share this post


Link to post
Share on other sites
Additive blending uses the framebuffer only.

In most cases of blending, you''ll want to litterally "blend" the colours. Say, if your alpha channel is 50% you''ll take half of the source color and half of the destination color. So if you blend light gray and dark gray, you''ll get a "medium gray".

Additive blending is different. In additive blending, you add the colours, eg mathematically add the red, green and blue components (clamped to 1). This does not really "blend" the colours and may give some strange effects. If you add-blend light gray and dark gray, you''ll get a very light gray, if not white.

The advantage of additive blending is that the blending does not depend on the polygon order.
Let''s say you have 3 colors c1, c2 and c3.
With standard blending, if you draw on screen the colour c1, then blend it with c2, then blend it with c3, you''ll have something different than if you draw, say, firstly c3, then blend c1, then blend c2.
With additive blending, the results are the same whatever the order is, thus making depth sorting useless and resulting in a faster 3D engine.

I can write down the equations if you want, but I don''t think they have their place here.
However, I can write the lines of code, which would be quite more useful
All you have to know is that additive blending allows you to skip the depth sorting problem, but it does blend the colours in a strange way.

Share this post


Link to post
Share on other sites