Jump to content
  • Advertisement
Sign in to follow this  
felipedrl

Alpha sort for trees

This topic is 3293 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I alpha sort trees? My tree is made of two crossed planes with alpha. For some trees I can see the edge fully transparent when there´s the other tree plane behind it. I assume this happens because the piece of the plane that are in front is rendered first. So how do I sort it? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I would use alpha testing instead of sorting, and disable blending (in your simple case).

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

and GL_LINEAR filtering for the tree texture.

All fragment's whose alpha value < 0.5, will fail the test, so it wont write to the depth buffer, so you will get perfect visibility (I hope that makes sense)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!