Page 1 of 1

Convert TIM to BMP and Retain Semi-Transparency Data

Posted: February 13th, 2019, 7:04 pm
by zanneth
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

Re: Convert TIM to BMP and Retain Semi-Transparency Data

Posted: February 13th, 2019, 11:20 pm
by Yagotzirck
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

Re: Convert TIM to BMP and Retain Semi-Transparency Data

Posted: February 14th, 2019, 3:07 pm
by zanneth
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!