🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Translucency on a 16 bit game

Started by
0 comments, last by GameDev.net 24 years, 7 months ago
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.
Advertisement
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.

Reaver

This topic is closed to new replies.

Advertisement