<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Planetarian</id>
	<title>3dbrew - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Planetarian"/>
	<link rel="alternate" type="text/html" href="https://www.3dbrew.org/wiki/Special:Contributions/Planetarian"/>
	<updated>2026-04-29T15:47:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=10460</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=10460"/>
		<updated>2014-11-05T19:04:39Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* TXOB */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Version ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to object&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex groups come in a number of different formats. Typically the first vertex group entry is of format 0x40000002 and contains the actual vertex array.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to component declaration offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each mesh&#039;s primary vertex group contains an array of vertex component declaration objects, defining the order and parameters for each of a vertex&#039;s components.&lt;br /&gt;
&lt;br /&gt;
Vertex component declaration:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex component type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| Component data type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of values in this component (e.g. XYZ-&amp;gt;3, UV-&amp;gt;2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Multiplier for this component&#039;s values (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Position of this component within vertex stride&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats with bone data support multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
Vertex component types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| ? (unobserved)&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| Color&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| UV0&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| UV1&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| ? (unobserved, possibly UV2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| Weight&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex component data types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| sbyte&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| short&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| ? (unobserved, possibly ushort)&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| ? (unobserved, possibly int)&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| ? (unobserved, possibly uint)&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| float&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex components are stored as one of the above data types, and the vertex component declaration contains a multiplier that adapts the values to the float version which the game will use.&lt;br /&gt;
For example, color RGBA values are stored as bytes, and the multiplier converts them from 0-255 to 0-1.0, and position components using short values are normalized via the multiplier to take advantage of the entire short value range.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=10458</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=10458"/>
		<updated>2014-11-05T18:17:52Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* CGFX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Version ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to object&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex groups come in a number of different formats. Typically the first vertex group entry is of format 0x40000002 and contains the actual vertex array.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to component declaration offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each mesh&#039;s primary vertex group contains an array of vertex component declaration objects, defining the order and parameters for each of a vertex&#039;s components.&lt;br /&gt;
&lt;br /&gt;
Vertex component declaration:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex component type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| Component data type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of values in this component (e.g. XYZ-&amp;gt;3, UV-&amp;gt;2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Multiplier for this component&#039;s values (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Position of this component within vertex stride&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats with bone data support multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
Vertex component types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| ? (unobserved)&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| Color&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| UV0&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| UV1&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| ? (unobserved, possibly UV2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| Weight&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex component data types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| sbyte&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| short&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| ? (unobserved, possibly ushort)&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| ? (unobserved, possibly int)&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| ? (unobserved, possibly uint)&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| float&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex components are stored as one of the above data types, and the vertex component declaration contains a multiplier that adapts the values to the float version which the game will use.&lt;br /&gt;
For example, color RGBA values are stored as bytes, and the multiplier converts them from 0-255 to 0-1.0, and position components using short values are normalized via the multiplier to take advantage of the entire short value range.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=10457</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=10457"/>
		<updated>2014-11-05T18:14:26Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* CGFX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x4&lt;br /&gt;
| Version ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to object&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex groups come in a number of different formats. Typically the first vertex group entry is of format 0x40000002 and contains the actual vertex array.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to component declaration offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each mesh&#039;s primary vertex group contains an array of vertex component declaration objects, defining the order and parameters for each of a vertex&#039;s components.&lt;br /&gt;
&lt;br /&gt;
Vertex component declaration:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex component type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| Component data type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of values in this component (e.g. XYZ-&amp;gt;3, UV-&amp;gt;2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Multiplier for this component&#039;s values (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Position of this component within vertex stride&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats with bone data support multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
Vertex component types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| ? (unobserved)&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| Color&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| UV0&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| UV1&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| ? (unobserved, possibly UV2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| Weight&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex component data types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| sbyte&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| short&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| ? (unobserved, possibly ushort)&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| ? (unobserved, possibly int)&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| ? (unobserved, possibly uint)&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| float&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex components are stored as one of the above data types, and the vertex component declaration contains a multiplier that adapts the values to the float version which the game will use.&lt;br /&gt;
For example, color RGBA values are stored as bytes, and the multiplier converts them from 0-255 to 0-1.0, and position components using short values are normalized via the multiplier to take advantage of the entire short value range.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9876</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9876"/>
		<updated>2014-09-19T15:40:35Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* DICT */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to object&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex groups come in a number of different formats. Typically the first vertex group entry is of format 0x40000002 and contains the actual vertex array.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to component declaration offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each mesh&#039;s primary vertex group contains an array of vertex component declaration objects, defining the order and parameters for each of a vertex&#039;s components.&lt;br /&gt;
&lt;br /&gt;
Vertex component declaration:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex component type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| Component data type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of values in this component (e.g. XYZ-&amp;gt;3, UV-&amp;gt;2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Multiplier for this component&#039;s values (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Position of this component within vertex stride&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats with bone data support multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
Vertex component types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| ? (unobserved)&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| Color&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| UV0&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| UV1&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| ? (unobserved, possibly UV2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| Weight&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex component data types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| sbyte&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| short&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| ? (unobserved, possibly ushort)&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| ? (unobserved, possibly int)&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| ? (unobserved, possibly uint)&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| float&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex components are stored as one of the above data types, and the vertex component declaration contains a multiplier that adapts the values to the float version which the game will use.&lt;br /&gt;
For example, color RGBA values are stored as bytes, and the multiplier converts them from 0-255 to 0-1.0, and position components using short values are normalized via the multiplier to take advantage of the entire short value range.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9866</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9866"/>
		<updated>2014-09-15T16:45:26Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */ multiplier/datatype details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex groups come in a number of different formats. Typically the first vertex group entry is of format 0x40000002 and contains the actual vertex array.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to component declaration offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each mesh&#039;s primary vertex group contains an array of vertex component declaration objects, defining the order and parameters for each of a vertex&#039;s components.&lt;br /&gt;
&lt;br /&gt;
Vertex component declaration:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex component type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| Component data type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of values in this component (e.g. XYZ-&amp;gt;3, UV-&amp;gt;2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Multiplier for this component&#039;s values (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Position of this component within vertex stride&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats with bone data support multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
Vertex component types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| ? (unobserved)&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| Color&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| UV0&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| UV1&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| ? (unobserved, possibly UV2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| Weight&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex component data types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| sbyte&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| short&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| ? (unobserved, possibly ushort)&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| ? (unobserved, possibly int)&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| ? (unobserved, possibly uint)&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| float&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex components are stored as one of the above data types, and the vertex component declaration contains a multiplier that adapts the values to the float version which the game will use.&lt;br /&gt;
For example, color RGBA values are stored as bytes, and the multiplier converts them from 0-255 to 0-1.0, and position components using short values are normalized via the multiplier to take advantage of the entire short value range.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9865</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9865"/>
		<updated>2014-09-15T15:22:03Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex groups come in a number of different formats. Typically the first vertex group entry is of format 0x40000002 and contains the actual vertex array.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to component declaration offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each mesh&#039;s primary vertex group contains an array of vertex component declaration objects, defining the order and parameters for each of a vertex&#039;s components.&lt;br /&gt;
&lt;br /&gt;
Vertex component declaration:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex component type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| Component data type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of values in this component (e.g. XYZ-&amp;gt;3, UV-&amp;gt;2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Multiplier for this component&#039;s values (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Position of this component within vertex stride&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats with bone data support multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
Vertex component types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| ? (unobserved)&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| Color&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| UV0&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| UV1&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| ? (unobserved, possibly UV2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| Weight&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex component data types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| sbyte&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| short&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| ? (unobserved, possibly ushort)&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| ? (unobserved, possibly int)&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| ? (unobserved, possibly uint)&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| float&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9864</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9864"/>
		<updated>2014-09-15T15:20:22Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex groups come in a number of different formats. Typically the first vertex group entry is of format 0x40000002 and contains the actual vertex array.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to component declaration offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each mesh&#039;s primary vertex group contains an array of vertex component declaration objects, defining the order and parameters for each of a vertex&#039;s components.&lt;br /&gt;
&lt;br /&gt;
Vertex component declaration:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex component type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| Component data type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of values in this component (e.g. XYZ-&amp;gt;3, UV-&amp;gt;2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Multiplier for this component&#039;s values (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Position of this component within vertex stride&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex component types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| ? (unobserved)&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| Color&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| UV0&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| UV1&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| ? (unobserved, possibly UV2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| Weight&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex component data types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| sbyte&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| byte&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| short&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| ? (unobserved, possibly ushort)&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| ? (unobserved, possibly int)&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| ? (unobserved, possibly uint)&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| float&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Observed sample vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex stride&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| X (short), Y (short), Z (short), U (short), V (short)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| X (short), Y (short), Z (short), ... ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats with bone data support multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9863</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9863"/>
		<updated>2014-09-15T15:15:08Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex groups come in a number of different formats. Typically the first vertex group entry is of format 0x40000002 and contains the actual vertex array.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to component declaration offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each mesh&#039;s primary vertex group contains an array of vertex component declaration objects, defining the parameters for each of a vertex&#039;s components.&lt;br /&gt;
&lt;br /&gt;
Vertex component declaration:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex component type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| Component data type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of values in this component (e.g. XYZ-&amp;gt;3, UV-&amp;gt;2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Multiplier for this component&#039;s values (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Position of this component within vertex stride&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Observed sample vertex format sizes:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex stride&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| X (short), Y (short), Z (short), U (short), V (short)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| X (short), Y (short), Z (short), ... ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats with bone data support multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9862</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9862"/>
		<updated>2014-09-15T00:48:10Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */ mesh offsets&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| Mesh position offset (X/Y/Z floats)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex stride&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| X (short), Y (short), Z (short), U (short), V (short)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| X (short), Y (short), Z (short), ... ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9856</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9856"/>
		<updated>2014-09-14T02:54:36Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex stride/size in bytes (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex stride&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| X (short), Y (short), Z (short), U (short), V (short)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| X (short), Y (short), Z (short), ... ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9846</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9846"/>
		<updated>2014-09-12T21:11:08Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| X (short), Y (short), Z (short), U (short), V (short)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| X (short), Y (short), Z (short), ... ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9831</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9831"/>
		<updated>2014-09-11T20:45:45Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9830</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9830"/>
		<updated>2014-09-11T20:15:48Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| ? (possibly half-precision XYZUV)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9829</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9829"/>
		<updated>2014-09-11T19:44:27Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9828</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9828"/>
		<updated>2014-09-11T18:54:18Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to UInt32 Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9825</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9825"/>
		<updated>2014-09-10T20:45:36Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* Skeleton data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9824</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9824"/>
		<updated>2014-09-10T20:39:53Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* Skeleton data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9823</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9823"/>
		<updated>2014-09-10T20:22:28Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face array descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9822</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9822"/>
		<updated>2014-09-10T20:20:33Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown2 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown2 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown2:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face group descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte Unknown3 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9821</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9821"/>
		<updated>2014-09-10T20:18:31Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 4: model; bit 1: skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown symbol offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) (appears to hold array of floats) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex groups offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown offset (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face groups:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bone groups count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte bone group IDs array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown1 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown1 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unknown1:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face group descriptor count&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to face group descriptors offset array&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 4-byte Unknown2 array&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Face array descriptor:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 1: vertex index format: 0=byte, 1=short)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex index array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex index array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vertex group objects come in one of several formats, specified by the flags field.&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000001: (?)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000001)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Type ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ? (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex group format 0x40000002:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (0x40000002)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex array size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to vertex array&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex format size (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown3 count&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to 0x40000001 offset array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9819</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9819"/>
		<updated>2014-09-10T16:18:50Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* SOBJ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. The number of entries can vary (probably based on the version?), but are always in the following order. Any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| X (float), Y (float), Z (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9812</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9812"/>
		<updated>2014-09-08T18:47:03Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* TXOB */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. There are always sixteen entries; any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9811</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9811"/>
		<updated>2014-09-08T18:40:35Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* TXOB */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. There are always sixteen entries; any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Mipmap levels&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9810</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9810"/>
		<updated>2014-09-08T17:14:18Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* CMDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. There are always sixteen entries; any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags (bit 7: hasSkeletonSobj)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to model name&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Animation Types DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x18&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 0x30&lt;br /&gt;
| Matrix 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of MTOB DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Vertex Info SOBJ entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Vertex Info SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of Unknown DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to Unknown DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Skeleton Info SOBJ offset (self-relative) [only present if flag bit 7 is set]&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8+[0xB8]&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Vertex Info SOBJ self-relative offset list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9809</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9809"/>
		<updated>2014-09-08T16:34:02Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* DATA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry. There are always sixteen entries; any unused entries are zeroed.&lt;br /&gt;
&lt;br /&gt;
Typical entries:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! N&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Models&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Textures&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| LUTS (Material/Color/Shader look-up tables?)&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Cameras&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Lights&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Fog&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Environments&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Skeleton animations&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Texture animations&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Unknown animations&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in first DICT ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9808</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9808"/>
		<updated>2014-09-08T16:28:14Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* CGFX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Byte order mark: FFFE (little endian) or FEFF (big endian)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| CGFX header size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in first DICT ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* Another CGFX Format Description: [http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format) http://florian.nouwt.com/wiki/index.php/CGFX_(File_Format)]&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9758</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9758"/>
		<updated>2014-09-05T17:06:16Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* CMDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in first DICT ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9755</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9755"/>
		<updated>2014-09-04T22:10:19Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: LUTS section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== LUTS ==&lt;br /&gt;
&lt;br /&gt;
Appears to contain color lookup tables possibly for use with shaders.&lt;br /&gt;
&lt;br /&gt;
LUTS Header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;LUTS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| Seems to adhere to powers of 2 (width/height/flags?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| all zeroes ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to DICT (self-relative) ?&lt;br /&gt;
|}&lt;br /&gt;
All observed instances have an otherwise unreferenced DICT section immediately afterward (the last LUTS value being a 0x4, which may describe the relative position of that DICT), which appears to describe material specularity.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9754</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9754"/>
		<updated>2014-09-04T21:44:00Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* DATA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9753</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9753"/>
		<updated>2014-09-04T21:43:31Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* CMDL Header */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL ==&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model.&lt;br /&gt;
&lt;br /&gt;
CMDL Header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9749</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9749"/>
		<updated>2014-09-04T16:49:29Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* DICT */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL Header ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model. A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9748</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9748"/>
		<updated>2014-09-04T16:37:40Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: DICT offsets &amp;amp; unknown DICT data&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL Header ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model. A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=User:Planetarian&amp;diff=9747</id>
		<title>User:Planetarian</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=User:Planetarian&amp;diff=9747"/>
		<updated>2014-09-04T16:32:08Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: Created page with &amp;quot;I&amp;#039;m a wiki noob, please forgive any silliness =)&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I&#039;m a wiki noob, please forgive any silliness =)&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9746</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9746"/>
		<updated>2014-09-04T16:31:12Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: /* DATA */ ~~~~&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries in DICT N&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT N&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL Header ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model. A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9744</id>
		<title>CGFX</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=CGFX&amp;diff=9744"/>
		<updated>2014-09-04T16:29:24Z</updated>

		<summary type="html">&lt;p&gt;Planetarian: added info on the CGFX/DATA headers ~~~~&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.&lt;br /&gt;
&lt;br /&gt;
== CGFX ==&lt;br /&gt;
&lt;br /&gt;
CGFX header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CGFX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A typical CGFX file contains two main entries, beginning directly after the CGFX header: DATA and IMAG.&lt;br /&gt;
&lt;br /&gt;
== DATA ==&lt;br /&gt;
&lt;br /&gt;
DATA contains a list of DICT references.&lt;br /&gt;
The DATA header contains the entry counts and offsets for each DICT entry, and holds sixteen such references. Unused references are zero-padded.&lt;br /&gt;
&lt;br /&gt;
DATA header (for N = 0..15) :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DATA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| DATA Size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of DICT entries&lt;br /&gt;
|-&lt;br /&gt;
| 0xC +(N*8)&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to DICT&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DICT ==&lt;br /&gt;
&lt;br /&gt;
DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.&lt;br /&gt;
&lt;br /&gt;
DICT header :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;DICT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| DICT size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
DICT entry:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value (often offsets)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CMDL Header ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;CMDL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| CMDL section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to first DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Global scale vector (3 floats : x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| 0x4&lt;br /&gt;
| N/2, where N is the number of entries in SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to SOBJ list&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self-relative) to MTOB DICT&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4+[0xB4]&lt;br /&gt;
| 0x4*N*2&lt;br /&gt;
| SOBJ list; each word is an offset (self-relative) to an SOBJ structure&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CMDL is used to describe a 3D model. A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file.&lt;br /&gt;
The second DICT in the CMDL section contains offsets to MTOB objects.&lt;br /&gt;
&lt;br /&gt;
== SOBJ ==&lt;br /&gt;
&lt;br /&gt;
SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x3&lt;br /&gt;
| Flags ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| SOBJ type ? (0x10 = model, 0x02 = skeleton)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;SOBJ&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Y = Offset (self-relative) to bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x4&lt;br /&gt;
| X = Offset (relative to SOBJ magic) to SOBJ data structure (wrong ?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| N = Number of bone IDs in bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| 0x44+Y+0x14&lt;br /&gt;
| 0x4*N&lt;br /&gt;
| Bone correspondance array&lt;br /&gt;
|-&lt;br /&gt;
| X+0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| Face data format (?) : 0x1 = u8, 0x3 = u16&lt;br /&gt;
|-&lt;br /&gt;
| X+0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Face data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section size (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x5C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Vertex data section offset (self-relative)&lt;br /&gt;
|-&lt;br /&gt;
| X+0x68&lt;br /&gt;
| 0x1&lt;br /&gt;
| Vertex data format size (in bytes)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vertex format size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| X (float), Y (float), Z (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v1&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), (local) Bone IDs (4*u8), Bone weights (4*u8)&lt;br /&gt;
|-&lt;br /&gt;
| 0x28v2&lt;br /&gt;
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32), (local) Bone IDs (2*u8), Bone weights (2*u8)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Vertex format 0x28 (and possibly others) supports multiple bone assignment. In this case, the sum of all bone weights is 0x64.&lt;br /&gt;
&lt;br /&gt;
== TXOB ==&lt;br /&gt;
&lt;br /&gt;
TXOBs are contained within MTOBs. They can describe textures; if such is the case, then their structure is as follows :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;TXOB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Texture format ID (see table below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture height (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture width (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data size&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture data offset (self-relative)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Texture format ID&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|RGBA8&lt;br /&gt;
|-&lt;br /&gt;
|0x1&lt;br /&gt;
|RGB8&lt;br /&gt;
|-&lt;br /&gt;
|0x2&lt;br /&gt;
|RGBA5551&lt;br /&gt;
|-&lt;br /&gt;
|0x3&lt;br /&gt;
|RGB565&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|RGBA4&lt;br /&gt;
|-&lt;br /&gt;
|0x5&lt;br /&gt;
|LA8&lt;br /&gt;
|-&lt;br /&gt;
|0x6&lt;br /&gt;
|HILO8&lt;br /&gt;
|-&lt;br /&gt;
|0x7&lt;br /&gt;
|L8&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|A8&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|LA4&lt;br /&gt;
|-&lt;br /&gt;
|0xA&lt;br /&gt;
|L4&lt;br /&gt;
|-&lt;br /&gt;
|0xB&lt;br /&gt;
|A4 ?&lt;br /&gt;
|-&lt;br /&gt;
|0xC&lt;br /&gt;
|ETC1 (see notes below)&lt;br /&gt;
|-&lt;br /&gt;
|0xD&lt;br /&gt;
|ETC1A4 ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every texture format has its texture data divided into 8x8 tiles. See [[SMDH#Icon_graphics|SMDH]] for more information.&lt;br /&gt;
ETC1 is a compressed texture format which compresses blocks of 4x4 pixels into u64s. These u64 are traditionally stored in big endian; however, nintendo&#039;s implementation stores them in little endian. ETC1 textures are stored in 8x8 tiles; decompressed 4x4 therefore have to be organized accordingly. See [https://gist.github.com/smealum/8897237] for implementation example.&lt;br /&gt;
&lt;br /&gt;
== Skeleton data ==&lt;br /&gt;
&lt;br /&gt;
Skeleton data is stored in an array. Each entry is 0xE0 bytes in length and organized this way :&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset (self relative) to name symbol&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Parent joint ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Signed offset (self-relative) to parent joint&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0xC&lt;br /&gt;
| Angle vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0xC&lt;br /&gt;
| Position vector (floats, x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x30&lt;br /&gt;
| Transformation matrix (4x3)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x30&lt;br /&gt;
| Identity matrix ? (4x3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry stores the joint transformation data twice; once as angle/position vectors and once as a transformation matrix. Each entry also stores a second matrix which appears to always be identity. (?)&lt;br /&gt;
&lt;br /&gt;
== CANM ==&lt;br /&gt;
&lt;br /&gt;
CANMs are used to store skeletal animation data.&lt;/div&gt;</summary>
		<author><name>Planetarian</name></author>
	</entry>
</feed>