Sorry for the delay.
Since the project is too large, I'm unable to upload any real source code.
However, I'm still doing some work, I tried to do the following on a separate mesh:
device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); // If FALSE, the mesh will appear normally, if TRUE I will see undesired transparent mesh
device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
// Draw
boxMesh->DrawSubset(0);
device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
// Draw again
boxMesh->DrawSubset(0);
1. I notice that the entire mesh is transparent (which is undesired), when I set D3DRS_ALPHABLENDENABLE to FALSE in the first draw, I get normal mesh, however I will need D3DRS_ALPHABLENDENABLE to be TRUE in some meshes, why the mesh is transparent in the above code? I want to enable alpha blending but not make the mesh transparent.
2. How do I give the shader multiples lights? sometimes I will have 500 different light in the scene, how do I give 500 light to the shader and specify the light type and other properties as well in each light?