PDA

View Full Version : Alpha Channels and Map Backgrounds


hundreds
2 Sep 2010, 19:10
So I feel like a complete idiot for not knowing how to do this, but:

Can anyone explain to me how one goes about adding the correct alpha channels into a map in order to get the illusion that your worms are walking into buildings, in front of trees, etc.?

I use Fireworks to create most of our maps, but also have GIMP and Photoshop that I could use to do it. I have looked around a bit and have seen bits and pieces of how this could be done, but nothing really complete enough for me to grasp the idea.

bloopy
2 Sep 2010, 21:42
I've been reading some of the posts at the Wormgineers forum:

As I understand it, a .tga only has one alpha channel/layer. In that layer, white (255, 255, 255) indicates solid terrain, and black (0, 0, 0) is empty space. To get the background you are talking about, fill the relevant areas in the alpha layer with light grey (253, 253, 253).

I don't know if any other shades of grey do anything. Someone should experiment!

SupSuper
2 Sep 2010, 22:26
A standard image is just 24bit, with each pixel having Red, Green, Blue values. A 32bit image has each pixel with a Red, Green, Blue and Alpha value. In regular images, Alpha defines how transparent the pixel is, but different applications can give it different uses. This is like having two images on top of one another, a regular 24bit (color) image to define the image and an 8bit (greyscale) image on top.

I don't see anything in the Worms Reloaded documentation about backgrounds though. The only valid alphas seem to be 255 = terrain with soil behind, 254 = terrain without soil behind, anything else = transparent. If bloopy is right though, depending on your editor, when you set the color of a tool it'll let you pick the alpha value, and then you just draw whatever you want as a background with alpha value 253. In other cases you can have two layers, one with the regular color image, and one with a greyscale image representing the alpha channel, which might be easier to edit. Then they just get merged into a 32bit image.

Edit: Some stuff I found:
Alpha Channel in Fireworks (http://help.adobe.com/en_US/Fireworks/10.0_Using/WS4c25cfbb1410b0021e63e3d1152b00d169-7fdd.html)
Alpha Channel in GIMP (http://www.gamedev.net/community/forums/topic.asp?topic_id=299229)
Alpha Channel in Photoshop (http://www.axialis.com/tutorials/tutorial-misc001.html)

hundreds
2 Sep 2010, 23:41
I wanted to add that I did finally get this working with a TON of help from bonz. I will put a step by step for photoshop users on here tomorrow. It will probably help a lot of people. I was wondering however if anyone knows if you can get the background image to go away when it is in an explosion. If not, it makes buildings that have been destroyed look like a bunch of hovering rooms. :)

bloopy
3 Sep 2010, 00:46
I was wondering however if anyone knows if you can get the background image to go away when it is in an explosion. If not, it makes buildings that have been destroyed look like a bunch of hovering rooms. :)
I don't think Team17 put very much thought into it. They ought to have both background that can be destroyed and background that can't be destroyed. Show them how silly the map looks and maybe they will fix it. :p

hundreds
3 Sep 2010, 02:45
Well actually, I am at a point where I am either going to do it to all of MnP's maps, or not at all. I'm gonna be running some tests this weekend with our about-to-be-released map: Family Feud. If it looks OK even though the background stays after the surrounding structure is gone, then we'll do it fr all of them. If not, then I guess it won't be something we will be taking advantage of.

Funny thing is this is actually an option I didn't even know WR could do! And it's also an option I have always wanted... it's just about perfect (except for that one issue).

bonz
3 Sep 2010, 07:33
I was wondering however if anyone knows if you can get the background image to go away when it is in an explosion.
It behaves exactly the same as the soil. You need more firepower to completely destroy it.
Try using a grenade, then use a HHG in the same hole, and you'll see that soil and custom background get blown to smithereens.

Granted, it surely would look a bit strange if your custom BG looks like the solid building, but still remains in most explosions, except the most powerful.
But on the other hand, you can see like it like structures in the far background, that simply didn't get affected.

Also, I had a nice idea how you could actually make custom backgrounds that look the same as the foreground solid structures (i.e. walls with windows, pictures, stuff,...):
Apply a blur filter over all your custom background!
Just like the blur in WR is used for the 3D background animations, only a sensibly smaller value, so that you get a nice depth effect.
I.e. foreground --> slightly blurred custom --> fully blurred 3D animations

(BTW, this is how chameleons can still achieve depth of field, even when only looking with one eye.)

hundreds
3 Sep 2010, 17:54
Yeah that blur idea did occur to me. I will be experimenting a bit with it late tonight and see what I can make of it. I think it depends on just how it is portrayed as to whether the backgrounds would look good after the surrounding ground was destroyed.

I was thinking that maybe it would behave like that (with the bigger explosions causing holes) but hadn't tested it yet.

Maybe I'm just looking for an excuse NOT to redo... Titanic, Titanic 2, Global Warming, Last Resort, Airforce One, Pit of Carkoon and Family Feud.... :(

EDIT: AGAIN