Sign in to follow this  

Plants - problem with alphablending/alphatesting

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

This topic is 4398 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this