Alpha Goat

I’ve been running into a very strange problem when creating alpha-blended shaders using images from GIMP. See for yourself…

Among the graffiti on the right, only the “sheep” and “resist” ones appear correctly. All others have a strange silver outline effect, despite all images being created in one go, from the same source image, and all of them obviously having alpha channels. All shaders were copy/pasted with just the .tga names edited to fit.

Sure enough, in Radiant, only the graf_sheep and graf_resist images appear with a black alpha channel.

So I loaded all of them into Gimp and compared, after making sure all the shaders were identical apart from the image filenames.  There was no obvious difference, and all of them had an alpha channel that appeared correct.

After some experimentation, it turns out that Gimp doesn’t always export the alpha channel correctly when saving a TGA, but pretends it did. The only way to make damn sure your TGA ends up with a correct alpha channel seems to be this:

That’s right, create a new, transparent layer, move it to the bottom, and merge your old transparent layer downward. Duh. Then re-export. And sure enough:

All of them now show up black (meaning alpha channel, and black foreground in this case) in Radiant. Let’s check in game…

Fixed. What the heck, GIMP?

Gremlins strike again!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: