Question about trees (transparent textures)

I implimented some standard trees with the 2 perpendicular quads, using a transparent PNG for the tree texture.

Now, the tree in the foreground correctly shows the transparency through to the skybox, but obscures the other trees like a “cloak of invisibility”. But it only does this when viewing the trees from one direction, not the other.

The trees are all part of the big “world” object. I am using glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA). Face culling is off.

I must be missing something regarding transparent texturing… this effect is kinda cool but not the simple thing I’m doing after! Any ideas?

When you draw transparent object you have to order them back to front to have a correct behavior.

A ha. I was afraid that might be the case.

But, what about the fact that a tree can also obscure itself? How would I depth sort the 2 quads which make the tree? Their centroids would be equal.

You can mitigate zbuffer problems by doing alpha testing on top of blending, at a low threshold.
Or use coverage alpha with multisampling.

Yes, alpha test will work just fine for my purposes. Thanks for mentioning it.