Sign in to follow this  
Juksosah

Photoshop 6.0 help with tga files !

Recommended Posts

Juksosah    130
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 this post


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

Share this post


Link to post
Share on other sites
Jarrod1937    522
Quote:
Original post by taby
Are 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 this post


Link to post
Share on other sites
Juksosah    130
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 this post


Link to post
Share on other sites
Jarrod1937    522
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 this post


Link to post
Share on other sites
Jarrod1937    522
Quote:
Original post by Juksosah
I'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 this post


Link to post
Share on other sites
Juksosah    130
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 this post


Link to post
Share on other sites
Juksosah    130
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 this post


Link to post
Share on other sites
Jarrod1937    522
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 this post


Link to post
Share on other sites
Juksosah    130
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 this post


Link to post
Share on other sites
Jarrod1937    522
Quote:
Original post by Juksosah
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.

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this