A few time ago I had this problem with my scene when using alpha textures:
I solved it by setting vinya->getMaterial(140).ZWriteEnable=false; where 140 is the tree material.
Anyway, I have added a few more alpha textures, and they exhibit the same problem, except that when I try to fix them like I did with the trees it makes no effect.
I'm using 3D Studio Max as a modeller and my3d as the file format. I have made sure that the alpha materials are correctly named (ej. "AlphaChannel-whatever"). Maybe I'm missing something...
Looks as if you don't set it as EMT_TRANSPARENT_ALPHA_CHANNEL. When you set material to this, then they are drawn in correct order, else they aren't.
For performance reasons, you should consider using EMT_TRANSPARENT_ALPHA_CHANNEL_REF. This doesn't do alpha blending, but rather alpha rejection, which doesn't need sorting either and is considerably faster.
They are set as EMT_TRANSPARENT_ALPHA_CHANNEL, since this is what the my3d exporter sets the transparent materials to (I've checked this using irrEdit.
Is there any way to make the exporter set them to TRANSPARENT_ALPHA_CHANNEL_REF? or at least, a way to do it manually later?
I've tried with vinya->getMaterial(140).setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF); but it gives me a compiling error.
I do think there is sorting problem (perhaps a bug) with EMT_TRANSPARENT_ALPHA_CHANNEL
This is EMT_TRANSPARENT_ALPHA_CHANNEL
and this is EMT_TRANSPARENT_ALPHA_CHANNEL_REF
i'm fine with EMT_TRANSPARENT_ALPHA_CHANNEL_REF but sometimes I need EMT_TRANSPARENT_ALPHA_CHANNEL for half transparent texture and the problem above doesn't allow me to use it.
You can enable ZWrite on the material once you set the scene paramater ENABLE_ZWRITE_ON_TRANSPARENT. That will often fix such problems. However, _REF is much faster.
after i set scene parameter to ENABLE_ZWRITE_ON_TRANSPARENT and enabled ZWrite, my creature's head was being 'eaten' by its leaves
EMT_TRANSPARENT_ALPHA_CHANNEL
as for EMT_TRANSPARENT_ALPHA_CHANNEL_REF, there is also a problem (in OpenGL only) which is lighting will be disabled when material type is EMT_TRANSPARENT_ALPHA_CHANNEL_REF. set EMF_LIGHTING to true does not give any effect, the lighting is still disabled.