Jump to content

Working with the Alpha channel - a moders nightmare


Recommended Posts

I have spend nearly a week now trying to create some new explosion effects. This becomes really a nightmare for me! The explosion shall be transparent, what works okay in the midle of the explosion image, but terrible at it's edges! While I'm working with the pictures (in Gimp, BTW) everything is perfect. When I save the image as 32-bit RGBA BMP, it looks like the edges are cut off in the Windows preview, in Paint Shop as well as in CMSF. When I load the picture with Gimp again, it still looks perfect. When I save the same picture in TIF file format, it still looks perfect even in the stupid Windows preview.

What am I doing wrong? Or is the BMP format simply not the best format for transparency? Can somebody enlighten me, please? :(:(:(

Link to comment
Share on other sites

I haven't been able to make heads or tails of how the game uses Alpha channels. In most of the texture files I have tried, including any alpha mapping wipes out the entire texture in game. I somehow managed to get parts of the vest to disappear using GIMP, but my attempts to replicate that in GIMP or Photoshop CS3 meet in failure (the entire texture vanishing).

Link to comment
Share on other sites

I've been using GIMP aswell and had some problems with disappearing textures in the beginning, but the alpha channels do work fine for me now - apart from the "skeleton" of objects still showing when applying alphas to models where there should be solid textures.

When I want to delete certain parts of a texture, I usually first add an alpha channel, then simply cut out the parts I don't want and save it as 32bit bmp.

I haven't worked much on semi-transparent textures, but you should try using the alpha channel as the background and then add the explosion texture as a new layer on top of it and ajusting opacity.

Or perhaps you have assigned a color to an alpha channel which is used in drawing the edges of the explosion and therefore disappears?

Link to comment
Share on other sites

Scipio,

Just a thought; when working on explosions and things with semi-transparency in video and especially at edges of opacity, to get a seamless smooth transition from texture to background the edges really need to be pre-multiplied, usually with black; software then either does an "add" or "screen" type overlay and this black-mixed edge disappears into the background.

Looking at the SF explosion .bmp files the the alpha is very soft at the edges of the white - black transition, so am wondering, and please excuse if I am sounding patronising, I don't mean to be but is your alpha channel by itself ranged from white to black through lots of shades of grey or is it just black and white?

I only ask coz that would explain the hard egdes totally and would also explain why inm one case your image preview looks OK coz it's previewing on a black background and the other case where it's previewing with the alpha channel which is only and on/off 100% with no semi-transparent grey areas at the edges.

If you want to upload a frame from the image in question am happy to take a look at it for you.

PS And you're correct in that .bmp probably isn't the best format to handle transparency; tif and tga are the more usual texture formats with alpha channels yes.

Link to comment
Share on other sites

I haven't been able to make heads or tails of how the game uses Alpha channels. In most of the texture files I have tried, including any alpha mapping wipes out the entire texture in game. I somehow managed to get parts of the vest to disappear using GIMP, but my attempts to replicate that in GIMP or Photoshop CS3 meet in failure (the entire texture vanishing).

ND; have gone through every possible mode of saving BMP and alphas and do indeed concur some textures just aren't set up to handle the alpha no matter how it's presented.

This leads me to consider whether the actual material applied at modelling stage is ignoring it. All of the 3d modelling softwares I use, a material has to be explicitly defined to use either the alpha for transparency or RGB intensity, otherwise it is ignored. This may be why some SF bmp files make use of it [windows,balconies, etc.] and some don't. If the modeller did not specifically flag the material to use the textures' alpha channel then it wont neccessarily show up on screen.Which OK, doesn't help, but it may be an explanation as to why and thus we can't do anything mod-wise about it. Which also doesn't explain how you got the work-around of the parts of a single bmp file to disappear.

Link to comment
Share on other sites

I have a suspicition why my bmp loose quality in CMSF, while the same file still perfect in Gimp. Is it possible that Gimp can save files in v4 or v5 bitmaps? This late versions of the windows can handle transparency much better; v5 can even be used as container for a TIF. Programms that doesn't support v4/v5 bitmaps can still read them, but ignore everything that's beyond the standard v3 bitmap.

As I said, that's just a suspicion, I've found this infos when I googled fo a solution...

missinginreality, I'll prepare a zip for and upload it on my site. BTW, I guess it's important to mention that the original source is a dds file from 'Crysis' ;)

Link to comment
Share on other sites

ND - Yep would love to see the one that works; I'll PM you my email address.

Scipio, thanks for those; yes it looks like the edges of the matte are pretty hard i.e the alpha channel doesn't grade to transparent gently but goes from black to white over a short space of pixels; try running a gaussian blur or radial blur on the alpha channels of each frame to soften it out a bit that may help? You may lose a bit of detail at the edges but in essence thats what you need to do anyway.If you look at the original SF explosion frames you'll see what I mean about being soft at the edges.

Link to comment
Share on other sites

Well am well am truly stumped on this one ND [bTW, apols to Scipio for the partial hijacking of your thread on the explosion mate; but it's a relevant discussion on Alphas too I guess]:

Thanks for the files ND; most illuminating.

OK so after some exhaustive testing [and boy a 3d image viewer for BF models would save a lot of time :)] here's what I found;

yes amazingly your vest texture works great.

And if I duplicate your alpha channel onto another texture and re-save it works great too.

And if I delete your alpha on your vest texture, make exactly the same alpha and re-save..guess what..doesn't work!!

Something very very odd going on here. It's like, your actual Alpha channel works, thus duplicating it to another image works. Hold onto that mate it's gold dust!!

So am officially out of ideas but determined to get to the bottom of this..maybe one of the original modellers can help? Got to do some work for a bit but will come back and try an few more things later.

Link to comment
Share on other sites

hahahahhahahaha man I am dancing here - nailed it :)

OK, oh wow, it's such a simple thing!

Check your alpha on the file you sent me - see how the edges of the black aren't anti-aliased? That's all there is to it!!!!

I'm guessing the bmp alpha channel can only be black or white, nothing in between. OK, that goes against the explosion bmp files however, but they probably use [i'm guessing] and overlay mode when drawing so it'll work OK.

But for some reason the uniform textures are just drawn one on top of the other with no compositing, hence the alpha is only recognising black and white and anything in between stuffs it.

So, when drawing selections for alphas on uniform textures don't use feathering or anti-aliased selections; it means jagged edges but small price to pay and anyway hardly noticeable.

Man I am stoked :) OK, really have to do some work now :)

Link to comment
Share on other sites

Emails and files sent.
ND, the file you've sent uses transparency with hard edges, but that's not the problem I have. In my case are the fine structures replaced with hard edges. :(

Scipio, thanks for those; yes it looks like the edges of the matte are pretty hard i.e the alpha channel doesn't grade to transparent gently but goes from black to white over a short space of pixels; try running a gaussian blur or radial blur on the alpha channels of each frame to soften it out a bit that may help? You may lose a bit of detail at the edges but in essence thats what you need to do anyway.If you look at the original SF explosion frames you'll see what I mean about being soft at the edges.
Can you please gimme advise how to do that in Gimp? I can't figure out how to select the Alpha channel as layer, or how to copy the alpha channel from one image to another. :(

But obviously there must be a way - as you have mentioned it works in the original explosion...

Link to comment
Share on other sites

Can you please gimme advise how to do that in Gimp? I can't figure out how to select the Alpha channel as layer, or how to copy the alpha channel from one image to another. :(

But obviously there must be a way - as you have mentioned it works in the original explosion...

Hmm I've not used Gimp - but in Photoshop it has a separate Channels tab, separate to the layers - you'll have a Red, green, Blue and any additional channels as alphas. In Gimp it's under Channels dialog [FILE/DIALOGS/CHANNELS].

SEE http://docs.gimp.org/en/gimp-channel-dialog.html

Clicking on just the single channel will only apply any transofrmations you make to that channel only, so click on your alpha channel to select it by itself then apply the blur to that.

Link to comment
Share on other sites

I guess you guys have figured all out already.

Alpha channel can only be black or white. No gray scale values. Things are either visible or transparent. If you have a single gray pixel there, it won´t work.

The places where variations in transparency appear in the game are hard coded. So it will probably be more complicated to mess with the Alpha Channel in those cases.

-

Link to comment
Share on other sites

I guess you guys have figured all out already.

Alpha channel can only be black or white. No gray scale values. Things are either visible or transparent. If you have a single gray pixel there, it won´t work.

The places where variations in transparency appear in the game are hard coded. So it will probably be more complicated to mess with the Alpha Channel in those cases.

-

Okay, thank for explaining this. If I understood you correct, the Alpha channel defines in simple words only 'visible' or 'not visible'. If the visible part of a texture is semi transparent (such as an explosion) is hardcoded!?

What I still do not understand is: why are the edges of my explosion cut off in CMSF, but look as soft as they should be when I open the same file in GIMP??

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...