Archived

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

Transparency for 2d Sprites with Direct3D?

This topic is 6112 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

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
G''day!

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:
AlphaOp:Modulate
AlphaArg1:diffuse
AlphaArg2:texture.

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


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites