If device not support D3DFMT_R32F how to do shadow map

Started by
3 comments, last by age_of_lion 16 years ago
I had deeply learnt through the MS 2006 SDK shadow map sample. Although In my game project, I used it for skin mesh real time shadow map, yes , it works very well. If the device is very old that render target format not support D3DFMT_R32F, the application cannot run. the following codes: //g_pShadowTex render target texture HRESULT hr=pd3dDevice->CreateTexture( Shadow_SIZE, Shadow_SIZE, 1, D3DUSAGE_RENDERTARGET, D3DFMT_R32F, D3DPOOL_DEFAULT, &g_pShadowTex, NULL ); hr will be E_FAIL and crashed. How to do shadow map on these very old display card PC that device not support D3DFMT_R32F? Who can help me. thanks a lot of.

Qian Jun
Advertisement
There's a sample at ATI's site which does a shadow map on its older PS 1.4 cards. This might help you.
According to the card caps XLS spreadsheet, cards prior to the Radeon 9600 or GeForce FX 5900 don't support D3DFMT_R32F.
I don't know the shadow mapping algorithm myself, but surely if the card doesn't support it, you should just ditch shadow mapping completly? There's some things that older cards just won't be able to do, and if they can be done using other methods, they'll be extremely slow.

Nitpick: If something fails, your app should never crash - you should handle the error correctly. The crashing is not to do with the function failing, its to do with you incorrectly handling it.
Well it's not as if D3DFMT_32F is the only format you can use for shadow mapping...D3DFMT_16F will have precision problems but certainly isn't unusable. Older Nvidia GPU's also supported hardware shadow maps through D24S8 surfaces.

Also, why are you using the 2006 SDK?
thx ETCD
I got the sample.
I think that maybe I can pack/unpack float data into integer 8 bit texture RGBA in shader if R32F not support but D3DFMT_X8R8G8B8 is support.

Qian Jun

This topic is closed to new replies.

Advertisement