   Blending terrain color
  I am new 3D game developer, I have a problem described as follows so I seek help here.I draw an object in a scene with terrain, I don't to see this object but I want to change the color of terrain if the object is in front of terrain.since I don't want to see this object, I set zfunc to equal to block object and terrain is always visible. 1st problem: if I call gd3dDevice->SetRenderState( D3DRS_COLORWRITEENABLE, TRUE ); all scene is blended.2nd problem: after I commented out above statement, the terrain color is not changed at all.I am very appreciated if anyone call help me out. thanks.below are my source code.void TerrainDemo::drawScene(){// Clear the backbuffer and depth buffer.HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0));HR(gd3dDevice->BeginScene());  //draw terrainmTerrain->draw(mView, mProj);  //draw object    HR(gd3dDevice->SetStreamSource(0, mVB, 0, sizeof(VertexPos)));HR(gd3dDevice->SetIndices(mIB));HR(gd3dDevice->SetVertexDeclaration(VertexPos::Decl)); D3DXMATRIX W;D3DXMatrixIdentity(&W);HR(gd3dDevice->SetTransform(D3DTS_WORLD, &W);;HR(gd3dDevice->SetTransform(D3DTS_VIEW, &mView));HR(gd3dDevice->SetTransform(D3DTS_PROJECTION, &mProj));gd3dDevice->SetRenderState( D3DRS_COLORWRITEENABLE, TRUE ); gd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );   gd3dDevice->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_SRCCOLOR);   gd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_DESTCOLOR );gd3dDevice->SetRenderState (D3DRS_BLENDOP,D3DBLENDOP_ADD);   gd3dDevice->SetRenderState( D3DRS_ZENABLE,D3DZB_TRUE );   gd3dDevice->SetRenderState( D3DRS_ZFUNC,D3DCMP_EQUAL);HR(gd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12)); //restore setting   gd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );gd3dDevice->SetRenderState( D3DRS_ZFUNC,D3DCMP_LESS);mGfxStats->display();HR(gd3dDevice->EndScene());// Present the backbuffer.HR(gd3dDevice->Present(0, 0, 0, 0));}   