Jump to content
  • Advertisement

Archived

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

jollyjeffers

D3D9 Colour Key Transparencies

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

hello all, I''m having a bit of (code)writers block.. This is something I''ve done 10x before in previous versions of Direct3D - but for some reason I really can''t crack it tonight I have a simple 2D tile game, magenta colour key (that is, where a tile has a magenta pixel it shouldn''t be drawn).. I''m sure it was just a case of doing the following: 1. Creating the texture with the colour key AND with a D3DFMT that has at least 1bit alpha (I''m using A8R8G8B8). 2. Set the 3 render states: - D3DRS_SRCBLEND = D3DBLEND_SRCALPHA - D3DRS_DESTBLEND = D3DBLEND_INVSRCALPHA - D3DRS_ALPHABLENDENABLE = TRUE 3. Render! Is there anything else to it? I''m sure its one little thing I''ve missed... and its really bugging me any chance you can give me a hand? cheers, Jack DirectX 4 VB: All you need for multimedia programming in Visual Basic Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
Advertisement
Verify the renderstates using some texture file with already-defined alpha channel.
If that works, try to verify that the magenta is really converted to transparent.

-Nik

Share this post


Link to post
Share on other sites
hmm, will look into those...

but I''m sure its a simple renderstate/settings thing - I suppose I''ll just dig through all my old source code until I find the answer

Jack

Share this post


Link to post
Share on other sites
The renderstates you mentioned are correct, that''s why i recommended verifying the data itself. However, the problem might also be in texture stage states (where does the device get the alpha from?).

-Nik

Share this post


Link to post
Share on other sites
Make sure that you have the following renderstates set


Device->SetRenderState(D3DRS_ALPHAREF,255);
Device->SetRenderState(D3DRS_ALPHAFUNC,D3DCMP_GREATEREQUAL);



[edited by - RhoneRanger on October 13, 2003 4:17:57 PM]

Share this post


Link to post
Share on other sites
doubt anyone cares right now... but just for future reference (or if anyone searches with similar problems in the future!) I solved the problem by using 32bit DDS textures authored using DXTex...

Seems like D3DX really didn''t want to load my bitmap correctly!

Jack

DirectX 4 VB: All you need for multimedia programming in Visual Basic
Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!