I just added items into my game, but ran into a problem with DirectX. I'm using Z-buffering, and alpha blending.
pD3DDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
//Set alpha blending
pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
The zbuffers are set so that the ground is drawn first (0.99f), then items (0.2f) and players on the top (0.01f).
Everything works fine when there's an item on the ground, or just a player. But when a player is standing on top of an item, the item disappears and it just shows the ground and the player.
I created the device with AutoDepthStencil also.
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.EnableAutoDepthStencil = TRUE;
Is there something else that I need to set if I want 3 polygons in the same place, that are all alpha blended?