Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Setup.php on line 381

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Setup.php on line 382

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Setup.php on line 383

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Setup.php on line 384

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/mediawiki/includes/AutoLoader.php:1007) in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/mediawiki/includes/AutoLoader.php:1007) in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: include_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Skin.php on line 153

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/skins/Vector.deps.php on line 11

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Skin.php on line 155

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: include(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/resourceloader/ResourceLoader.php on line 201

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/json/FormatJson.php on line 12

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007
TMD (PlayStation) - Just Solve the File Format Problem

TMD (PlayStation)

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name TMD (PlayStation)
Ontology
Extension(s) .tmd

This content was first retrieved from the Internet Archive's Wayback Machine for the date 2016-05-09 from the following URL: https://web.archive.org/web/20160509002322/http://rewiki.regengedanken.de/wiki/.TMD

The .TMD file format is the standard file format for 3D objects on PlayStation. It is also used by many PC ports of Playstation games, like Resident Evil, Resident Evil 2, Resident Evil 3.

Contents

Structure

The values are stored in Little-Endian order.

Header

A TMD file can contain several 3D models. It starts with this header:

typedef struct {
    unsigned long id; /* Constant = 0x41 */
    unsigned long unknown;
    unsigned long num_objects; /* Number of objects in file */
} tmd_header_t;

Then are following the objects headers, as an array of tmd_object_t objects[num_objects].

Object

typedef struct {
	unsigned long vertex_offset; /* Offset to vertex array coordinates */
	unsigned long vertex_count; /* Number of vertices */
	unsigned long normal_offset; /* Offset to normal array coordinates */
	unsigned long normal_count; /* Number of normals */
	unsigned long primitive_offset; /* Offsets to primitives */
	unsigned long primitive_count; /* Number of primitives */
	unsigned long unknown;
} tmd_object_t;

Vertex, normal

Vertices and normals share the same format to holds the 3D coordinate:

typedef struct {
	short x;
	short y;
	short z;
	short zero;
} tmd_vertex_t;

Primitives

Each primitive starts with same header, and the rest depend on the primitive type:

typedef struct {
	unsigned char unknown0;
	unsigned char length; /* Length of following primitive in 32bit words */
	unsigned char unknown1;
	unsigned char type;	/* primitive type */
} tmd_prim_header_t;

Single color triangle (type 0x20,0x22)

typedef struct {
        unsigned char r,g,b,unknown; /* R,G,B triangle color */

	unsigned short n0; /* Normal index */

	unsigned short v0; /* Vertex index */
	unsigned short v1;
	unsigned short v2;
} tmd_flattriangle_t;

Gouraud triangle (type 0x24)

typedef struct {
        unsigned char r0,g0,b0,unk0; /* R,G,B vertex color */
        unsigned char r1,g1,b1,unk1;
        unsigned char r2,g2,b2,unk2;

	unsigned short n0; /* Normal index */

	unsigned short v0; /* Vertex index */
	unsigned short v1;
	unsigned short v2;
} tmd_gouraudtriangle_t;

Single color quad (type 0x28)

typedef struct {
        unsigned char r,g,b,unknown; /* R,G,B quad color */

	unsigned short n0; /* Normal index */

	unsigned short v0; /* Vertex index */
	unsigned short v1;
	unsigned short v2;
	unsigned short v3;
} tmd_flatquad_t;

==== Gouraud quad (type 0x2c) ====

<pre>typedef struct {
        unsigned char r0,g0,b0,unk0; /* R,G,B vertex color */
        unsigned char r1,g1,b1,unk1;
        unsigned char r2,g2,b2,unk2;
        unsigned char r3,g3,b3,unk3;

	unsigned short n0; /* Normal index */

	unsigned short v0; /* Vertex index */
	unsigned short v1;
	unsigned short v2;
	unsigned short v3;

	unsigned short unk5;
} tmd_gouraudquad_t;

Flat triangle with vertex normals (type 0x30)

typedef struct {
        unsigned char r,g,b,unk; /* R,G,B triangle color */

	unsigned short n0; /* Normal index */
	unsigned short v0; /* Vertex index */
	unsigned short n1;
	unsigned short v1;
	unsigned short n2;
	unsigned short v2;
} tmd_flattriangle2_t;

Textured triangle (type 0x34)

typedef struct {
        unsigned short unknown1;
        unsigned char v0; /* textures coordinates */
        unsigned char u0;
        unsigned short unknown2;
        unsigned char v1;
        unsigned char u1;
        unsigned short unknown3;
        unsigned char v2;
        unsigned char u2;

	unsigned short v0; /* Vertex index */
	unsigned short n0; /* Normal index */
	unsigned short v1;
	unsigned short n1;
	unsigned short v2;
	unsigned short n2;
} tmd_txtriangle_t;

Flat quad with vertex normals (type 0x38)

typedef struct {
        unsigned char r,g,b,unk; /* R,G,B quad color */

	unsigned short n0; /* Normal index */
	unsigned short v0; /* Vertex index */
	unsigned short n1;
	unsigned short v1;
	unsigned short n2;
	unsigned short v2;
	unsigned short n3;
	unsigned short v3;
} tmd_flatquad2_t;
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/mediawiki/includes/AutoLoader.php:1007) in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/mediawiki/includes/AutoLoader.php:1007) in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/mediawiki/includes/AutoLoader.php:1007) in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/mediawiki/includes/AutoLoader.php:1007) in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007