Anyone worked out the D3DX sprite problem?

Started by
2 comments, last by SikCiv 23 years, 11 months ago
Ive scrapped my implementation of D3DX in my game because the sprites arent colorkeyed, resulting in whole rectangles to be blitted. But I lose the FAST alpha blending feature of 3D sprites ); Has anyone worked it out yet, or is it just not possible?

  Downloads:  ZeroOne Realm

Advertisement
Well, I''ve never really used colorkeying in 3D rendering (never found a place where it would do better than actual alpha blending), but here''s a list of the things it seems must be done in order for it to work:

- Create the texture surface with the DDSD_CKSRCBLT flag, making sure to set the ddckCKSrcBlt member of the surfacedesc structure.

- Set the D3DRENDERSTATE_COLORKEYENABLE render state.
and/or (not sure)
- Set the D3DRENDERSTATE_COLORKEYBLENDENABLE render state to true. Set D3DRENDERSTATE_ALPHABLENDENABLE to true. Set D3DRENDERSTATE_SRCBLEND to D3DBLEND_SRCALPHA. Set D3DRENDERSTATE_DESTBLEND to D3DBLT_INVSRCALPHA.

Well, mess around with all those different settings and you might get something working. Also, if you havn''t yet, you could try calling D3DXPrepareDeviceForSprite. That might help too. Hope this helps.
I found something interesting that has to do with this. Some video cards do not support COLORKEYENABLE on 3d textures. In fact using an alpha bit for your textures is the best way to assure that the program will work with as many video cards as possible.
___________________________Freeware development:ruinedsoft.com
It''s true. Our team here at college has made a space combat game using D3DX for sprite rendering. It took awhile but we managed to get colorkeying to work, however, once we started alpha testing with various hardware, it was interesting to find that some cards (namely TNT2) did not support colorkeyed textures. I am now looking into the alphabit method.

This topic is closed to new replies.

Advertisement