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


Transparency for 2d Sprites with Direct3D?

Recommended Posts

Hi I have tied Gart Simmons great tutoriual on 2D Alpha Bending with Direct3d and it works fine. But I want to have one color in the texture completly tranparent. Is it Possible to use both Colorkeying and Alphabending with D3DTLVERTEX at the same time?. I have tried but i cant get it to work. Does anyone know?

Share this post

Link to post
Share on other sites

I haven''t read that tutorial, but assuming it does blending with the diffuse component of the vertex and you want to add colour keying, it''s easy.

Use D3DXCreateTextureFromFileEx, it allows you to specify a colour key value which will be completely transparent.

I don''t have documentation with me, so this might be a little off, but you set your texture renderstates to:

And that should do it. If my assumptions are wrong, post more detail and I''ll try again.

Stay Casual,

Drunken Hyena

Share this post

Link to post
Share on other sites