This thread will hopefully become a useful resource to anyone wishing to help out the project. In it I aim to provide a complete breakdown of the files used by Grim Fandango, with some detailed reference information to help anyone new, or anyone needing a refresher on how things are structured (like me!).

LAB FILESLAB files are where all of GF's assets and scripts are stored. They are container files (or "bundles" aka "LucasArts Bundles") that store many other files within (much like a .zip file). Luckily, thanks to GF's popularity, there are some great quality fan-made tools available to open, extract and even create LAB files.

INSIDE DATA00*.LAB FILESThis is really what we're interested in. Inside these files (roughly broken up by into Intro (000) and Years (001 to 004)) you'll find:

.3do files (3D Objects) These are the 3D meshes for each object and character in the game..mat files (Materials) These are the actual textures, devoid of any colour palette information..cmp files (Colour Maps) These are matched with the .mat files to create a texture with the right colours..cos files (Costumes) These are plain text files that contain information on (among other things) which which .cmps are used by different .3do files.

In order to improve the models and textures in Grim Fandango, these are the files we need to modify:

.3DO FILES (3D Objects)
These files are in an ancient 3D format that is difficult to open in modern 3D modelling programs. Thankfully we have command-line tools written by cplhenshaw that convert .3do files to the commonly used .obj format and back again.

.MAT FILES (Materials)
These are essentially textures, but devoid of colour. Like 3DO files they need to be converted into a more commonly used format in order to be opened. They also need to be opened with a corresponding .CMP file if you wish to see how they look in game.

Converting these files into common .obj files has been pretty tricky. cplhenshaw's tool works wonders most of the time, but unfortunately there are some issues with it that were spotted by Nitrus and Blacksad. For the most part you should be good using it to convert 3DO files into OBJ files (and back again).

WORKING WITH 3DO FILES
When it comes to actually modelling, cplhenshaw created a graph showing where the polygon "sweet spot" is (between 2K and 3K). More than that and the game engine starts to creak, so be aware:

That said, we're not looking to completely change the look of the game, so there shouldn't really be a need to push the boundaries too high.

KNOWN ISSUES
Unfortunately it's not possible to simply drop in new higher-res textures without some consideration. The coordinates all need to be updated, which affects the entire .3do file. This means that all textures will need to be uniformly 4x their original size, for example.

Last edited by JohnnyWalker2001 on Sun Nov 17, 2013 12:56 pm, edited 2 times in total.

Previously we had to rely on older programs written to mod games like Jedi Knight (which used the same 3D file formats). MatMaster 2 and Mat16 were of some use, but they've since been eclipsed by Nitrus's tool, so use that.

But essentially the textures are designed to look a little "hand painted", and we wish to maintain that style. There's no need to add a ton of detail that wasn't there in the original. Here's a visual reference:

From this:

To this:

WORKING WITH MAT/CMP FILES
Extracting and conversion is super easy thanks to Nitrus's tool, but you will need to find the corresponding CMP file for each MAT file so you can extract the image with the correct colours.

Once you've extracted the image as a BMP, change the colour to RGB and increase the size to FOUR times what it was previously.

Then get to work!

Note: (As previously mentioned) if you begin editing the textures for a 3D object, you must convert ALL the textures used by that 3do file to 4x their original size. This is because (if I'm explaining this correctly) the coordinates are absolute in each 3DO. So either the all the textures on the model are 1x or they're 4x.

HOW DO I FIND THE RIGHT CMP FOR MY MAT?
This is an arduous process, but it goes like this:

1. Find the object you wish to edit the textures for (aka the 3DO file).

e.g. glottis.3do

2. Do a search in the contents of all the .COS files until you find where your 3DO file appears.

e.g. glottis.cos and gl_akimbo_idles.cos

3. Look in one (or possibly all) of the found COS files until you find the reference to the 3DO file.

e.g.

Code:

ID TagID Hash ParentID Name0 0 0 -1 glottis.3do

4. Find the CMP reference with a ParentID of the 3DO

e.g.

Code:

11 3 0 0 glottis.cmp

5. Now you know the name of the CMP file that goes with all the textures in the 3DO you chose, so open the 3DO file and look for all the references to MAT files.

6. You now have all the MAT files and the correct CMP file to go with them. Use Nitros's tool to extract them all and you're ready to play!

OK! MY NEW TEXTURES LOOK AWESOME. NOW WHAT?
When it comes to saving your work for use in the game, you will need to save them back down to 256 colours using the original Colour Map palette. You can do this by converting the CMP file, to an ACT file. (Nitrus's tool will do that for you, too.)

Then you need to convert your document to an INDEXED colour format in Photoshop using a CUSTOM PALETTE -- the ACT file.

Yes, this will result in an 8-bit texture... the limitation of the GF engine.

Note: Make sure you keep your original RGB layered file, though! There is some talk about using 24-bit textures in Residual and it may still happen.

KNOWN ISSUES
There's no known issues with this yet. It's important to note that sometimes the same 3DO can have several different CMP files associated with it. So the MAT files themselves may be identical, but a different colour is used to change the look of the texture.

Last edited by JohnnyWalker2001 on Fri Mar 07, 2014 7:25 pm, edited 8 times in total.

Finally we come to COS files. Mercifully these are simply plain text documents that can be opened by anybody, and they also don't need to be edited. Phew. They're mentioned here because they're great references for discovering which CMPs go with each MAT file.

As giucam helpfully pointed out, the inside of .cos files can be read thusly:

Here you see that the costume sets the CMP thunder.cmp on the head models, since the ParentID of the CMPs are the IDs of the models.

A costume is a set of Components and Chores. Each Component represents an on-screen object, like an object state, a 3D mesh, a material, or a keyframe animation, or a sound effect. Each Chore (diminutive for choreography) gives a set of instructions for how to move, change state or activate or deactivate each component at certain times.