Talk:Alpha

From Valve Developer Community
Jump to: navigation, search

My mistake with the combine forcefields.--TheJ89 21:31, 16 Jul 2005 (PDT)

What you say? --Andreasen 14:08, 15 Nov 2006 (PST)

I can't get Photoshop to save my Targa with several layers, meaning I can't make alpha Targa. Can it REALLY be done, and if so, how? --Andreasen 14:08, 15 Nov 2006 (PST)

Its not layers, its a channel. I forget photoshops ahndeling of it, but theres eithier the RGB channel, you need to then add an Alpha Channel and paint in that. -OR- it will take it form the transparency of the only layer you have. --Angry Beaver 16:04, 15 Nov 2006 (PST)
Ah, thank you. That might explain it. You see, I have Photoshop Elements, and Photoshop Elements only seem to be able to handle layers, and not channels. Do you know any picture editors that one can use for free that can handle alpha targas? --Andreasen 05:27, 16 Nov 2006 (PST)
GIMP should be able to handle it. I'm not sure, I use Painshop Pro. Are you sure you can't just create a transparent image, an image without a background, or delete the background layer? —Kateye 09:37, 16 Nov 2006 (PST)
Oh, you're right: You can apparently create a NEW layer, then choose transparency for it, press <Delete> to delete the contents, and then remove the first (background) layer. You can then paint a texture on this new transparent layer. You can even use brushes with different Opacity settings (with 1% as minimum Opacity). Strange, because the pages I read told me that alpha could only be simulated in Photoshop Elements. I'll test it and see if the transparency saves correctly. (Photoshop has apparently been known not to handle especially targa alpha.) --Andreasen 11:15, 16 Nov 2006 (PST)
You'd be surprised how often the pages found for Google can be wrong. It's infuriating. Those of us who know the "right" way don't realize that an article needs to be said, or we're not on the boards where the question is asked. I have some horror stories about methods people have suggested and I found on Google, most of which were broken, hugely long and broken, hugely long and a backward compatibility nightmare, and all of which tend to be replaced by a single line of code. </Tangent> Anyway, be sure to actually test the texture in-game, as I was frustrated for a while by the fact that the texture viewer I was using didn't show the transparency. It wasn't until I actually just tried it that I realized it had been working all along. Although personally I've found PNGs to be better for saving, then convert the PNG into a TGA or use a texture tool that can import PNGs. —Kateye 11:36, 16 Nov 2006 (PST)
Well it's confirmed: Photoshop Elements will not save transparency (full or partially) for targa format (24 bit or 32 bit). It will convert it into white instead, and this will still be white in Hammer (even if "$translucent" 1 is specified). --Andreasen 11:49, 16 Nov 2006 (PST)

I can't seem to get the opacity of the alpha portions of my texture to display properly in Source. The alpha is in the VTF and working fine, first I tried using $translucent to display it, but it had that problem where it renders the model out in a weird state where you can see through the entire model. I then tried to use $alphatest instead, which fixed the display issue, but renders the texture completely opaque with the alpha portions completely transparent, instead of varying levels of translucency (the texture is dirty glass). Is there any way around this? --Sitruss 17:45, 22 Jul 2007 (PDT)

Saving alpha in GIMP

The article says that GIMP can handle alpha, but there's one very important piece of the puzzle missing. You can't embed a mask into a normal map (for phong/specular) if means erasing the RBG data! Has anyone worked this one out? --TomEdwards 07:09, 22 Feb 2007 (PST)

Solved: set the background alpha to 1%. The result doesn't look any different, and the RGB channels are saved normally. --TomEdwards 10:33, 22 Feb 2007 (PST)
I think it might just be a misfeature involving the RGBA channel thumbnails - I created a vaguely similar image, saved to TGA and loaded again, and things appeared similarly 'broken'. I then did a decompose-to-RGBA, and discovered that the contents of the channels were in fact entirely correct. This is with Gimp.app 2.2.11 on MacOS X, incidentally - no idea what Windows version you're running, but it might be worth updating.
Actually, playing around - the red, green and blue channel previews appear to display multiplied by the alpha channel component. Additionally, the previews aren't immediately updated when you apply a layer mask - you need to do some more editing, or hide then show one of the channels, for them to update. It does seem to be a bug, in that the RGB channel previews are showing the alpha channel too - but no data appears to be lost. Could be a good bug to report, anyway! —Cargo Cult (info, talk) 11:17, 22 Feb 2007 (PST)
Data was definitely being lost for me: when I imported the file to VTFEdit there were areas of pure black. Did your image have transparent pixels, or only translucent ones? GIMP (2.1.3/Win) only removes RBG data for fully transparent pixels, which is why my fix works.
Incidentally, we really need a unified texture editing system. Over the past couple of days every time I've needed to see something in-game I've had to fiddle around with five layers in an image editor then fiddle even more converting into VTF. It'd be wonderful to be able to hit Ctrl+S and have everything slot into place. --TomEdwards 11:49, 22 Feb 2007 (PST)
This should work - open it in The GIMP, do a Filters : Colors : Decompose... to RGBA, and see what you get. The resulting layers for red, green and blue should be simple gradients, with no text on. The alpha channel goes from 0 to 255, with probably everything in-between. If things look weird in VTFEdit with that image, then it might actually be a VTFEdit bug! —Cargo Cult (info, talk) 12:26, 22 Feb 2007 (PST)
That's an image full of translucent pixels. Erase a 100% transparent hole in the middle of it, save, then switch to Channels and you'll see the problem I was having. --TomEdwards 14:00, 22 Feb 2007 (PST)
Done just that in the latest Windows version of The GIMP - and the channel previews are still 'wrong'. Do a decompose-to-layers, and see what the channels actually contain. VTFEdit opens the files just fine... —Cargo Cult (info, talk) 14:41, 22 Feb 2007 (PST)
You're right, now I look a little closer. This is what I get when I save though. --TomEdwards 15:02, 22 Feb 2007 (PST)
I think your problem is that you're running a development version from summer 2004, when an up-to-date version might work better. Your version is so old, the current changelog doesn't go back that far. ;-) —Cargo Cult (info, talk) 15:18, 22 Feb 2007 (PST)
I meant 2.2.1.3. They should use Steam. ;-) Anyway, I've pinned this down to bug with layer mask and the Clear command: if I use the eraser there's no problem even at full transparency. That's even less intuitive than the layer mask though! What's really needed is a way to save one layer as the alpha of another..? --TomEdwards 03:36, 23 Feb 2007 (PST)

I've got this one by the nose now. It's related to flattening layers: you'll notice that Adam's image had one layer and wasn't affected, while as I've mentioned before mine had five. I've reported the bug here, if anyone wants to keep track. --TomEdwards 08:24, 24 Feb 2007 (PST)

Bah. Not only will they not fix it, they make no guarantees that future releases won't remove the RGB information in all cases of transparency. If you're using GIMP for alpha masks, you're working on deprecated code. Any future VTF plug-in might not be able to work around the issue either, because from my understanding the RGB would be removed before the data was passed to it. --TomEdwards 09:44, 24 Feb 2007 (PST)
I can see it now. Gimp as the foundation of the Valve Texture Editor. The normal map, normal mask and exponent map (or at least as many of those as are relevant) along with a live 3D preview in a 4-way workspace. Paint a mask onto the model in real-time and save direct to VTF. Automatically unwrap the polys onto the sheet: that would make it worth building alone! I just wish I could program... :-p --TomEdwards 10:33, 24 Feb 2007 (PST)

You appear to have met the famously obtuse developers of The GIMP - for whom 'go write the patch yourself' is their friendliest possible gesture. Heaven forbid that the users might be interested in graphics, not programming...

Anyhow. I've found a set of doodahs which do a nice, colour-preserving layer merge - and am currently attempting to write a script-fu thingy to do it automatically. However, Scheme hurts my brain. (bg-layer (aref layer-array (- num-layers 1)))) my arse. What happened to user-friendliness? Argh! —Cargo Cult (info, talk) 11:53, 24 Feb 2007 (PST)

Steve Jobs has no dominion here. --TomEdwards 13:07, 24 Feb 2007 (PST)
BTW, I think someone's already done it. His script saves to My Pictures instead of the XCF's folder, though. --TomEdwards 01:33, 25 Feb 2007 (PST)

Alpha now is fully supported in new versions of GIMP. --Motherfat 20:46, 6 August 2012 (PDT)