View Full Version : Alpha Channel contours - how to remove?

08-26-2005, 01:23 PM

I assume this question has been discussed here at least once, but, I spent about an hour here looking for thread discussing, how to remove the contour of an game sprite with alpha channel applied on it.

Let me explain. Imagine a small sprite that is going to be used in computer game. I want try if my PPC can manage Alpha Channel calculations on sprite, so I generated 32bit *.tga with alpha channel.

The sprite was rendered on black background, and when the alpha channel is applied, black background passes through exactly in areas of background antialiasing.

If possible I dont want to postprocess all the sprites in photoshop by aplying some filter removing this effect, I would be glad if there is some way how to export the sprite so, that it removes this.

Is there any way please? Again, I do aplogize if this has been discussed, but I did not find the right answer anywhere.


08-26-2005, 01:33 PM
Hi bunkai (again ;) ).

Is that with a sprite already rendered out? I.e. all you have is the 32bit file?

It is possible, but won'T look to good due to precision issues in the 8 bit channels.

Do you want to programm a routine to do that for you? In what language? I could quote a bit of pseudo C code if that helps.


08-26-2005, 02:12 PM
Hello Lightwolf,

thank you for saving my neck. :-)

Well, the alpha blending routine is written already. I do not have programming problem, however, rather if the picture could be rendered in a way, that alpha blending would be applied only on the sprite itself and not on the background.

You know, alpha channel is on all the edges of the sprite. it is one computed on both, background area and the object area.

Is it possible to render the alpha cahnnel so, that it would simply cut the edges of the objects and would remove gradient from black to white?

Anyway, if you are interested, my game is programmed in C++. (www.cutn.sk/reno/game

I attach an image as illustration of unwanted contour. A spaceship rendered on black background got over light planet in my game. Hopefully It will appear correctly.

Thank you,

08-26-2005, 03:47 PM
I'm not sure I understood you correctly, but basically you want just 1-bit alpha (on/off)? Could you not achieve this by rendering without anti-aliasing and using that alpha-mask, or by increasing the contrast (and brightness) on the alpha-channel in photoshop.

Another alternative might be to not render the sprites with a black background, use a neutral color like gray 127,127,127 (or even better the color of the majority of the sprite's edges) and keep the alpha as it is and see how that works.

08-26-2005, 04:18 PM

Hello.. Do you practice karate? Chojun Myagi was one of the leaders and founders of traditional Okinawa Karate-Do.

Ok, You know if you have hundreds of pixels you can not afford cancel antialiasing, because you would lose it over the whole sprite. This would be a problem.

So my problem is, that if I take antialiased picture and place it on into my game, it will have contours of borders it was rendered on. The same is, with the using of alpha channel.

Both Maya and 3DS Max have buttons that can solve this. hmm.. "It is called premultiplication" If anybody have an idea, please...

08-26-2005, 04:32 PM
If you apply the 'Sprite edger' image filter and don't change any of the settings, set the AA to low or enhanced low (one of the old style AA methods anyway) you'll find when you render the sprites, the edges of the sprites will be pixelly but the alpha's will be antialiased, and this should get rid of the black edges.

08-26-2005, 05:04 PM
Do you practice karate? Chojun Myagi was one of the leaders and founders of traditional Okinawa Karate-Do.

No I don't, the nick originally (many many years ago) was based on character in a certain movie :) (at the time I didn't know better so it was slightly misspelt)

Ok, You know if you have hundreds of pixels you can not afford cancel antialiasing, because you would lose it over the whole sprite. This would be a problem.

I just meant cancel it for the alpha mask, and then render another with AA for color, but I realize now that that was not what you wanted.

Have you tried the "Spriteedger" image filter (that comes with LW8)? Using the default settings it appears to do what you need, but I only did a very quick check so I might have missed something.

Another alternative, if Spriteedger doesn't work, might be "Unpremultiply" that can be downloaded here (http://www.jamesburnsdesign.com/TOT/programs.html), it's a stuff-it archive and I don't have an extractor so I don't know if it does what you need.

Edit: that's what I get for taking so long to post, Dodgy beat me to it ;)

08-26-2005, 05:40 PM
Thank you Dodgy and Myagi,

I tried SpriteEdger, and apparently it solved my problem. I hoped that lightwave would have something built in, but this 3rd party plug in does the job perfectly. Well, you can take a look at attached picture.
So for today I have problem solved. It is 2am, now, I should go to sleep.

Have a nice day, and thank you.. :-) I am glad that this works. :-)

08-27-2005, 10:41 AM
Hello again,

besides already mentioned solution with use of SpriteEdger plug-in, NewTek has implemented a button. I discovered it yesterday late night, and that button is called "Fader Alpha Mode" in Render Options. Look at the picture below.

Thanks, and regards,