Advertisement

Alpha blending?

Started by January 19, 2001 01:09 PM
17 comments, last by Alazorn 23 years, 10 months ago
How can I use alpha blending to make areas of textures transparent, do I need a special graphic tool or can I use Psp6, Psp7 or Photoshop?
yes most paint programs support this remember to save the file as a 32bit texture

http://members.xoom.com/myBollux
Advertisement
How exactly do I do that? When I chose tocreate a new image in Psp7 I can as most select 24bit colors???
I''ve had the same problem. I don''t think psp supports saving in 32-bit ARGB format. Usually 32-bit is 8 alpha, 8 red, 8 green, 8 blue. Paintshop Pro doesn''t do the alpha, so you''ve got 8+8+8=24 bits. It''s still the same colour depth though.

You can use a program like the dx texture tool (comes with dx sdk). You can select another image for the aplha layer. This image is like a mask: white is opaque, black is transparent (or is it the other way round?). And you have shades of gray etc. It saves in the microsoft dds format, which is ARGB.

Frank
Ok, so can I download this program somewhere without having to download the whole dx sdk? and how can I select another image for the alpha?
Use .tga files. (targa) Since those have alpha channel. I think the latest PPS does have alpha ability.

You can also take a .bmp, and create another 8bit image and use that as your alpha... When you read in file, it would be RGB from the BMP, and A from the 8bit source file.

You can also use photoshop, and I think there are some other freeware programs that will read/write alpha also. Search with google.

Advertisement
You have to save your bitmaps as 24 bit and then load them as 32 bit and compute yourself the alpha byte for every pixel.
Simply write 3 bytes from bmp-file to the buffer and skip one byte.

If you need only an alpha-test (not a blend) you can put alpha=0 if the pixel is black and alpha=255 otherwise...

If you need a blend you can calculate alpha as the intensity of the RGB color (it depends by the effect you want).


IpSeDiXiT
That about using black as completly transparent seams very good since I can use Blending to achive half transparent bitmaps, you dosn''t happen to have the code to do that?
>>You can also take a .bmp, and create another 8bit image and use that as your alpha... When you read in file, it would be RGB from the BMP, and A from the 8bit source file.<<

no offence but this is a orrible idea.

just use an image format that supports alpha.eg targa
i havent used psp for a while but im certain it does support alpha in a texture (have a look for transparency or alpha in the help)
alternatively GIMP (avialable also for windows) supports everything, better program IMHO than photoshop

>>That about using black as completly transparent seams very good since I can use Blending to achive half transparent bitmaps, you dosn''t happen to have the code to do that<<

very easy to write when u load the texture use somrit like
r = getc(file)
g = getc(file)
b = getc(file)
if (r==0x00 && g==0x00 && b==0x00)
a=0x00;
else a=0xff;




http://members.xoom.com/myBollux
Hey man, I must say I have no idea how to do that :| where do you get the r, g and b values. Can I in some way implement that in ma code?

int LoadGLTextures() //Loads bitmaps and converts to textures
{
int status=false;
char *names[10]={"Data/cubes_texture.bmp","Data/logo.bmp","Data/presents.bmp","Data/demo.bmp","Data/call.bmp","Data/force.bmp","Data/white.bmp","Data/env_back.bmp","Data/sky.bmp","Data/star.bmp"};
AUX_RGBImageRec *texture1[10];
memset(texture1,0,sizeof(void*)*10);
for (int a=0;a<=9;a++)
{
if (texture1Link

This topic is closed to new replies.

Advertisement