Author Topic: Replace 256 ".TIM" CLUT with a 256 color palette from a ".bmp" or ".PNG" file?  (Read 3915 times)

NERV Agent

  • I sexually identify as a multipurpose synthetic humanoid decisive weapon Evangelion.
  • *
  • Posts: 105
  • Eva Unit 01
    • View Profile
How do I replace a 256 color CLUT in a PSX ".TIM" file with a 256 color palette from a ".BMP" or ".PNG" file?

I know Tim2View can edit the CLUT, but it seems that requires changing each and every one of the 256 entries one by one (and possible arthritis). Is there a faster way?
« Last Edit: 2016-06-18 03:48:34 by NERV Agent »

Maki

  • 0xBAADF00D
  • *
  • Posts: 602
  • 0xCCCCCCCC
    • View Profile
In TIMViewer:

1. Convert TIM to BMP using Convert>toBMP
2. Edit BMP palette as you wish in your favourite graphic tool
3. Save BMP preserving the 256 color format
4. Go back to TIM Viewer
5. Open BMP with your texture
6. Convert>BMP to TIM
7. Now you have working TIM file
-You say it's 256 palette, therefore the only TIM containing 256 colors is 8BPP

So look at uint16 at 0x12- It's number of CLUT palettes. If your texture is only one CLUT, then just after the count a 512 bytes of CLUT data is. Therefore:
8. Copy paste from the same location the converted TIM from your BMP over the TIM you want to edit palette.
(copy 512 bytes starting from 0x20+(CLUT*512) to the same location in your final TIM texture OR if the initial texture has only one palette, then always copy from 0x20 from custom image to 0x20+(CLUT*512) in your final texture)
« Last Edit: 2016-06-18 11:41:41 by Maki »

NERV Agent

  • I sexually identify as a multipurpose synthetic humanoid decisive weapon Evangelion.
  • *
  • Posts: 105
  • Eva Unit 01
    • View Profile
Thanks, but what exactly do I input here?


NERV Agent

  • I sexually identify as a multipurpose synthetic humanoid decisive weapon Evangelion.
  • *
  • Posts: 105
  • Eva Unit 01
    • View Profile
Also, I'm trying the steps right now and keep getting the same discolored results.

NERV Agent

  • I sexually identify as a multipurpose synthetic humanoid decisive weapon Evangelion.
  • *
  • Posts: 105
  • Eva Unit 01
    • View Profile
So look at uint16 at 0x12- It's number of CLUT palettes. If your texture is only one CLUT, then just after the count a 512 bytes of CLUT data is. Therefore:
8. Copy paste from the same location the converted TIM from your BMP over the TIM you want to edit palette.
(copy 512 bytes starting from 0x20+(CLUT*512) to the same location in your final TIM texture OR if the initial texture has only one palette, then always copy from 0x20 from custom image to 0x20+(CLUT*512) in your final texture)

When I get to this step, I compare both ".TIM" files in Tim2View and see that the CLUTs do not match. :(

NERV Agent

  • I sexually identify as a multipurpose synthetic humanoid decisive weapon Evangelion.
  • *
  • Posts: 105
  • Eva Unit 01
    • View Profile
Here's what I mean.

This is the custom generated ".TIM" that TimViewer converted from a ".BMP":



And here is the "final texture" that was ripped from the game and changed via hex editor per the "step 8" instructions:



What is going on?