MW2 textures

Binary formats and related hacking.

Moderator: Skyfaller

User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: MW2 textures

Post by Col.Kell »

You're good.... :)
MechWarrior 2: 31stCC
Image
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1015
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: MW2 textures

Post by Skyfaller »

I don't have as much time for this as I would like, so I haven't been able to work some bugs out yet, but I can post a first few pics. Still working on this, so there may be better screenshots later.

In the cases where it doesn't work yet, I am loading the right textures, but they are applied to the wrong places.

Every different palette gives a completely different set of texture colorations, so there are very many possible skins for each mech.
Attachments
Seems to work OK for the Incubus, note how a darker texture is placed correctly on the upper arm. Feet are weird though.
Seems to work OK for the Incubus, note how a darker texture is placed correctly on the upper arm. Feet are weird though.
MW2-GBL-TT-Incubus-ICEB0FDA.png (96.91 KiB) Viewed 5549 times
Not sure if it works correctly here, maybe the gun barrels should be darker
Not sure if it works correctly here, maybe the gun barrels should be darker
MW2-GBL-TT-Annihilator.png (94.27 KiB) Viewed 5548 times
For the Kodiak, many texture pieces are misplaced
For the Kodiak, many texture pieces are misplaced
MW2-GBL-TT-Kodiak-REDA0FDA.png (56.68 KiB) Viewed 5546 times
User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: MW2 textures

Post by Col.Kell »

Great job! Mechs look far better than the traditional plain white. Makes them look more fierce too.
MechWarrior 2: 31stCC
Image
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1015
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: MW2 textures

Post by Skyfaller »

Some notes:
  • Palette entries must be multiplied by 4.
  • Texture coordinates are not negative, but may exceed the size of the texture. In that case, the texture must be placed several times.
Texture coordinates exceeding the size of the texture require that the texture is placed several times in the texture atlas.
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1015
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: MW2 textures

Post by Skyfaller »

For efficiency reasons, I use a single texture for an entire mech. This reduces the number of GL calls to select textures, but it is not compatible with MW2 and MW3m which use individual textures for each polygon. As a workaround, I compile the small textures used by a mech into one large texture, called a texture atlas. This worked well for MW3, but MW2 uses texture coordinates that exceed the texture size to indicate that a single texture should be placed several times. I have been able to fix that placing textures several times in the atlas when needed. This fixes some rendering bugs, but there still appears to be a problem with the texture coordinates. I'll keep you updated.
Kallisti
I.S. Baby
Posts: 1
Joined: Tue Aug 25, 2020 6:09 am

Re: MW2 textures

Post by Kallisti »

Ancient Spirits of Evil, transform this decayed thread into MUMTHREAD. The Evah Living!
Image
Skyfaller wrote: Sun Jan 18, 2009 7:05 am 31stCC (3DFX, Matrox, ATI): .555 format
...
The .555 textures, like the .XEL files, have a header consisting of only horizontal and vertical size. Judging from the size, the file contains 16-bit for each pixel, red, blue, green and alpha channels. MW3 uses a different format with the same name.

(Currently working out the exact format for the .555 files, will update post after that)
Ok, I didn't see this posted anywhere and this seems to be the best thread for it without starting a new one... For those who are interested, someone suggested that for the Mech2 engine that my son and I are working on, that we roll support for the 3DFX version of the game... We got the textures and and meshes going pretty easily.

So... to contribute to the collected knowledge...

The 3DFX version's .555 textures are in fact 555 textures, at least as long as they're opaque, anyway. The transparent ones are 4444 textures.

So here's how this breaks down.
The opaque textures take 5 bits per channel, for a total of 15 bits. The 16th bit is discarded but could presumably be used for an alpha cutout. They're formatted as BGR, not RGB as would be expected. So bits 0-4 are Blue, bits 5-9 are Green, bits 10-14 are red. Divide the results for each channel by 31 or 31 to get the end result as a normalized float. Multiply the normalized float by 256 to get the full RGB value if you're not using normalized float based color vectors like we are.

The 4444 transparent textures are very much the same, except it's bits 0-3 for blue, 4-7 for green, 8-11 for red, and 12-15 for alpha. The divisor for this is 15 instead of 31 on each channel to get the normalized float. The rest is the same as the 555 opaque textures.

Here are a few examples of my MW2 3DFX .555 file decoding code at work:

Image
Image
Image
Image
Image
Post Reply