PDA

View Full Version : lots of transparent quads



05-20-2000, 07:39 PM
I want to put a whole bunch of transparent quads in parallel intersecting a whole bunch of transparent quads perpendicular to these. Due to the draw order, it looks good from some angles, and bad from others. Do I have to break these up into a bunch of smaller quads to get it to look right? (cross-section below)

__|__|__|__|__
__|__|__|__|__
__|__|__|__|__
__|__|__|__|__
__|__|__|__|__
| | | |

Glenn Upton
05-21-2000, 08:39 PM
If you are not using textures, make each quad a pair (or more) of triangles, otherwise lighting will suck. With triangles, you get a vertex crossing the centre of the rectangle (or square), where the lighting is calcd. Assume you are generating normals and assume the "looks bad" is a lighting effect. I've found triangles always work better for lighting (more vertices).

dmy
05-22-2000, 12:17 AM
you have to depthsort.
it looks bad because if you draw a quad here and then another quad a bit farther behind, this will appear broken.
the z-buffer in fact decides if a fragment can pass or is to be discarded.

the best way is to depth sorth in back to front order the alpha blended primitives, or else in front to back order but with depth buffer test disabled.
it all depends on what you have to do with these quads.

another way could be to use the alpha test capability of gl.
polygons will appear broken the same, but this way is less noticeable.

to activate alpha test, do:

glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0);

fragments with a alpha component of 0 won't be rendered, so the completely transparent parts of your textures (if you're using texturing, of course) will be invisible.

Dolo/\/\ightY

05-22-2000, 06:04 AM
Thanks for the ideas. I'll try and them, and if I have trouble, I'm sure you'll hear from me! http://www.opengl.org/discussion_boards/ubb/smile.gif