TIM file with black as main sprite color

Graphic based area of development (Graphics Processing Unit), including the Geometry Transform Engine (GTE), TIM, STR (MDEC), etc.
Post Reply
jman
Rookie Programmer
Rookie Programmer
Posts: 110
Joined: August 13th, 2013, 7:58 am

TIM file with black as main sprite color

Post by jman » October 28th, 2013, 8:42 am

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
You do not have the required permissions to view the files attached to this post.

isufje
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 63
Joined: April 11th, 2012, 2:33 pm

Re: TIM file with black as main sprite color

Post by isufje » October 28th, 2013, 9:02 am

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

User avatar
LameGuy64
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 360
Joined: April 10th, 2013, 3:47 pm
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Skype: lameguy64
Location: Philippines

Re: TIM file with black as main sprite color

Post by LameGuy64 » October 28th, 2013, 11:32 am

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.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2252
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: TIM file with black as main sprite color

Post by Shadow » October 28th, 2013, 12:58 pm

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
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

Development Computer: Windows 98, Pentium 3 [400MHz], 128MB SDRAM, DTL-H2000, DTL-H201A, 21" Sony Trinitron CRT, CD-ROM burner, 3.25" and 5.25" Floppy Diskette Drives and a ZIP 100 Diskette Drive.

User avatar
inc^lightforce
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 145
Joined: March 7th, 2013, 7:34 am
I am a: Programmer, Artist, Gamer
PlayStation Model: Black
Skype: a5recordings
Location: Germany
Contact:

Re: TIM file with black as main sprite color

Post by inc^lightforce » October 28th, 2013, 11:04 pm

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:
You do not have the required permissions to view the files attached to this post.
Last edited by inc^lightforce on October 29th, 2013, 11:10 am, edited 1 time in total.
my coding page/ forum at:
http://aftermath-creations.net/

jman
Rookie Programmer
Rookie Programmer
Posts: 110
Joined: August 13th, 2013, 7:58 am

Re: TIM file with black as main sprite color

Post by jman » October 28th, 2013, 11:43 pm

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?

User avatar
t0rxe
C Programming Expert
C Programming Expert
Posts: 140
Joined: December 19th, 2012, 8:08 pm
IRC: t0rxe
Motto: /\OX[]
PlayStation Model: SCPH-5502
Location: Australia

Re: TIM file with black as main sprite color

Post by t0rxe » October 29th, 2013, 12:53 am

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
You do not have the required permissions to view the files attached to this post.
"Nostalgia isn't a big enough word to describe the PlayStation from my eyes"

AmiDog
Active PSXDEV User
Active PSXDEV User
Posts: 53
Joined: September 7th, 2012, 11:51 pm

Re: TIM file with black as main sprite color

Post by AmiDog » October 29th, 2013, 10:52 pm

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.

AmiDog
Active PSXDEV User
Active PSXDEV User
Posts: 53
Joined: September 7th, 2012, 11:51 pm

Re: TIM file with black as main sprite color

Post by AmiDog » October 29th, 2013, 10:57 pm

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 :-)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest