3DF

The **3DF** files are used in *Carnivores*, *Carnivores 2*, and *Carnivores Ice Age* as 3D model files for the binoculars, compass, sun, and moon, and are located in the \HUNTDAT folder.

The 3DF format is a simplified version of the CAR format, lacking animations, sounds, and the ModelName field in the header, though 3DF files have bones, which CAR files lack. This format is also slightly different from the format of objects in RSC files, which support animations; Alt Editor can export RSC objects as 3DF files, and object animations as VTL files.

## Format

// header (16 bytes)

0x0000
uint32
4
VCount

number of vertices

0x0004
uint32
4
FCount

number of faces

0x0008
uint32
4

number of bones

0x000C
uint32
4
TextureSize

texture length in bytes

// for each face (64 bytes)

uint32
4
v1

vertex 1

uint32
4
v2

vertex 2

uint32
4
v3

vertex 3

uint32
4
tax

`v1` texture U coordinate

uint32
4
tbx

`v2` texture U coordinate

uint32
4
tcx

`v3` texture U coordinate

uint32
4
tay

`v1` texture V coordinate

uint32
4
tby

`v2` texture V coordinate

uint32
4
tcy

`v3` texture V coordinate

uint16
2
flags

bit
1
sfDoubleSide
0x0001
marks face as textured on both sides

bit
1
sfDarkBack
0x0002
marks face as having a dark back side

bit
1
sfOpacity
0x0004
marks face as transparent

bit
1
sfTransparent
0x0008
marks face as non-solid (bullets pass through harmlessly)

bit
1
sfMortal
0x0010
marks face as a target zone

bit
1
sfPhong
0x0020
marks face as Phong mapped

bit
1
sfEnvMap
0x0040
marks face as Environment mapped

bit
1
sfNeedVC
0x0080

bit
7

unused

bit
1
sfDark
0x8000
marks face as having a dark front side

uint16
2
DMask

appears to be unused by the games, possibly editor/tool-specific

uint32
4
Distant

purpose unknown

uint32
4
Next

some sort of index to other faces?

uint32
4
group

appears to be unused by the games, possibly editor/tool-specific

byte
12
reserv
0x00
unused; reserved for future use

// for each vertex (16 bytes)

float
4

X coordinate

float
4

Y coordinate

float
4

Z coordinate

uint16
2
owner

bone to which vertex is attached

uint16
2
hide

whether the vertex is hidden in Designer 2; has no effect in-game

// for each bone (48 bytes)

byte
32

name

float
4

X coordinate

float
4

Y coordinate

float
4

Z coordinate

int16
2

index to the parent bone, `-1` if there is no parent

uint16
2

whether the bone is hidden in Designer 2; has no effect in-game

byte
TextureSize
texture

16-bit TGA-style encoding in BGRA5551 format, always 256 pixels wide

### Notes

* The `sfPhong` and `sfEnvMap` flags are actually assigned values of `0x30` and `0x50` in the game source, meaning models with these flags will also set `sfMortal` on the same faces. Fortunately, weapons are the only objects to use the `sfPhong` and `sfEnvMap` flags. Furthermore, the code will still work correctly if these flags are set but `sfMortal` is not. Animator uses the correct values of `0x20` and `0x40` for these flags.
* The alpha channel in the image is unused; instead, the game engine uses the alpha flag to determine which triangles are transparent on a model.

## External links

* The .3df files on La saga de Carnivores
* Carnivores 1, 2 and Ice Age .3df files thread on The Carnivores Saga