Making realistic trees!

I am using the classic two flat tree textures in an X shape to make the illusion of a detailed tree.

However, I am running into problems as the transparent parts of the textures are writing into the depth buffer, thus obscuring whatever is behind those transparent pixels. It looks weird to say the least!

I have seen a ton of engines using this tree approach though, so it must be some simple way to fix it?

I simply need opengl to not write depth-information where the transparent pixels are, but keep setting it for the non-transparent texture pixels…

Just figured it out, just need to use alpha test…

Consider using only bitmask transparency. In other case, you will have to sort all translucent objects, which may be not worth it for trees.

You have to draw all transparent polys last after the scene is drawn and then turning off z-buffer writes.
But you have to sort them whether it’s bitmap transparency or alpha.

The BSP tree algorithm solves this problem nicely :slight_smile: