Page 1 of 1

TIM file with black as main sprite color

Posted: October 28th, 2013, 8:42 am
by jman
Hello,

while I think I've a firt grasp on importing TIM files, I still don't undestand if it's possible to convert an image such as the one attached.

I would like to be able to "pierce" and discard the white background and keep the black as main color of the sprite: is it possible? How? I tried various import settings with TIMTOOL (check/uncheck the Semi Transparent options in TIMTOOL, create an alpha mask image, ...) to no avail.

Thanks

Re: TIM file with black as main sprite color

Posted: October 28th, 2013, 9:02 am
by isufje
as a 4/8/or 16-bit image?

wait a minute... there are only two colors in your image o_O

For a 2 color B & W image

Dude, just paint it white and use code to change the color into anything u want... really

Re: TIM file with black as main sprite color

Posted: October 28th, 2013, 11:32 am
by LameGuy64
The PlayStation uses pure black (RGB 0, 0, 0) as the transparent color. So, if you want to put black colors on your texture without making it transparent, make it 12 shades brighter than pure black.

Re: TIM file with black as main sprite color

Posted: October 28th, 2013, 12:58 pm
by Shadow
You can even go as low and make it RGB 1, 1, 1.
The human eye wont even be able to receptor if that's 'true' black or not :D

Re: TIM file with black as main sprite color

Posted: October 28th, 2013, 11:04 pm
by inc^lightforce
a near black avatar is possible.
how LameGuy64 said: the PSX is setting r0 g0 b0 to full transparent.

that's the rule of PS1 GFX usage made by SONY.
You can also manipulate the colour with code like mine:
this one is taken from my workshop and manipulates the color of the used Font Scroller

Code: Select all

sprLetter.r=111;   // change the Color of your Font --> 0 is black & 255 is white
sprLetter.g=143;   // change the Color of your Font --> 0 is black & 255 is white
sprLetter.b=37;      // change the Color of your Font --> 0 is black & 255 is white
in your Case define the avatar as Sprite like this:

Code: Select all

extern char avatar[];   // read external Information of GFX or Sound or what ever
GsSPRITE   sprAvatar;

LoadTIMData((u_long*)avatar);
SetSpriteInfo(&sprAvatar,(u_long)avatar,80,119,3);//x,y

sprAvatar.r=14; // change the Color of your Font --> 0 is black & 255 is white
sprAvatar.g=14; // change the Color of your Font --> 0 is black & 255 is white
sprAvatar.b=14; // change the Color of your Font --> 0 is black & 255 is white


try this one:

Re: TIM file with black as main sprite color

Posted: October 28th, 2013, 11:43 pm
by jman
inc^lightforce wrote:near black avatar. LameGuy64 said: the PSX is setting r0 g0 b0 full transparent.
that's the rule of PS1 GFX usage made by SONY
Thanks everyone for your answers.

I wanted to be sure that [0,0,0] is a "reserved" color and thus not safe to use.

I also think that is completely useless to create source images as PNG with an alpha channel because it will be discarded anyway once imported into TIM, am I right?

Re: TIM file with black as main sprite color

Posted: October 29th, 2013, 12:53 am
by t0rxe
If I remember correctly, the alpha channel in PNG images once imported get's converted to RGB 0, 0, 0 automatically, thus making it transparent.

You can see I'm using a PNG. JPEG's also work well in some situations, but I prefer BMP over PNG for TIMTOOL.
Image

Re: TIM file with black as main sprite color

Posted: October 29th, 2013, 10:52 pm
by AmiDog
Shadow wrote:You can even go as low and make it RGB 1, 1, 1.
The PSX uses 5 bits per component, so the lowest you can go is 8 (if the scale is 0-255), and yes, you can tell the difference between such a color and black. Atleast if you also have some real black present to compare it to.

Re: TIM file with black as main sprite color

Posted: October 29th, 2013, 10:57 pm
by AmiDog
jman wrote:I wanted to be sure that [0,0,0] is a "reserved" color and thus not safe to use.
The single alpha bit is also important. The PSX will only skip texels with A = R = G = B = 0. So unless you use blending, just set the alpha bit and you have real black, it's only when you use blending that you need to set one of the R,G,B components to non-zero to have an opaque "black" color. (When blending is enabled, texels with A = 1 will be blended while texels with A = 0 will be opaque.)

edit: That Tim Tool screenshot actually explains the behaviour quite well :-)