Page 1 of 1

Problems with Alpha channels on hard edged images

Posted: Fri Nov 13, 2009 6:20 pm
by Gambit37
RTC can't handle rescaling images that have an alpha channel AND hard edges.

The original Troll image is this, it has hard edges for the troll and soft edges for his shadow:

Image

However, this combination causes problems with distance rescaling:

Image

It's fine if you just use 1-bit transparency and a hard edged shadow, but then you can't do semi-transparency :-( It's also fine if the image in question already has soft, semi transparent edges.

Re: Problems with Alpha channels on hard edged images

Posted: Fri Nov 13, 2009 8:49 pm
by linflas
I noticed that problem too. Some PNGs are correct, some are not :(

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 12:47 am
by paladin3333
That coming from GIMP.

i noticed that too with picture i had filled with purple color before to cut it and replace by a transparent color.


So, if you want to destroy the color around the monster, fill the transparent color by the black color make a save picture, reload picture and cut the black color for transparent and save.

Now the color around have disapear.

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 8:34 am
by Lord_BoNes
It appears that it only affects 1-2 pixels out so... paint black onto the background, in the problematic areas.

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 3:38 pm
by Gambit37
What background? The background is transparent. If you start painting around the monster, how does this help? You're just shifting the problem area to a couple of pixels further out.

I'm not sure what paladin is talking about as he mentions the power pink, so I guess he's talking about 8 bit images which can't have alpha channels -- this problem only affects images with an alpha channel.

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 5:11 pm
by Lord_BoNes
A suggestion: can you put a soft shadow around him? You could have one version of the graphic for levels where it has a dark fade-out (the above image for example), and one version of it for brighter levels (where it would be far less noticable, but a black border would stand out).

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 5:20 pm
by Gambit37
Yes, that might work.

I think the problem is that I'm using "x2" images with no intermediate pixel between each block of doubled pixels. (This is what happens when you double up images from the original DM resolution). Adding a slight semi-transparent shadow or "glow" around the image would solve this -- I'll give it a go.

I was trying to keep file sizes down by using as few semi-trans pixels as possible, so this technique will bloat the filesizes somewhat, but might be a good compromise. Thanks for the suggestion.

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 5:46 pm
by Gambit37
Cool, tried that and it works perfectly. In Photoshop I added a 4px black Glow at 20% opacity around the Troll -- this is almost imperceptible in game and fixes the problem with ugly rescaling. :) It does mean the filesizes will be a lot bigger and consume more memory, but we're only talking tens of Kb difference so I hope I won't be an issue (I want this to run well on older machines.)

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 7:44 pm
by Lord_BoNes
Good work. Can you post some screenies of the troll in various wallsets (DMI, DMII, the one above, etc)??? Please.... :P

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 7:51 pm
by Gambit37
Not really, no. He's for use in my custom game. You can get the original uncoloured Troll from DungeonHack or EOB3 asset zips -- both available here:
Dungeon Making Resources

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 7:52 pm
by Lord_BoNes
I've often been called a "great problem solver" (for those who have played Duke Nukem 3D, it almost never takes me more than a minute or two to crack a lock that is basically 4x4 block of binary, shootable, toggle switches that requires a SPECIFIC combination). So, feel free to PM me if you any issues with RTC. Most of the time, I'll just sit here until I get it kickin' perfectly. It's just my method of solving problems.

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 7:57 pm
by Gambit37
???

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 8:20 pm
by Lord_BoNes
I being serious (for once, hehehe :P) if you have issues trying to do something in RTC, feel free to just PM me about it. To be honest, it'd save me time.

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 8:56 pm
by Gambit37
It was weird, your last post just seemed to be totally unrelated to this thread, like you meant to post it on one of the other RTC mechanics threads or something. :)

Re: Problems with Alpha channels on hard edged images

Posted: Sat Jan 02, 2010 9:26 pm
by Lord_BoNes
Sorry dude. I blame sleep-deprivation... that's my excuse, and I'm sticking to it! :P

Re: Problems with Alpha channels on hard edged images

Posted: Sun Jan 03, 2010 11:31 pm
by paladin3333
no you havn't understand me...

when you draw sometime you fill probably the background with a color by accident. Arround your monster, you have grey color.
That mean you have filled your back ground with grey color at a moment and you cut it for make it transparent.

When you save, that do this! you get this color around the monster. It's probable a save of different font of gimp.

So for repair you need to fill it with black color and change into transparent again and save it for repair your picture.

for don't lost your job, you can use magic pen and work with reversed selection.

Re: Problems with Alpha channels on hard edged images

Posted: Mon Jan 04, 2010 1:02 am
by Gambit37
Right, I see what you mean. But I don't create images like this, I work on fully transparent images with no background: your solution doesn't apply to images created in this way. You're talking about something completely different.