Z-Order clipping

Community Forums/Developer Stations/Z-Order clipping

Akat(Posted 2004) [#1]
when i used texture with alpha-check for a tree or something (especially using B3D pipeline), the thing previewed in my game looks like something not right in z-order clipping... how to prevent this?


Mustang(Posted 2004) [#2]
Alphablended polygons are NOT z-sorted; this is not a bug. You can see this in other games as well... some game engines sort alphablended polygons with code but that is quite slow.

http://www.rockstargames.com/maxpayne/tutorials/MaxED/texturing_adv.htm

The biggest problem with alpha blending is that they can not be sorted with Z-buffer. Instead, a separate sorting algorithm has to be applied to alpha polygons and this is very slow, a single alpha blended polygon can take as much time as drawing hundreds of normal polygons. Furthermore, the sorting algorithm is not perfect. Especially when alpha blended polygons "cross" it might make wrong decisions and the polygons would be drawn in incorrect order, bringing something that is supposed to be behind to "pop" in front of something else.



Beaker(Posted 2004) [#3]
This sorts them for you, and it isn't slow:
http://www.blitzbasic.com/codearcs/codearcs.php?code=850

But, it might not be the right solution for you. You might want to use masking instead.


Akat(Posted 2004) [#4]
yup... i used mask instead - but my tree not looks so well though


jhocking(Posted 2004) [#5]
Anthony Flack devised a really cool trick for Cletus in which he could get super accurate masking without increasing the image resolution.


Akat(Posted 2004) [#6]
hah... how?