PDA

View Full Version : Strange 'wireframe'effect through transparent areas, but only on Geforce3?



bzfrank
12-31-2001, 05:43 AM
I did run into a strange effect while working on an OpenGL game which only surfaces on this special setup (GeForce 3). I use billboarding for trees that stand in a game field together with other elements. Parts of the trees are transparent (have alpha). All billboarding elements are drawn depth-sorted. This works fine and gives the expected results.

However (GeForce3 only, Detonator 23.11/2k/XP) when looking though transparent areas all elements behind show as texturesless gray and with pronounced edges alike wireframe.

Also the textures as displayed on the billboard (a rectangle build from a triange strip) appear to have a pronounced edge and show a diagonal colored line (the triangle edge).

This screenshot shows the effect (see the ball and the castle):
http://www.wizards.de/~frank/project2501/Geforce3_problem2.jpg

Now the catch: Turn on antialiasing and the effect goes away and everything displays like it should (and also everything works fine on Geforce 2, Geforce, TNT ,... even without antialiasing).

Can anyone give me a pointer what I am doing wrong and why this happens? The program showing the effect can also be downloaded from
http://www.wizards.de/~frank/project2501/

dorbie
12-31-2001, 03:37 PM
It looks like where you have blended trees a wireframe pass of other data is showing through.

This makes me think that perhaps there's a blend function against DESTINATION alpha (maybe one minus destination alpha), when drawing them and it's interracting with a wireframe pass or polysmooth alpha fragment results which have been written to the framebuffer.

Maybe you may have polygon smooth on WITHOUT blending when drawing the rest of the scene, but alpha fragments < 1 are being written to destination alpha. Then you modulate the billboard color with destination alpha when you draw them, or something along those lines. It looks like trees are being modulated with source alpha, so there's something a LITTLE more complex going on, but probably not much.

The thing which makes this show as a problem could be the existence of destination alpha in the PFD.

You need to work on your graphics state management.

SirKnight
12-31-2001, 06:36 PM
It looks to me like a GL_POLYGON_SMOOTH mode is screwing with your alpha buffer. If you have GL_POLYGON_SMOOTH enabled, try taking that enable line out and see what happens. If thats not the case then check your states and how your drawing stuff to the alpha buffer. Maybe you need a glDisable in a place you dont have one? Something is kinda wierd there though.

-SirKnight

bzfrank
01-08-2002, 02:54 PM
Originally posted by SirKnight:
It looks to me like a GL_POLYGON_SMOOTH mode is screwing with your alpha buffer. If you have GL_POLYGON_SMOOTH enabled, try taking that enable line out and see what happens.
-SirKnight

Thanks!! That was it. I had turned on GL_POLYGON_SMOOTH for some wireframe experiments early during startup and forgot to disable it again. As my primary development system is still a GeForce2 this never showed. Funny it did show effect only on a GeForce3...

dorbie
01-08-2002, 03:34 PM
Hmm.. the same answer to to similar questions in a matter of days.

It probably breaks on the GeForce class systems because they do this right. Antialiasing your polygons SHOULD screw up your depth buffered scene.

On the other hand there were a couple of strange things going on which explicitly pointed away from polysmooth. For example the tree NOT occluding the polysmooth edges, suggesting there is still a blend against destination alpha going on with the trees. It's also a bit strange that this only happened behind occluding trees.

There's more than meets the eye to this one.

[This message has been edited by dorbie (edited 01-08-2002).]