Sign in to follow this  

cant get an alpha channel on textures

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

currently using BMPs but they supposedly dont have alpha channels forum searches reveal that PNG and TGA are good alternatives, both have nice loaders available already unfortuantly I cant seem to make PNG or TGA with alpha channels Using photoshop with an alpha channel, and it just wont let me save alpha into either of those formats, in fact Photoshop seems to claim that i can make BMPs with alpha so wtf? whys photoshop seem to have all the file formats/alpha abilites backwards? and what can i do about it? need to have an alpha channel in my texture so i can use it for multitexture combining....

Share this post


Link to post
Share on other sites
Photoshop has some kind of special BMP format I believe which will let you save alpha. It does save alpha for TGA at least, but depending on which version of Photoshop you have you have to create the alpha layer differently.

Which version are you using?

Share this post


Link to post
Share on other sites
I don't really know about those formats you describe,so every time I need an alpha channel I follow this approach:

(1)Create the RGB texture in photoshop and save it as a bmp:"texture_RGB.bmp"
(2)Now,create a grayscale image(with the same dimensions) that represents the alphachannel and again save it as a .bmp:"texture_alpha.bmp"
(3)Write a little utility and combine these two together into an RGBA format of your own.For R,G,B channels read from "texture.bmp" and for the A channel read from "texture_alpha.bmp".Save that:"texture.raw"

You will of course have to write a loader since it's your own file format,but it should be easy enough.

Share this post


Link to post
Share on other sites
version 7.0
i really dont know how to use it very well, had to ask a friend how to set different channels and add an alpha
seems that this is not the way for it to make TGAs tho
preliminary google search reveals it might involve some wierd Photoshop specific stuff about masks, not sure i want to get into all that


mikeman, your approach sounds ok, tho i dont know too much about the guts of these formats themselves...
can I have a copy of your utility?


Share this post


Link to post
Share on other sites
haphazardlynamed: I suspected as much. This is the reason I stuck at 5.5 or 6.0 ;)

Although there is a plug-in which should restore this to the way it was.

The way to make alpha channels for TGA files is the following (if I remember correctly):
put the picture on the bottom layer of a .PSD (the layer should not be a background layer). Then using the erase tool with different opacities 'erase' the parts you want transparent. The background of checkers will shine through. If you save this as a .TGA file, I think Photoshop will convert this 'deletion'mask as the alph channel.

Not sure it this works, but it's worth a quick try.

edit: found the site on this: clicky

Share this post


Link to post
Share on other sites
@haphazardlynamed:I can't find the utility right now,but since it's converting to my own format,you woudn't have much use for it.However,take a look at this simple piece of code:


AUX_RGBImageRec *Image_RGB,*Image_A;
Image_RGB=auxDIBImageLoad("c:\\texture_RGB.bmp");//Load RGB data
Image_A=auxDIBImageLoad("c:\\texture_A.bmp");//Load alpha data

unsigned char *Image_RGBA=new unsigned char[Image_RGB->sizeX*Image_RGB->sizeY*4];//Alloc mem for RGBA image
unsigned char *pix1=Image_RGB->data;
unsigned char *pix2=Image_A->data;
unsigned char *pix3=Image_RGBA;
int i,j;

for (i=0;i<Image_RGB->sizeX*Image_RGB->sizeY;++i)
{

for (j=0;j<3;++j)//Copy RGB data(first 3 bytes)
{
*pix3=*pix1;
++pix3;++pix1;
}

*pix3=*pix2;++pix3;pix2=pix2+3;//Copy the alpha channel
}




I load two textures using glaux.I assume both of them are 24-bit,but "texture_A.bmp" is the alpha texture,that means it's only made of tones of gray,so R,G,B channels are the same.In the end,you can use Image_RGBA and load it using glTexImage2D and GL_RGBA.I haven't test it,so it may be not completely bug-free,but it seems right.

Share this post


Link to post
Share on other sites
Hi all,
Standar BMP is 24bpp maximum so no alpha channel. After Windows2000, a new 32-bit BMP format was supplied but not widely supported (had you notices the pointer with that soft shadow behind?... its a 32bpp BMP).

How you create textures with alpha?
a. Use Photoshop and create your standard texture.
b. Select the Channels tool and create a new channel... it will be called Alpha by default. This is a black and white channel that represent your alpha values. You can select painting in the alpha channel or in the RGB values using the Channel tool (get used to this tool... its really useful for this). After you draw your alpha information, save the file as a PSD so wou wont lose any color/alpha information. This will be your source file.

c. Now you have a 32bit PSD, now you can export your file in any format you want.

d. If you want RGB and Alpha in separate files, then just save the original PSD as a 24bit BMP or a JPG. Then copy/past the alpha channel into a new file, transform it into grayscale (Image->Adjust menu) and save it as a 8bpp b/w bitmap. Now you can load them separately.

e. If you want to save it as a 32bpp TGA, just save the source PSD as a TGA... no info is lost.

f. If you want a PNG... that another history... you can use the ImageReady tool in order to make your life easier.

I hope that was helpful... luck!
Guimo



Share this post


Link to post
Share on other sites

This topic is 4854 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this