Trouble with TGA alpha transparencies, need an easier way.


#1

Hello,

I’m currently on a project that require TGA format to make transparencies on textures rather than PNGs. While I understand the way to do the TGAs transparencies and the reason why we need it, my results in the end are always disappointing because I use a lot of effects like glow and opacity in my graphics.

The trick I use is to select my layer (ctrl+click on the layer) and paste the mask in the alpha channel. It look accurate from the alpha channel, but when I test in my software (flash), the effects like glow and opacity are very inaccurate, like very dim. To remedy this, I have to duplicate several time the same layer that contain my graphic to make the effects appear correctly. Sometime It difficult to deal with very mixed alphas on graphic objects that have either opacity variations in center and glowing effects on the outside, it time consuming.

So I ask if you know a better technique to make an alpha (or texture) more accurately without having to guess a bit how you render the texture or alpha near to the desired result.

Thanks.


#2

you have a sample of whats the issue


#3

Ok sorry for the long delay. I found my solution for my problem. I use GIMP now to transfer transparent PNG into TGA, or I can just replicate my layers 20 times.


#4

It looks like a transparent black pixel is being treated as a gray pixel when output. Having the same thing happen with tif and png. Even web output png with a matte of black, the shadow seems to have turned to gray. Stack up a bunch of gray on multiply and you get black so that 20x solution “works” but probably kills the soft edges in the process.

BTW, I’m doing my testing by applying the images to simple planes in 3ds max with alpha output from image alpha.

I think this is where the term “pre-multiply” may come in to play. I’m having a poke at PShop to see if I can find anything on it.

Hm… here’s a hack that might work… didn’t work and I don’t get why. So much for that bit where everybody hails me as a hypergenius.

OK, the problem with Max is twofold - PShop does seem to comp the TGA on a white background if there is no background. So I threw in a black layer behind my layer. Worked fine.

AND in Max I had “alpha from image alpha” turned on. That was a nono.

I suspect this won’t solve your problem. Maybe the extra black layer will help.


#5

This is actually an old problem - the only version of Photoshop ever to save Transparancy in a 32bit TGA was Photoshop 7 - because this confused most users, they ‘solved’ the behaviour in 7.01. If you can get your hands on the v7 TGA export plug-in, it might still work like you want it to.

Gimp works just fine for this conversion, as you discovered yourself. For automation you might want to try ImageMagick.

Photoshop’s internal handling of alpha channels when saving TGA images is somewhat odd, in my opinion. It seems alpha channels are also colour managed, so the greyscale values of those change when saved: not something you want for textures and game graphics. I did quite a bit of research on the web, and, basically, a lot of people are thrown off by Photoshop’s behaviour in regards to TGA and alpha channels. The general solution seems to be to just AVOID using Photoshop to create the alpha channels, and use a secondary tool, such as Gimp, when doing anything game graphics related.

The following steps got me close to the result I wanted:

Color Settings:

  • turn off colour management for rgb (switch to monitor rgb --> turns off cm)
  • switch gray to sgray

Next:

  • with a transparent background, select the parts you wish to save as tga.
  • use EDIT–>COPY MERGED
  • create a new file, and paste.
  • ctrl-click the layer to load selection based on pixels
  • save selection as channel
  • add a background layer with R:232 G:78 B:242
  • merge the two layers.
  • save a 32bit tga.

Now, when I tried loading this tga in Flash, it almost resembled the original’s transparency, but still did not completely clone it. It was too dark in some areas.

Gimp worked like a charm. I do feel this is buggy behaviour in PS. The post below is an interesting read: they used a hex editor to check the actual values of the TGA alpha channel produced by Photoshop, and they were rounded off, changed from the original’s alpha channel - which means PH is messing with the values in some way. It would be welcomed if anyone else can shed some light on this issue. I tried messing around with the colour management, but it did not really make a lot of a difference.

http://forums.adobe.com/thread/368889?start=0&tstart=0

Thanks for the question - if I ever have to use TGA again for game design, I will use Gimp to do the conversion for me - at least that works as expected with totally controllable results.


#6

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.