Code:
 
function mtl_vegetation_init
{
vec_set(mtl.emissive_blue,mat_model.emissive_blue);
vec_set(mtl.ambient_blue,mat_model.ambient_blue);
vec_set(mtl.diffuse_blue,mat_model.diffuse_blue);
vec_set(mtl.specular_blue,mat_model.specular_blue);
mtl.power=mat_model.power;
mtl.albedo=mat_model.albedo;
//mtl.skill1=pixel_for_vec(vector(188,0,0),0,8888); // the first value in the vector is the threshold
mtl.skill1=pixel_for_vec(vector(40,0,0),0,8888); // the first value in the vector is the threshold
}

material mtl_vegetation
{
event=mtl_vegetation_init;
effect=
"
texture entSkin1;
dword mtlSkill1;
technique vegetation
{
pass p0
{
Texture[0]=<entSkin1>;
ZWriteEnable=true;
Zenable = true;
AlphaBlendEnable=false;
AlphaTestEnable=True;
AlphaRef=<mtlSkill1>;
AlphaFunc=Greater;

CullMode=CCW; // CCW or None

ColorArg1[0]=Texture;
ColorOp[0]=Modulate2x;
ColorArg2[0]=Diffuse;
}
}
technique fallback{pass p0{}}
";
}



my.material = mtl_vegetation;

This will solve your sorting problems. If you want alpha blending change - AlphaBlendEnable = True;


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/