Game Development Community

Bitmap formats, Gui/Hud, Png, and Alpha Channel

by David R. Green · in Torque Game Engine · 08/23/2001 (11:50 am) · 16 replies

Hi,

I thought there was a forum message already on this subject, but I can't find it anywhere...

- PNG is of course a standard image file format...

- The BM8 files use the Texture2BM8 tool and are palettized multi-res images ??

- The gui script parameter "opacity" for GuiBitmapCtrl bitmaps does not appear to do anything ??
It sure doesn't for me, even with T2 bitmaps.

- Hud/Bitmap transparency:
Is this accomplished with alpha channel information?
My paint application [CorelPP8] seems to load in T2 PNG with an alpha channel (??), but it won't save it with one, it says "This format does not support alpha channels".

Am I wacko here?

Thanks,
David "trying-to-get-my-hud-working" Green

#1
08/23/2001 (12:22 pm)
Gui/HUD Bitmap Elements do use the Alpha Channel for Transparency.
#2
08/23/2001 (12:56 pm)
Photoshop 5.0-5.1 (and I think 6 was finally fixed), support the format with alpha (you can save the channel). We had probs in beta/meta testing of T2 with the alpha channels while skinning models, something about the latest .png format in PS 6 wasn't "true" png or something. Maybe LabRat remembers? I'm pretty much a PS only user, so I don't know how well Paint Shop Pro or others handled it.
#3
08/23/2001 (1:28 pm)
Paint Shop Pro handles it just fine... It's one of the Paint programs I use.
#4
08/23/2001 (1:55 pm)
Thanks for the info.

It would appear that Corel PhotoPaint 8 must have a weird bug/implementation on their PNG format filter. It won't properly write it with alpha, but it will read it with alpha.
Since one of my co-developers has PhotoShop, I'll have to save any of my bitmaps as 32-bit TIF and have him save them out as 32-bit PNG (unless any of my other apps here write 32-PNG, I'll have to look).

Still wondering about the GuiBitmap property on Opacity, does it actually work or is it implemented only on special cases? I can use the T2 PNG and gui code, and any changes I make to the opacity property makes no visible difference on the V12 test app hud.

Thanks,
David "got-it-kinda-figured-out" Green

P.S. We've got our game story and sketches completed, a bunch of the V12 scripting figured out, hud graphics, and now working on the models. Very cool.
#5
08/23/2001 (3:29 pm)
Photoshop 6 PNG format is not a valid PNG. The best thing to do is to take the png.8* (dont recall the exact name) from photoshop 5-5.5 and overwrite the same file from photoshop 6 in the plugins directory. This will allow you to use photoshop 6 with the "true" png format.

Basically PS6 displays the alpha channel as the RGB or something real wierd like that, so I came up with the best way to fix it I could think of.

I will probably write a tutorial on the way the alpha channels work to explain more clearly.
#6
08/23/2001 (3:47 pm)
Not sure if this helps but here is a link talking about gamma issues with Photoshop saving PNG's.

user.fundy.net/morris/redirect.html?photoshop3.shtml

also

www.interocitor-media.com/tribes/tut1.htm

--Rick

PS: after doing a little searching on the web it appears that no one else is having problems with photoshop png's besides tribes2 (aside from the gamma problems above). I wonder if upgrading the pnglib will resolve the problem. One more thing to add to the task list....
#7
08/23/2001 (4:43 pm)
After additional searching.... I found this in the latest PNG release notes:

Quote:
31 January 2001 - libpng 1.0.9 is released. This version updates the gcc/gas MMX support to a level comparable to the MSVC version, adds Borland project files and a few MNG-related functions (not enabled by default in 1.0.9), fixes some bugs in iCCP support and adds a workaround for broken Photoshop 5.5 iCCP chunks, and fixes a few other little bugs and documentation errors. This is likely to be the last of the 1.0 series; the next release is expected to be 1.2.0 and will include a whole new class of runtime-tunable functions.

The V12 is currently running 1.0.8. I will try to upgrade to the latest version and see if that fixes this issue.

--Rick
#8
08/23/2001 (6:42 pm)
It has nothing to do with gamma. It is an alpha channel issue. It displays the Alpha channel incorrecly...it sounds strange but it is like it uses the alpha channel for transparency automatically, so basically the RGB areas that are defined "white" in the alpha channel are displayed, but the areas that arent are transparent. I am pretty sure it is either that:

1) v12 has an old PNG format and adobe is correct

2) Vice versa. Adobe used some kind of non-standard/proprietary PNG format (unlikely).

It might be interesting to see what PNG implimentations the PS5 and PS6 are using now that we know v12 has 1.08
#9
08/23/2001 (7:12 pm)
Gimp has the same behavior as photoshop. The problem is that they don't seem to load the alpha channel as a seperate layer or channel.
#10
08/24/2001 (12:30 am)
Very odd... but my Corel PhotoPaint 8 is now working properly with PNGs... ??

Later
David "almost-got-it-working" Green
#11
08/25/2001 (8:33 am)
Here is how it works...

Photoshop 5,6, whatever does not save off it's alpha channel as the PNG alpha channel. It will however preserve transparancy and save that informaion into the PNG alpha channel.

Try it out:

file->new
-select transparant background for contents
-use a large paint brush to paint some pattern
file->save as
-select png

the transparancy info will be saved inthe png alpha channel.

Note: if you use Adobe Image ready and the image has transparency a 'transparency check box' will automatically appear in the settings area you must select it to save the transparency into the png alpha channel.

--Rick GG
#12
11/18/2001 (9:59 pm)
I can't get this working.

I've spent the last 2 or 3 hours trying to do something that seems simple -- replace the background image in the initial GUI. I'm using Photoshop 5.5, and I've tried saving the background as a jpg and a png but all I get is a white background.

Since this is a background, there's no transparency necessary, though if it happens to be there and always set to a zero value, that would be fine.

What are the requirements for images to appear as GUI backgrouns? Can Photoshop 5.5 produce files that meet those requirements? Is there another program that's more highly recommended?
#13
11/19/2001 (8:40 am)
Ooops. Misunderstood the question.
#14
11/19/2001 (8:05 pm)
I've been using PS6 to make PNG's, and it's worked fine for me all along. I've been using the method that Rick mentioned. Just using the layer transparencies. I find it easier anyways.
#15
11/20/2001 (5:56 am)
Ok, and when you don't want any transparency in the image, do you do anything special? Do you have to make sure the background is set to transparent, even if you subsequently completely "paint" over it?
#16
11/20/2001 (10:12 am)
Just don't save the PNG with transparency and it will use the background color for areas not painted. The preview in ImageReady is exactly what you'll get in the Torque.

--Rick