Friday, June 7, 2013

Step 7: be careful with TIM files

This is what happened when I loaded the city map:

As you can see the translation is there but the background textures are not properly loaded.

This is how the textures should look like:

I think I know why is this happening. Let's talk about TIM files. A TIM file is a picture file used by the PSX system. It could be an indexed picture, that means that it is possible that a particular TIM file has its own color palette or CLUT (color look-up table). Most of the TIM files that I have translated only have one CLUT, but in this case this background have 3 different CLUTS:

First CLUT, as you can see there is a palette consisting of 16 different bluish colors.

Second CLUT, yellowish colors.

Third CLUT with redish colors.

As I said before, I'm using Photoshop + the TIM plugin to edit these files. When Photoshop saves the file for the first time, a little window shows up:

As I said before, you have to keep all the original information and do not modify certain things, otherwise that will cause problems. As you can see in the picture above, there are certain things that we have to keep in mind, specially the CLUT section. The width is 16 ( the 16 color palette that I've showed you before), but the height is only 1, where it should be 3 (3 different CLUTs, so 3 different rows). So when you save this file, you have to delete the 1 and put a 3 instead, otherwise you will lose the 2 remaining CLUTs and that will cause the problem that you see in the city map.

There is a second picture that has several CLUTs, which is this one:

This picture has 8 different CLUTs, so you will have to delete the 1 and put an 8 instead when saving the file:

So this is what happens when I save the file properly:

It looks like the first and third CLUTS are mixed up.

Let's compare the original file VS the modified files in order to see where the problem is:

In this pictures the CLUT colors are the same, but the size of the pixels have changed, so I suspect that this is causing the problems.

In this picture the CLUT is ok in both files.

And here we have the same problem as before, the CLUT colors are ok but the size of the pixels have changed.

I don't know how to fix this so if you have a suggestion please let me know. For your information, the letters should look like this:

Update: I managed to fix this somehow. I discovered that the first CLUT controls the colors of the characters when they are not selected, so they show in blue color. The second CLUT controls the colors of the characters when they are in fact selected, so they show in yellow color.

Finally the third CLUT controls the background behind the letters and also shows again the characters, and that's why the characters were showing duplicated in here:

So the solution was quite easy: we need to have the same CLUT colors both in CLUT 1 and 3, that way the background will show up correctly. One last thing, I didn't like the duplicated characters, so I removed the letters in CLUT 3 by assigning them the black color.

Here you have the final result:

Not bad, huh?

No comments:

Post a Comment