# Photoshop 6.0 help with tga files !

## Recommended Posts

I use photosphop to put a green (R:0, G:255, B:0) background on images. In my game the green disappear and becomes transparent, just like movies special effects. I use the eraser tool with photoshop to turn parts of the image into green, and I save as a .tga file. Simple. But in my game there is a black border (1 pixel) around everything that was green in photoshop. Of course this border doesn't show up in photoshop. Annoying. I managed to have one tga file that don't have that black border in the game, but don't know how I did it back then. If someone can help me... please !

##### Share on other sites
e-mail me the file at metalgearsolido8 at hotmail.com and i'll take a look.

##### Share on other sites
Are you sure it's not OpenGL or D3D adding the border? Perhaps paste the source you use to create the texture.

##### Share on other sites
Quote:
 Original post by tabyAre you sure it's not OpenGL or D3D adding the border? Photoshop doesn't automagically add things to your images.

yeah, i was going to ask the samething, but figured i'd take a look at his texture first.

##### Share on other sites
I emailed you all the stuff...

and I use D3D and here is the code :

Enable transparency :
	pDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER );	pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);

Texture creation code :
	rslt=D3DXCreateTextureFromFileEx(pDevice, imageFile, D3DX_DEFAULT, D3DX_DEFAULT,								  D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED,								  D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(0,255,0), &in, NULL, &texture);

Pretty basic..

##### Share on other sites
there is a slight white outline around everything in the ccc.tga file that is non-existant in the zombie62.tga. however other than that there is no reason for the blackoutline, i'd imagien it would be something in your code that is causing the black outline to appear. try cleaning up the white outline and see if it gives you the black outline.

##### Share on other sites
I'll check this withe outline after work and give you some feedback.
Thanks for taking some of your time to check my files !

##### Share on other sites
Quote:
 Original post by JuksosahI'll check this withe outline after work and give you some feedback.Thanks for taking some of your time to check my files !

np, and i could even cleanup the white outline for you, i just took a few minutes glance at it because i was getting ready for work, but once i get home i wouldn't mind cleanign ti up for you.

##### Share on other sites
Go ahead if you want to remove the white border. I see it in the upper part the image, but I can't see this border around the left arm, where I put some green color too.

And by the way, could you add some green spots on it (ccc.tga) ?

Just in case I messed with photoshop's configuration.

Thanks again.

Edit : I suspect the alpha channel when saving in .tga .. I'll continue to experiment.

[Edited by - Juksosah on July 9, 2007 9:19:32 PM]

##### Share on other sites
sorry i got a bit more busy than i was expecting after work. if you haven't worked on the files yet i will get around to it later today.

##### Share on other sites
I worked on them last night.

Somehow I've been able to save one of these pics with no black border showing in the game.

However I did this and it was very late. I can't replicate what I did that night. Somthing like that : I must remove the backgound in a .psd file, but I must leave it transparent instead of green. After well can't remember.

It's definately photoshop.
If you could just send me any .tga pic you saved with photoshop containing green color, I could test it in my program to see if a black border appear. thanks.

I am going nuts with this.

##### Share on other sites
ok, i sent you some altered files. however since you gave me one file that works and another that didn't here are some things that i noticed that differed.
1.)white outline in the one that shows a black outline, my files i sent you fix this.
2.)both saved as rgb, 8 bits per channel, and 3 channels total (24 bit tga), so there is no alpha channel to worry about in figuring out the problem.
3.)one very important fact is that nearly all video cards through some hardware requirement highly prefer textures to the power of 2 (it may or may not be a hardware requirement, i'm not a programmer). the one you gave me that works is 256x256, the one you gave me that shows up in the game but has a black outline is 330x400, which is not to the power of 2.
power of 2 res goes like
8x8, 16x16, 32x32, 64x64, 128x128, 256x256, 512x512, 1024x1024, 2048x2048, or in combos of each other like 256x32, 1024x512...etc

so try making your textures in the power of 2 and see if that fixes the problem or not.
beyond this my only other suggestion would be the generate transparency through the use of an 8 bit alpha channel to store the transparency info.

##### Share on other sites
You're not a programmer, but you're a darn good debugger :)
Yep I was suspecting alpha channel, but I did not use one by saving in 24 bits/pixels.

And as soon as I reduced my image to 256X256, guess what ?

no more black border !!

And the files you sent me were showing black borders. (they were 330X400)

I could have spend weeks before finding this.

You saved me a lot of time. I couldn't thank you enough for this.

##### Share on other sites
Quote:
 Original post by JuksosahYou're not a programmer, but you're a darn good debugger :)Yep I was suspecting alpha channel, but I did not use one by saving in 24 bits/pixels. And as soon as I reduced my image to 256X256, guess what ? no more black border !! And the files you sent me were showing black borders. (they were 330X400) I could have spend weeks before finding this. You saved me a lot of time. I couldn't thank you enough for this.

oh, its np really, you can ask me anytime you have any questions/problems and i'll see if i can help.