I am currently trying to draw shadows over a scene in direct3d 9. I am trying to do some multi pass rendering and am having trouble understanding how to use/set the blend mode.
I have done a depth pass which fills the depth buffer and I then have a loop which loops through all the lights in the scene. Within that loop I have 2 loops which both loop through all the shapes in the scene
I have this sort of set up
for(number of shapes)
{
//render from camera position and fill depth buffer
}
for(number of lights)
{
for(number of shapes)
{
//render to shadow map
}
for(number of shapes)
{
//render to screen
}
}
In pix I can see that it loops through each light but when I run it only the last light in the light array is displayed. I think it is something to do with the blend mode.
I have looked into the blend mode and found information about source and destination blend. Is this what I need/could someone help explain it please?
Thanks in advance,
Mark
[EDIT] I got both lights visible using the following code
hr = device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
hr = device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
hr = device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
The shadows do not look correct but I am getting closer to the desired result.
Any more advice would be great,
Thanks,
Mark