Unpacking Game Files - 3D Objects

Introduction

Every 3D game uses resource files that contain images, music, textures, scripts and most importantly 3D object/models.

Most of the time developers use custom, possibly encrypted, formats that you'll need to unpack in order to convert to a standard format.

Luckily, there are times that they just use a standard format that don't require unpacking. But unfortunately, that isn't the case for you cause if it was, then you wouldn't be here searching for how to unpack these files.

WHAT IS THIS
Some game developers create custom formats to keep their data safe. Prevent people from MODDING their games. Other times, they allow MODDING and even provide the necessary software to unpack and repack their custom formats.

This will be a tutorial on how to unpack and repack non-standard formats.

TECHNIQUES
There are two ways in unpacking custom game formats: Binary Analysis and Reverse Engineering.

Binary Analysis

This is the easier approach.

REQUIREMENTS
Before you can start you'll need a hex editor:

  • Hex Workshop
  • TinyHexer
  • HexEdit

You will also need a good amount of understanding on:

  • Hexadecimal Numbers, how to convert and do arithmetic with them
  • Primitive Data Types, specially floating points

To follow this tutorial. You'll need this sample object file. Download and open it on a Hex Editor. I'll be using Hex Workshop.

A 3D OBJECT

Components:
3d_obj_diagram

Axis:
3d_axis

THE FACE
Faces are very easy to find since it usually looks like scrambled alpha-numeric characters: 0-9, a-z, and A-Z.

Sample Face Indices block (partial):
faces

THE VERTEX
Vertices, unfortunately, are harder to find. There is no standard pattern to look for. To find these, we must first understand the structure of a vertex.

Vertices are points in space, plotted by the axis x, y, z. So the structure is:

struct vertex {
  float x;
  float y;
  float z;
};
struct vertices {
  vertex [n]pts;
};