Page 1 of 1

Pixel Modulation

PostPosted: Dec 12, 2003 @ 6:00pm
by drgoldie

Pixel Modulation

PostPosted: Dec 12, 2003 @ 7:25pm
by Dave H

PostPosted: Dec 12, 2003 @ 7:30pm
by Phantom

PostPosted: Dec 12, 2003 @ 8:20pm
by Dan East

PostPosted: Dec 12, 2003 @ 11:56pm
by Exocet

PostPosted: Dec 13, 2003 @ 10:28am
by drgoldie

PostPosted: Dec 14, 2003 @ 3:22am
by Dave H

PostPosted: Dec 14, 2003 @ 5:36am
by Dan East

PostPosted: Dec 15, 2003 @ 11:17am
by Dave H

PostPosted: Dec 15, 2003 @ 11:59am
by drgoldie

PostPosted: Dec 30, 2003 @ 7:34am
by hm

PostPosted: Sep 21, 2007 @ 6:34pm
by xor

PostPosted: Sep 26, 2007 @ 1:58am
by brendan
Hi all, been a Long long time since I've posted....

I'm looking into creating transparency masks for my objects and im wondering whats the best way to go about it?

atm I'm using gzipped tga files because there easy to use, with a mask color for full transparency. Has anyone written any png librarys? as they have blending transparently etc?

thanks in advance.

PostPosted: Sep 26, 2007 @ 12:34pm
by j.edwards
I had a play with png but found it a bit complicated for me - I'm simple. Plus I think it added a few hundred kb to the exe but that could have been because I built the entire thing instead of just support for what I needed. If you get png working well with a small footprint I would like to hear how you did it.

Instead, I ended up building a little win32 command line utility that converted png files with alpha channel into my own encoded format that included the alpha channel and with pixel format in 16bit565 already so no conversion was required at the ppc side. Works really well. The encoder/decoder only has about a 2kb footprint and is really fast, with the compromise being images are larger than they could have been if png, but hasn't been an issue so far. If you had a lot of rich images that need to be alpha blended then png would probably be a good option.

Another option could be to store the alpha as a separate resource in your own custom way and merge it with the pixel data when the image is loaded. I would suspect the alpha data would compress well using a simple run length encoding.

In any case you will need to build additional rendering capabilities to account for the alpha channel (assuming you are not using some library that has it already). I chose to store the alpha value with each pixel as opposed to in a separate block of memory but I don't know if that's better or worse.

There was another thread where Torus??? (I think - going back a bit now) posted how to do alpha blending with a few bitwise and a single mul which to this day I'm thankful for. If you can't find it I can post some code. Correct me if I'm wrong but the option of doing a single mul with 64bit is really bad - the Torus way (I hope it wasn't someone else :)) did it with a single mul and all 32bit - lightning fast. In fact the app I'm working on at the moment I originally stayed away from anything alpha blended but performance is so good that the entire screen pretty much is now a product of heaps of alpha blended images.

PostPosted: Sep 26, 2007 @ 3:26pm
by mm40
it depends what kind of alpha you want, if you just need 1 bit of alpha then just use a colorkey, if you need 8 bits then either use a separate 8 bit image (bmp or tga), or tga supports color and alpha and is by far the easiest to use. just use whatever is easiest, dont worry about the size, with storage cards over 4GB these days worring about the size is a waste of time.