Jump to content
  • Advertisement

Archived

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

Scooter

Blitting Semi-Transparent

This topic is 6500 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'm not sure if DD 8.0 supports it, but do a search for translucency or alpha-blending. You can do it manually too.. just take each pixel and do something like this:

ForegroundPixel + BackgroundPixel /2 = NewPixel

(obviously doing that for the RG&B components seperately)

The above will give you 50% tranlucency. I had the formula for variable translucency somewhere, but I lost it when formated one of my hard drives. From what I remember, you take each color value and multiply it by a %. 1.0 for opaque, 0.0 for invisible, 0.5 for half-way, etc..

Edited by - A. Buza on October 3, 2000 7:13:24 PM

Share this post


Link to post
Share on other sites
Hi there,

I use the following

        
#define BLEND(src,dest,alpha) (((alpha*(src-dest))>>8)+dest)

#define BLEND50(src,dest,alpha) ((src+dest)*0.5)


Hope it helps.


Edited by - MButchers on October 4, 2000 6:35:16 AM

Share this post


Link to post
Share on other sites
So each frame, i''d have to get the dest. r,g,b and do the blend with the source r,g,b colors individually? doesn''t this eat up alot of time?

Share this post


Link to post
Share on other sites
yes, it''s very CPU expensive.
if you want it to go faster you can either optimize it for MMX (i think there is a tutorial on gamedev), or use d3d, which of course requires a hardware accelerator.

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!