Alpha Question

Blitz3D Forums/Blitz3D Beginners Area/Alpha Question

Boyd600(Posted 2006) [#1]
Hi I got a quick question about alpha textures, I`ve read on the forums that alpha can cause z-order problems but i havent had any problems yet with my tests.

does it depend on your graphics card?

Hope thats clear, thanks


sswift(Posted 2006) [#2]
When you draw an object with alpha, the pixels in it are not written to the zbuffer, only compared with it.

Also, objects with alpha are always drawn last.

What this means is that the "leaves" in a tree will be drawn in the order that the polygons are in the mesh, and if they intersect one will just be drawn on top of the other.

In addition, it means that with any two transparent objects that intersect, one will always be drawn on top of the other. You cannot have a transparent cube halfway in and halfway out of transparent water, unless the cube is really two meshes, and one is below the surface.

And even then, because the water object is so big, and the order it is drawn in is determined by the location of it's center relative to the centers of the other objects, your two cube halves will probably end up either being draw in front of the water or behind it anyway.

If you replace cubes with grass around the edge of the lake, or splash particles on the lake, you can see how there might be some problems. I'm not sure how they fix this in commercial games. They might have special cases for water planes to make sure they get drawn before any particles, unless the camera is beneath them.


Boyd600(Posted 2006) [#3]
Thank you, that clears it up for me