PDA

View Full Version : How to render leaf textures smoothly?



ymish
01-12-2004, 12:45 PM
I have a tree model. The leaves are textures and I use mipmaps with the command:

glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R, MIPMAP_LINEAR);

Because the leafs are with alpha channel, I get a white silhouette around the leaf (probably from the adjacent transparent white pixels).
On the other hand, when I remove the above mipmap command and use GL_LINEAR instead of MIPMAP_LINEAR I get very very noisy leaves.
In addition the leafs blink when I move.
The reason is probably my z-buffer which has only 24 bits per pixel where my frustum is big.

How can I get smooth leaf textures without noise or blinking?

mogumbo
01-12-2004, 01:38 PM
You can remove the white halo around your leaves by changing the white pixels to be the same color as the the leaf.

The blinking could be either z-fighting or that you're not rendering your leaves from back to front. If it's z-fighting, you can try decreasing the far-clipping plane or increasing the near clipping plane. If it's a sorting problem, then you need to sort the polygons before you draw them.