Archived

This topic is now archived and is closed to further replies.

Shadows, Direct3D, Software

This topic is 5012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been looking online ( googling ) for a technique on rendering shadows in software, no stencil buffer, no pixel shader support. I am developing this game for an orginazation and was hoping to get some realistic shadows working. Any help is greatly appreciated. Thanks much

Share this post


Link to post
Share on other sites
Well you can do the old method to taking the geometry and through some fancy matrix math you can pancake it so that it can lie flat on a plane. Problem with this is that, well, you can only render it to a flat surface. So your shadow will not work on curved surfaces.

And if that isn''t an option... blobby shadows that just sit underneath the model may work too.

~Wave

Share this post


Link to post
Share on other sites
quote:
Original post by Wavewash
Well you can do the old method to taking the geometry and through some fancy matrix math you can pancake it so that it can lie flat on a plane.



D3DXMatrixShadow();


HRESULT CMesh::DrawShadow(LPDIRECT3DDEVICE9 pd3dDevice, LPDIRECT3DTEXTURE9 pTexture,
CONST D3DXVECTOR4* pLight, CONST D3DXPLANE* pPlane)
{

D3DXMATRIX matShadow;
D3DMATERIAL9 mtrlShadow;

D3DXMatrixShadow(&matShadow, pLight, pPlane);

mtrlShadow.Diffuse.r = 0.0f;
mtrlShadow.Diffuse.g = 0.0f;
mtrlShadow.Diffuse.b = 0.0f;
mtrlShadow.Diffuse.a = 1.0f;

pd3dDevice->SetTransform(D3DTS_WORLD, &matShadow);

pd3dDevice->SetMaterial(&mtrlShadow);
pd3dDevice->SetTexture(0, pTexture);

for( DWORD i=0; i<m_dwNumMaterials; i++ )
{
// Draw the subset

m_pMesh->DrawSubset(i);
}

return D3D_OK;
}

Share this post


Link to post
Share on other sites