Jump to content
  • Advertisement
Sign in to follow this  
genesys

Plants - problem with alphablending/alphatesting

This topic is 4613 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

Hi! I've got some problems with a tree. All the branches are singlepolygons with alphamapped branches on it! The problem is, that if i'm using alphablending or alphatesting (both work - but result in the same problem...) the polygons are transparent where they should be transparent - but where they are not transparent, they're displayed in the wrong order (for example the stump can be seen through the branches - or branches which are far away from the camera are seen through branches which are near to the camera and so on...) Can someone tell me what flags i must set to get the right result?? Thx!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I recommend you use just plain alphatesting instead of alphablending+testing. Keep your z-buffer on and simply render. This results in a simple on/off case for texture texels, which have higher performance (no back buffer read to blend), but result in poorer quality edge quality (no blend).

If you must have alphablended textures, then you will have to sort each frame by EACH triangle, rendering back to front, to obtain the correct results. If your object is totally convex (not your tree, like a box) you can render each mesh at a time,sorting each of these meshes back to front for each blended render.

NOTE: there is no magic state settings that will make your alpha blended meshes draw in the correct overlapped and blended order - you must sort by each triangle, for each changed frame, or simply use alphatesting alone.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
enable z buffer

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!