Problems with Alpha channels on hard edged images

Things in RTC that do not work as expected (compared to Dungeon Master) or at all! Please read previous posts carefully to see if the bug has already been reported.

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Gambit37
Should eat more pies
Posts: 13263
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Problems with Alpha channels on hard edged images

Post by Gambit37 » 13-Nov-09 17:20

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.

User avatar
linflas
My other avatar is gay
Posts: 2445
Joined: 4-Nov-03 20:58
Location: Lille, France
Contact:

Re: Problems with Alpha channels on hard edged images

Post by linflas » 13-Nov-09 19:49

I noticed that problem too. Some PNGs are correct, some are not :(
"The only way out is another way in." Try Sukumvit's Labyrinth II

paladin3333
Neophyte
Posts: 7
Joined: 5-Nov-08 18:38

Re: Problems with Alpha channels on hard edged images

Post by paladin3333 » 1-Jan-10 23:47

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.

User avatar
Lord_BoNes
Jack of all trades
Posts: 1061
Joined: 1-Dec-08 11:36
Location: Ballarat, Australia.

Re: Problems with Alpha channels on hard edged images

Post by Lord_BoNes » 2-Jan-10 07:34

It appears that it only affects 1-2 pixels out so... paint black onto the background, in the problematic areas.
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone

User avatar
Gambit37
Should eat more pies
Posts: 13263
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Re: Problems with Alpha channels on hard edged images

Post by Gambit37 » 2-Jan-10 14:38

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.

User avatar
Lord_BoNes
Jack of all trades
Posts: 1061
Joined: 1-Dec-08 11:36
Location: Ballarat, Australia.

Re: Problems with Alpha channels on hard edged images

Post by Lord_BoNes » 2-Jan-10 16:11

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).
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone

User avatar
Gambit37
Should eat more pies
Posts: 13263
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Re: Problems with Alpha channels on hard edged images

Post by Gambit37 » 2-Jan-10 16:20

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.

User avatar
Gambit37
Should eat more pies
Posts: 13263
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Re: Problems with Alpha channels on hard edged images

Post by Gambit37 » 2-Jan-10 16:46

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.)

User avatar
Lord_BoNes
Jack of all trades
Posts: 1061
Joined: 1-Dec-08 11:36
Location: Ballarat, Australia.

Re: Problems with Alpha channels on hard edged images

Post by Lord_BoNes » 2-Jan-10 18:44

Good work. Can you post some screenies of the troll in various wallsets (DMI, DMII, the one above, etc)??? Please.... :P
Last edited by Lord_BoNes on 2-Jan-10 18:52, edited 2 times in total.
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone

User avatar
Gambit37
Should eat more pies
Posts: 13263
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Re: Problems with Alpha channels on hard edged images

Post by Gambit37 » 2-Jan-10 18:51

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

User avatar
Lord_BoNes
Jack of all trades
Posts: 1061
Joined: 1-Dec-08 11:36
Location: Ballarat, Australia.

Re: Problems with Alpha channels on hard edged images

Post by Lord_BoNes » 2-Jan-10 18:52

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.
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone

User avatar
Gambit37
Should eat more pies
Posts: 13263
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Re: Problems with Alpha channels on hard edged images

Post by Gambit37 » 2-Jan-10 18:57

???

User avatar
Lord_BoNes
Jack of all trades
Posts: 1061
Joined: 1-Dec-08 11:36
Location: Ballarat, Australia.

Re: Problems with Alpha channels on hard edged images

Post by Lord_BoNes » 2-Jan-10 19:20

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.
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone

User avatar
Gambit37
Should eat more pies
Posts: 13263
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Re: Problems with Alpha channels on hard edged images

Post by Gambit37 » 2-Jan-10 19:56

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. :)

User avatar
Lord_BoNes
Jack of all trades
Posts: 1061
Joined: 1-Dec-08 11:36
Location: Ballarat, Australia.

Re: Problems with Alpha channels on hard edged images

Post by Lord_BoNes » 2-Jan-10 20:26

Sorry dude. I blame sleep-deprivation... that's my excuse, and I'm sticking to it! :P
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone

paladin3333
Neophyte
Posts: 7
Joined: 5-Nov-08 18:38

Re: Problems with Alpha channels on hard edged images

Post by paladin3333 » 3-Jan-10 22:31

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.

User avatar
Gambit37
Should eat more pies
Posts: 13263
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Re: Problems with Alpha channels on hard edged images

Post by Gambit37 » 4-Jan-10 00:02

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.

Post Reply