A strange problem relating to Alpha channels.

Started by Calin Leafshade, Fri 15/01/2010 16:56:08

Previous topic - Next topic

Calin Leafshade

ok kids.. this is a weird one.

Using 3.1.2:

For some reason alpha chanels will not work with any raw draw function. I know the drawing surface doesnt support alphas but this is on the background.. and its still not working.

Also the rain plugin just sends down white blocks and isnt using the alpha channel but alpha channels work just fine in objects.

Any ideas? Im thinking my project file might be corrupt.. anywhere particular i should look?

??? ??? ???

GarageGothic

What's the color depth of the background?

Calin Leafshade


Ryan Timothy B

#3
Have you checked if the sprites with alpha channel work properly on a character/object?
edit: Sorry, I must be blind.  My guess was that those rain droplets were imported or saved incorrectly.

Calin Leafshade

#4
Quote from: Calin Leafshade on Fri 15/01/2010 16:56:08
but alpha channels work just fine in objects.

alpha channels behave as normal in objects and animations.. just not in drawimage or in the rain plugin.

What annoys me most is that ive only just noticed the problem.. i dont feel like importing more than 500 sprites again..

Ryan Timothy B

#5
Actually something like this has happened to me a few months ago.  Did you start out the game with 16bit color, then after importing the sprites you changed it to 32bit?

I did that once, but it was a fresh game and I had only imported a few sprites in the sprite manager.  The  DrawingSurface.DrawImage  would paste the sprite onto the background in a complete weird whiteish color, and those sprites didn't even have alpha.  Even after reimporting the sprites into the sprite manager and background, it still didn't fix the problem so I made a new game.

Calin Leafshade

Yes that sounds exactly like my problem. Does anyone know of a way to fix this WITHOUT nuking my game?

Dear God(CJ), is there anyway of fixing this?

Ryan Timothy B

Try drawimage with a sprite that doesn't have an alpha on the background, if you haven't.  Then we'll see if it's the same unknown weirdness I had experienced.

Calin Leafshade

hmm ok.

It will draw sprites without an alpha channel at any transparancy and it will draw sprites will alpha channels at 0 transparency.. but it wont draw alpha channeled sprites at anything other than 0 transparency.

GarageGothic

This is strange. It would be expected behavior for any AGS version before  3.1.2, but this quote from the 3.1.2 changelist seems to say it should work now:

QuoteAdded support for using Transparency properties with alpha-channel sprites

Not sure if it's also implemented for DrawingSurface or just characters/objects though.

Calin Leafshade

Well, i've done this before and the particle system manager module uses it extensively.

It certainly supported.

monkey0506

I'm actually quite certain that the DrawingSurface.DrawImage function has never supported drawing alpha channeled sprites at partial transparency. The "Transparency properties" you are referring to there GG is talking about Character.Transparency, Object.Transparency, and GUI.Transparency.

Calin Leafshade

Well then how come the snowrain plugin has exactly the same problem?

monkey0506

#13
Actually I just tested it and what I'm getting is that the sprite is simply being flattened before (the transparency is applied and) it's drawn to the background. This is happening regardless of whether using a direct sprite slot or using a DynamicSprite created from the slot and preserving the alpha channel. I'm using the latest 3.2 RC though nothing on the changelog seems relevant to this issue.

Guess I was just talking bullocks. := (Though seeing as the alpha channel is being destroyed by calling DrawImage it's not strictly working as one might be expecting anyway)

TheMagician

Quoteseeing as the alpha channel is being destroyed by calling DrawImage it's not strictly working as one might be expecting anyway

I just found that out myself ... too bad - didn't this work a few versions ago? I mean, is there any workaround? I really need to draw an alpha-transparent sprite onto a DrawingSurface...

monkey0506

You can draw images with an alpha channel onto a DrawingSurface. This will work fine and without problem (the stipulation below being considered "by-design" for now).

You cannot copy or merge alpha channels by using DrawingSurface.DrawImage. Whenever you use DrawImage the transparency is applied to the pixels as they are drawn, but the resulting image (in the DrawingSurface) has no alpha channel.

If you draw an alpha channeled image onto a transparent area of a DrawingSurface this means your sprite will be tinted pink.

However, so long as the area behind the sprite is totally opaque then you can get the same visual effect the alpha channel provides whilst using the DrawImage function.

subspark

#16
Yeah alpha channels are really buggy in AGS right now. I beleive I sent CJ on a quest to fix them two weeks ago in regards to inventory items and quite possibly everything else in effect.

I hope they all get solved in one big hit.  :D

Cheers,
Sparky.

SMF spam blocked by CleanTalk