Alpha Transparency

Started by
4 comments, last by bbxx 24 years, 2 months ago
hello everyone, I am planning on putting alpha blending into a 2d game i am making. I know that DDraw doesn''t support it so I did it in software. Except how am I supposed to make alpha values for my surfaces? Are there any image editors where you can edit the alpha values? should i have seperate buffers with my alpha values in them? Another thing that I noticed as I browsed the DirectX SDK help was that the overlay surface has a bunch of alpha flags and stuff.. do overlays support alpha transparency? if so, do most video cards support overlay surfaces capable of this? Any help would be appreciated, Matt Teiken bbxx@hotmail.com
Matt Teiken
Advertisement
You have to use Direct3D to do alpha blending. Unless, like you said, you create your own routine.
William Reiach - Human Extrodinaire

Marlene and Me


The way I did it, was something like this: I started working in 32 bit format, filled the first 8 bits for alpha,and used my routine to do the blending, then I switched to 16 bit (for speed) and had to use a buffer alpha
To get the alpha, though, I use my own 32 bit image format, wich i build from 2 24 bit bitmaps, where one bitmap has the image info, and the blue component of the second gets to be the alpha. When using 16 bits, i just convert the file values to 16 bit and channel the alpha info into the buffer.
The "MMX enhanced alpha blending"-article helped me much when I was going to code my alpha-stuff. Check it out at GDnet/Reference/Programming

Cya
thanks alexmoura. could you also use green and red for the alpha? is blue better for a reason? also, what''s a good way to identify the alpha buffer with the image?
Matt Teiken
You can use wichever color you well please (i don''t even remember why I picked blue, actually I just needed 8 bits for alpha) but if you use just one of the colors you can even paint your "alpha mask" in grey without much fuss.
As for identifing the the budffer with the image, I have a class for storing the dd surfaces, so I just added the buffer to the class, and instead of manipulating dd surfaces I just move the class around. A struct with a LPDDSURFACE and a BYTE * or whatever will do fine.

This topic is closed to new replies.

Advertisement