Convert TIM to BMP and Retain Semi-Transparency Data

Graphic based area of development (Graphics Processing Unit), including the Geometry Transform Engine (GTE), TIM, STR (MDEC), etc.
Post Reply
User avatar
zanneth
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Sep 04, 2018
I am a: Programmer, Reverse Engineer
PlayStation Model: sys573
Contact:

Convert TIM to BMP and Retain Semi-Transparency Data

Post by zanneth » February 13th, 2019, 7:04 pm

Hello!

I'm trying to hack an arcade game called "Dance Dance Revolution EXTREME" which uses PSX-based hardware called the System 573.

I'm trying to modify one of the TIM files that is included with the game. To do this, I am converting the TIM file into a BMP, modifying the BMP in Photoshop, and then converting it back to TIM.

However, I noticed that no matter which program I use to convert the TIM to BMP, I seem to lose all of the black pixels surrounding the sprites when it's rendered in the game.

I think this is because most of the TIM file is comprised of transparent pixels, but these are converted to pure black with no alpha channel in the BMP. Therefore, all of these black pixels are lost during the re-conversion. I've tried "Tim utility", "PSicture", and "TIMViewer" to convert this, but all of them reproduce the same issue.

Here is the resulting BMP that I converted from the TIM file.
Image

Here's what TIM TOOL sees in the preview. Clearly it knows about these black pixels because it is compositing them on top of a teal background.
Image

Unfortunately I can't find a way to make TIM TOOL itself convert to BMP or PNG or anything. I don't think this is a supported feature.

How do I modify this TIM file without losing these black pixels?

Thanks!

P.S. If anyone wants to look, here is the original TIM file:
http://zanneth.com/junk/gmob_25.tim

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » February 13th, 2019, 11:20 pm

http://www.psxdev.net/forum/viewtopic.php?f=51&t=953
If the only transparencies involved are either full or 50%(mode 0) it should be trivial to code an ad-hoc converter (I could do it myself later on); if it has only full transparency all you'd have to do is check the palette's index corresponding to full black with STP bit unset (usually the 1st entry) and put an alpha value of 0 in there and 255 for all the others, or if it's an high color image scan all the pixel entries and do the same thing.

On the other hand, if it uses one of the modes from 1 to 3 the best you can do is doing an approximation like I did in that thread as far as I know (maybe someone more knowledgable than myself could tell if there is a more accurate conversion method for modes 1-3, but I highly doubt so).

EDIT: Disregard all the gibberish above - Tim2View with "Black Transparence" option seemed to work just fine:
Image
You do not have the required permissions to view the files attached to this post.

User avatar
zanneth
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Sep 04, 2018
I am a: Programmer, Reverse Engineer
PlayStation Model: sys573
Contact:

Post by zanneth » February 14th, 2019, 3:07 pm

Yagotzirck wrote: February 13th, 2019, 11:20 pm EDIT: Disregard all the gibberish above - Tim2View with "Black Transparence" option seemed to work just fine:
Image
You are my hero! Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests