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 these 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?

12 comments:

  1. Instead of changing the color of CLUT 3, I checked the box for "Except black -> Translucent" when saving it in Photoshop and changed the overall file transparency in tim2view to "Full transparence". I don't know if it was one, the other, or both in tandem that solved it, but regardless it worked for me.

    ReplyDelete
  2. I don't know if you're still active on this page, but I have a question regarding the TIM plugin for photoshop.
    I have it installed and it's working now.
    The issue is with tim files with more than one clut, how do I edit them in photoshop, because I can only see the first one and I don't know how to get the other one to appear ?
    Any help would be very much appreciated.

    ReplyDelete
    Replies
    1. Hi HibotanCreations,
      Unfortunately the TIM plugin does not handle well multiple CLUTs. I recommend you to use tim2view and its import/export features.
      Regards.

      Delete
    2. Oh Alright,
      I'm using Tim2view myself already for a while, but the issue is that when I import a tim, it replaces the entire clut as well.
      How can I then replace 1 specific clut, and not the entire tim file ?

      Delete
    3. Try to restore the original CLUT with an hex editor, it's a simple copy-paste operation. Regards.

      Delete
  3. The problem is that I'm not translating text, but making new images for characters in the game, some images have up to 16 free clut spaces, but most are left blank,and using a hex editor would be incredibly time consuming to manually edit all of those new images.
    I'm not very familiar with using hexeditor either, is there any more detailed explanation around, or a different program I can use to edit the different cluts in one tim ?

    ReplyDelete
    Replies
    1. Ah I see, you only need to edit a specific CLUT. Tim2view allows you to do that, just click on "CLUT" on the bottom right corner and then double-click on the colors to edit them. The software also shows you how to edit the different transparencies. Regards.

      Delete
  4. No, I mean I know that too.
    But isn't there a way to import a tim or whatever other image file with colors you have already drawn on the image.
    Like when you replace a tim, the entire tim changes and palet too according to the one you drew on said image ( that is easy as long as it has only 1 clut )
    What I need to know is how you do the exactly same thing, but for a second or 3rd clut.
    However I'm assuming that you probably don't know this either looking at your previous responses, which is fine.
    I'll try to look for a different solution in this case.

    ReplyDelete
  5. In Tim2view, export TIM file as a PNG. After opening it in any image editor, sa e the CLUT information.

    (On Adobe, you do this by going on:
    Image>color table, then make sure color is set to "Exact". Then save the AC3 file.)

    Edit the file on Image editor, save it as indexed with also adding custom saved AC3 file you made earlier.

    Back on Tim2view, select the TIM you want to replace, then go at the top bar, and select:

    Image>Import PNG (with you created PNG file)

    And that's it.
    All index pages and GLUT order is preserved.

    ReplyDelete
  6. I forgot to mention after switching from RGB back ti Indexed mode in Adobe. You will need to save the image as PNG.

    ReplyDelete
    Replies
    1. Ok thanks. When I translated the game tim2view was in a very primitive state or I lacked the skills to make it work properly. Regards.

      Delete