Jump to content
  • Advertisement

Archived

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

Megatron

Bitmap Translucency

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

Advertisement
I think with DirectX you''re limited to using D3D and it''s alpha blending capabilities, or implementing a software translucency method with direct draw (thrownback to dx7)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

There is a good article here on how to do 8 bit software
translucency:

http://www.flipcode.com/tutorials/tut_transmaps.shtml

For 16 bit translucency, you can try something like this:



#define MASK565 (1111011111011110b); // assuming a 565 format
#define MASK555 (0111101111011110b); // assuming a 555 format

// if you are in 565 mode
for(each pixel)
{
color3 = ((color1&MASK565)+(color2&MASK565))>>1;
}

// if you are in 555 mode
for(each pixel)
{
color3 = ((color1&MASK555)+(color2&MASK555))>>1;
}



The above is only good for 50% translucency, and it is slight inaccurate in the LSB. If you want other percentages, you will have to separate each pixel into it''s red, green, and blue components, average them together using math or a lookup table, and recombine each red, green, and blue value into your new color.







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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!