I'm trying to draw a partly transparent texture a plane, but the problem is that it's incorrectly displaying what is behind that texture.
vertices1 basiceffect1 // The vertices of vertices1 are located BEHIND vertices2 vertices2 basiceffect2 // The vertices of vertices2 are located IN FRONT vertices1 GraphicsDevice.Clear(Blue); PrimitiveBatch.Begin(); //if I draw like this: PrimitiveBatch.Draw(vertices1, trianglestrip, basiceffect1) PrimitiveBatch.Draw(vertices2, trianglestrip, basiceffect2) //Everything gets draw correctly, I can see the texture of vertices2 trough //the transparent parts of vertices1 //but if I draw like this: PrimitiveBatch.Draw(vertices2, trianglestrip, basiceffect2) PrimitiveBatch.Draw(vertices1, trianglestrip, basiceffect1) //I cannot see the texture of vertices1 in behind the texture of vertices2 //Instead, the texture vertices2 gets drawn, and the transparent parts are blue //The clear color PrimitiveBatch.Draw(vertice PrimitiveBatch.End();
My question is, Why does the order in which I call draw matter?
Edit: Added screenshots
It's like there is no Z buffering at all.
this is done with:
GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead;
I've tried other settings but they don't help
Edit: I think I have to somehow set the BlendState of the graphic card in some way so that the textures behind other textures get rendered.