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

Guest Anonymous Poster

Translucency on a 16 bit game

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

Guest Anonymous Poster
How can I get a great translucency effect using directdraw surfaces ?
I making a 2d game and I want this effect for some sprites on the game.

Share this post

Link to post
Share on other sites
Hmmmm...perhaps someone else can correct me on this...

Simple translucency is called blending or additive translucency (I think?).
It just adds the values of two colors together. I don't think you even
have to separate the RGB components before adding, it just works.

But adding two colors, like two white pixels together, can be too much and it
will overflow. So you have to decide how much of each pixel you want before
you add them together. A simple way is to add 50% color of each pixel,
because this will never be to much. You can also zero out the lower bit
of each RGB component to prevent overflowing of one RGB component into the
next RGB component when adding two colors.

And then there are DD surfaces. You can lock them, get a surface pointer,
loop through all the pixels, do your adding, and unlock them. There's also D3D
way to do it (hardware is good), but I haven't try it yet.

For fx effects like explosions, you can cheat by using transparency instead
of translucency. Just fill in the outline of the explosion with the transparent
color you want to use as a colorkey.

For see-through menus like the ones used in Starcraft, you just have to
use translucency to get that cool overlayed effect.


Share this post

Link to post
Share on other sites