Skip to content
/ Matt Public

*.MAT utility for Jedi Knight: Dark Forces 2

License

Notifications You must be signed in to change notification settings

bahstrike/Matt

Repository files navigation

Matt

Modern utility for converting 8-bit/16-bit .MAT files to&from typical image files.

NOTE: readme content/screenshots may be out-of-date, but still representative

sample screenshot

Overview

Features

  • Original and Output preview renderings
  • Drag'n'drop for loading any file
  • Automatic rescale to powers-of-2
  • Supports typical image formats
    • .BMP / .PNG / .JPG / .GIF
  • Supports 8-bit MATs
    • browse for .CMP files directly
    • browse for .GOB (eg. res2.gob) and allow selection of any included colormap in a convenient drop-down
  • Supports 16-bit MATs
    • format 565RGB (best color)
    • format 1555ARGB (supports transparency)
    • format 4444ABGR (indy only)
  • Supports 24-bit and 32-bit MATs (3rd party expansions)

Missing/Pending Features

  • Single-color MAT support (such as used in particle effects)
  • Multi-cel MAT support (for switches/buttons or animated textures)
  • Control 8-bit transparency fileformat field
  • Control 8-bit color index fileformat field
  • Use fuchsia (255/0/255) on incoming standard image files as an optional automatic transparency pixel value

Development

Matt implements the .MAT specification as elicited from JKSpecs, BoBo Fett's "mat-16 spec", smlu's contributions, shiny's contributions, and personal research.


Tutorial

The application should be pretty easy to figure out on your own.

However, if you want step-by-step instructions then please see below for specific tasks.

Converting image -> .MAT

  1. Open Matt.exe
  2. Click Open or just drag a .BMP/.PNG/.JPG/.GIF file onto the program
  3. Select your desired output format in the Material Format section
    • Material Format options will auto-select based upon the image format you have loaded, but you are free to change it
    • If 8-bit: Select the appropriate colormap
      • Using colormaps from GOB:
        1. In the Colormap section, type or browse to a .GOB file (such as res2.gob)
        2. Select an appropriate entry from the GOB Colormap drop-down
      • Using direct colormap file:
        1. In the Colormap section, type or browse to a .CMP file
    • If 16-bit: Select the desired format
      • 565RGB provides best color detail, but does not support transparency
      • 1555ARGB provides good color detail, and supports 1-bit transparency (you should load a .PNG with transparency, or a 32-bit .BMP file, to use this format)
  4. Click Save and choose Material Files as the Save type

Converting .MAT -> image

  1. Open Matt.exe
  2. Click Open or just drag a .MAT file onto the program
    • Material Format options will auto-select based upon the MAT format, to let you know what you have loaded
  3. If 8-bit select the appropriate colormap (16-bit textures do not require a colormap)
    • Using colormaps from GOB:
      1. In the Colormap section, type or browse to a .GOB file (such as res2.gob)
      2. Select an appropriate entry from the GOB Colormap drop-down
    • Using direct colormap file:
      1. In the Colormap section, type or browse to a .CMP file
  4. Click Save and choose Image Files as the Save type

Advanced

There are a couple more options which may assist with some tasks.

Keep Current Colormap (button)

This is useful when having loaded an existing 8-bit .MAT that you want to save as a new .MAT that conforms to a different colormap.

After you have loaded the .MAT file and found its appropriate colormap, click Keep Current Colormap and any further colormap selections will only affect the output.

[X] Show transparent as fuchsia (checkbox)

Toggle whether to fill transparent pixels as pink, or let the "invalid image area" background lines show through.

This is purely visual and has no effect on file output.

[X] Autoselect format based on input image (checkbox)

Toggle whether to automatically change the Material Format options based upon the file you have loaded.

This is useful to turn off when you want to lock-in your output settings, and drag a bunch of random files in.

[X] Exclude self-illuminated colors (8-bit) (checkbox)

Prevents using .CMP colors that have the same RGB value at min/max light level. This protects various texels from glowing in the dark when using software renderer.

[_] Dither (8-bit) (checkbox)

Applies a Floyd-Steinberg dithering algorithm while conforming an image to .CMP palette. Typically not needed, but available as an option for suboptimal image imports.