A model represents a collection of 3d shape data, material data, and a skeleton.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x4
|
u32
|
Magic, always "FMDL"
|
0x4
|
0x4
|
u32
|
|
0x8
|
0x8
|
const char* (NW)
|
Model name
|
0x10
|
0x8
|
const char* (NW)
|
|
0x18
|
0x8
|
ResSkeleton*
|
Skeleton
|
0x20
|
0x8
|
ResVertex*
|
Vertex array
|
0x28
|
0x8
|
ResShape*
|
Shape array
|
0x30
|
0x8
|
nn::util::ResDic*
|
Shape dictionary
|
0x38
|
0x8
|
ResMaterial*
|
Material array
|
0x40
|
0x8
|
nn::util::ResDic*
|
Material dictionary
|
0x48
|
0x8
|
ResShaderReflection*
|
Shader reflection array
|
0x50
|
0x8
|
Gfx User Data*
|
User data array
|
0x58
|
0x8
|
nn::util::ResDic*
|
User data dictionary
|
0x60
|
0x8
|
void *
|
Runtime user pointer
|
0x68
|
0x2
|
u16
|
Vertex count
|
0x6a
|
0x2
|
u16
|
Shape count
|
0x6c
|
0x2
|
u16
|
Material count
|
0x6e
|
0x2
|
u16
|
Shader reflection count
|
0x70
|
0x2
|
u16
|
User data count
|
0x72
|
0x6
|
|
|
Vertex (nn::g3d2::ResVertex)
A ResVertex references a collection of vertex buffers in the GPU region. Reflection and settings are provided for the vertex buffers and attributes. Runtime object memory is provided to initialize graphics api objects for the vertex buffers.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x4
|
u32
|
Magic "FVTX"
|
0x4
|
0x4
|
u32
|
|
0x8
|
0x8
|
ResVertexAttribute*
|
Vertex atribute array
|
0x10
|
0x8
|
nn::util::ResDic*
|
Vertex attribute dictionary
|
0x18
|
0x8
|
void *
|
Runtime memory pool pointer
|
0x20
|
0x8
|
void *
|
Runtime vertex buffer array (0x48 bytes of zeroed memory per vertex buffer)
|
0x28
|
0x8
|
void **
|
Runtime user vertex buffer array
|
0x30
|
0x8
|
nn::gfx::BufferInfo*
|
Vertex buffer info array
|
0x38
|
0x8
|
ResVertexBufferStride*
|
Vertex buffer stride array
|
0x40
|
0x8
|
void *
|
Runtime user pointer
|
0x48
|
0x4
|
u32
|
Base offset of vertex data in GPU region, relative to start of GPU region
|
0x4c
|
0x1
|
u8
|
Vertex attribute count
|
0x4d
|
0x1
|
u8
|
Vertex buffer count
|
0x4e
|
0x2
|
u16
|
Index of this section in parent ResModel
|
0x50
|
0x4
|
u32
|
Vertex count
|
0x54
|
0x2
|
u16
|
|
0x56
|
0x2
|
u16
|
Alignment of vertex buffer data in GPU region
|
ResVertexAttribute
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
const char* (NW)
|
Attribute name
|
0x8
|
0x4
|
u32, nn::gfx::AttributeFormat
|
Attribute format
|
0xc
|
0x2
|
u16
|
Buffer offset
|
0xe
|
0x1
|
u8
|
Buffer index
|
0xf
|
0x1
|
u8
|
Indicates whether this is a dynamic vertex attribute for shape blending
|
ResVertexBufferStride
Unused bytes might indicate nn::gfx::VertexBufferInfo.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x4
|
u32
|
Stride
|
0x4
|
0x4
|
u32
|
Divisor
|
0x8
|
0x4
|
u32
|
|
0xc
|
0x4
|
u32
|
|
Shape (nn::g3d2::ResShape)
A shape represents 3d mesh data. Either via a set of level-of-detail meshes into the vertex buffers of a ResVertex, or alternatively in v10.2.0 onwards, a set of meshlet buffers.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x4
|
u32
|
Magic "FSHP"
|
0x4
|
0x4
|
u32
|
Flags
|
0x8
|
0x8
|
const char* (NW)
|
Shape name
|
0x10
|
0x8
|
ResVertex*
|
Referenced vertex
|
0x18
|
0x8
|
ResMesh* or ResMeshlet*
|
Level-of-detail mesh array, or if flags bit 4 is set, a ResMeshlet
|
0x20
|
0x8
|
u16*
|
Skinning bone index array
|
0x28
|
0x8
|
ResKeyShape*
|
Key shape array
|
0x30
|
0x8
|
nn::util::ResDic*
|
Key shape dictionary
|
0x38
|
0x8
|
ResBounding*
|
Bounding box array
|
0x40
|
0x8
|
ResBoundingSphere*
|
Bounding sphere array
|
0x48
|
0x8
|
void *
|
Runtime user pointer
|
0x50
|
0x2
|
u16
|
Index of this section in parent ResModel
|
0x52
|
0x2
|
u16
|
Material index
|
0x54
|
0x2
|
u16
|
Base bone index
|
0x56
|
0x2
|
u16
|
Vertex index
|
0x58
|
0x2
|
u16
|
Skin bone index count
|
0x5a
|
0x1
|
u8
|
Vertex skin weight count
|
0x5b
|
0x1
|
u8
|
Mesh count
|
0x5c
|
0x1
|
u8
|
Key shape count
|
0x5d
|
0x1
|
u8
|
Target attribute count
|
0x5e
|
0x2
|
u16
|
|
ResMesh
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
ResSubMeshRange*
|
Array of sub mesh ranges
|
0x8
|
0x8
|
void *
|
Runtime memory pool pointer
|
0x10
|
0x8
|
void *
|
Runtime index buffer memory (0x48 bytes of zeroed memory)
|
0x18
|
0x8
|
nn::gfx::BufferInfo*
|
Index buffer info
|
0x20
|
0x4
|
u32
|
Offset of index buffer in GPU region relative to start of GPU region
|
0x24
|
0x4
|
u32, nn::gfx::PrimitiveTopology
|
Primitive topology to use for drawing commands
|
0x28
|
0x4
|
u32, nn::gfx::IndexFormat
|
Index format to use in drawing commands
|
0x2c
|
0x4
|
u32
|
Index count
|
0x30
|
0x4
|
u32
|
Base vertex
|
0x34
|
0x2
|
u16
|
Sub mesh count
|
0x36
|
0x2
|
u16
|
|
ResSubMeshRange
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x4
|
u32
|
Offset of sub mesh relative to start of index buffer
|
0x4
|
0x4
|
u32
|
Index count of sub mesh
|
ResKeyShape
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x12
|
u8[18]
|
Relative key shape attribute location array
|
0x12
|
0x2
|
u8[2]
|
|
ResBounding
Offset
|
Size
|
Type
|
Description
|
0x0
|
0xc
|
Float3
|
Position
|
0xc
|
0xc
|
Float3
|
Extent
|
ResBoundingSphere
Offset
|
Size
|
Type
|
Description
|
0x0
|
0xc
|
Float3
|
Position
|
0xc
|
0x4
|
float
|
Radius
|
ResMeshlet
Currently only observed unused in Nintendo Switch Online: Playtest Program.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
...
|
|
0x8
|
0x8
|
void *
|
Runtime meshlet buffer array (0x48 bytes of zeroed memory per meshlet buffer)
|
0x10
|
0x8
|
nn::gfx::BufferInfo*
|
Meshlet buffer info array
|
0x18
|
0x8
|
s64 *
|
Meshlet buffer memory offset array, each entry relative to start of GPU region
|
0x20
|
0x24
|
...
|
|
0x44
|
0x1
|
u8
|
Meshlet buffer count
|
0x45
|
0x3
|
...
|
|
Shader Reflection
A ResShaderReflection provides reflection for resolving material parameter data for a shader inside a bfsha shader archive.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
const char* (NW)
|
Shader archive name
|
0x8
|
0x8
|
const char* (NW)
|
Shader name
|
0x10
|
0x8
|
ResRenderInfo*
|
Render info array
|
0x18
|
0x8
|
nn::util::ResDic*
|
Render info dictionary
|
0x20
|
0x8
|
ResShaderParam*
|
Material shader parameter array
|
0x28
|
0x8
|
nn::util::ResDic*
|
Material shader parameter dictionary
|
0x30
|
0x8
|
nn::util::ResDic*
|
Vertex attribute dictionary
|
0x38
|
0x8
|
nn::util::ResDic*
|
Sampler dictionary
|
0x40
|
0x8
|
nn::util::ResDic*
|
Static shader option dictionary
|
0x48
|
0x2
|
u16
|
Render info count
|
0x4a
|
0x2
|
u16
|
Shader parameter count
|
0x4c
|
0x2
|
u16
|
Shader parameter data size
|
0x4e
|
0xa
|
u8[10]
|
|
ResRenderInfo
Render info provides reflection for CPU-side rendering parameters.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
const char* (NW)
|
Render info name
|
0x8
|
0x1
|
u8
|
Render info data type
|
0x9
|
0x7
|
u8[7]
|
|
Render info data type
Name
|
Value
|
Description
|
Int
|
0
|
Value is a 32-bit integer
|
Float
|
1
|
Value is a 32-bit float
|
String
|
2
|
Value is an NW string pointer
|
ResShaderParam
ResShaderParam's compose a user generated structure layout for a material uniform buffer. Shader parameters can be animated through material animations.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
u32(*)(void*,const void*,ResShaderParam*, void*)
|
Runtime conversion function for data types requiring runtime conversion of a CPU representation to a GPU representation
|
0x8
|
0x8
|
const char* (NW)
|
Shader parameter name
|
0x10
|
0x2
|
u16
|
Shader parameter offset
|
0x12
|
0x1
|
u8
|
Shader parameter data type
|
0x13
|
0x5
|
u8[5]
|
|
Shader parameter data type
Name
|
Value
|
Description
|
Bool
|
0
|
|
Bool2
|
1
|
|
Bool3
|
2
|
|
Bool4
|
3
|
|
Int
|
4
|
|
Int2
|
5
|
|
Int3
|
6
|
|
Int4
|
7
|
|
UInt
|
8
|
|
UInt2
|
9
|
|
UInt3
|
10
|
|
UInt4
|
11
|
|
Float
|
12
|
|
Float2
|
13
|
|
Float3
|
14
|
|
Float4
|
15
|
|
Matrix2x2
|
17
|
|
Matrix2x3
|
18
|
|
Matrix2x4
|
19
|
|
Matrix3x2
|
20
|
|
Matrix3x3
|
21
|
|
Matrix3x4
|
22
|
|
Matrix4x2
|
23
|
|
Matrix4x3
|
24
|
|
Matrix4x4
|
25
|
|
Srt2d
|
26
|
|
Srt3d
|
27
|
|
SrtTexture
|
28
|
|
Material (nn::g3d2::ResMaterial)
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x4
|
u32
|
Magic "FMAT"
|
0x4
|
0x4
|
u32
|
Flags (bit 0 = is visible)
|
0x8
|
0x8
|
const char* (NW)
|
Material name
|
0x10
|
0x8
|
ResStaticShaderVariation*
|
Static shader variation
|
0x18
|
0x8
|
void**
|
Runtime texture view pointer array
|
0x20
|
0x8
|
const char** (NW)
|
Texture name array
|
0x28
|
0x8
|
void*
|
Runtime sampler array (0x78 bytes of zeroed memory per sampler)
|
0x30
|
0x8
|
nn::gfx::SamplerInfo*
|
Sampler info array
|
0x38
|
0x8
|
nn::util::ResDic*
|
Sampler dictionary
|
0x40
|
0x8
|
void*
|
Render info value array
|
0x48
|
0x8
|
u16*
|
Render info value count array
|
0x50
|
0x8
|
u16*
|
Render info value offset array
|
0x58
|
0x8
|
void*
|
Shader parameter value array
|
0x60
|
0x8
|
s32*
|
Runtime shader parameter material uniform buffer offset array
|
0x68
|
0x8
|
u64
|
|
0x70
|
0x8
|
Gfx user data*
|
User data array
|
0x78
|
0x8
|
nn::util::ResDic*
|
User data dictionary
|
0x80
|
0x8
|
u32 *
|
Shader parameter runtime convert bit array
|
0x88
|
0x8
|
void*
|
Runtime user pointer
|
0x90
|
0x8
|
u64*
|
Runtime sampler descriptor slot array
|
0x98
|
0x8
|
u64*
|
Runtime texture view descriptor slot array
|
0xa0
|
0x2
|
u16
|
Index of this section in parent ResModel
|
0xa2
|
0x1
|
u8
|
Sampler count
|
0xa3
|
0x1
|
u8
|
Texture count
|
0xa4
|
0x2
|
u16
|
Is force calculate material
|
0xa6
|
0x2
|
u16
|
User data count
|
0xa8
|
0x2
|
u16
|
Render info value size
|
0xaa
|
0x2
|
u16
|
Runtime material uniform buffer size
|
0xac
|
0x4
|
u32
|
|
ResStaticShaderVariation
A material references a ResStaticShaderVariation which selects the material's static shader variation out of the shader referenced by a ResShaderReflection.
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
ResShaderReflection*
|
Shader reflection
|
0x8
|
0x8
|
const char** (NW)
|
Vertex attribute name array, of those used in this specific static shader variation
|
0x10
|
0x8
|
u8*
|
Vertex attribute index array
|
0x18
|
0x8
|
const char** (NW)
|
Sampler name array, of those used in this specific static shader variation
|
0x20
|
0x8
|
u8*
|
Sampler index array
|
0x28
|
0x8
|
u32*
|
Static shader option choice packed bool array
|
0x30
|
0x8
|
const char** (NW)
|
Static shader option choice string array
|
0x38
|
0x8
|
u16*
|
Static shader option index array
|
0x40
|
0x4
|
u32
|
|
0x44
|
0x1
|
u8
|
Vertex attribute count
|
0x45
|
0x1
|
u8
|
Sampler count
|
0x46
|
0x2
|
u16
|
Static shader option bool count
|
0x48
|
0x2
|
u16
|
Total static shader option count
|
0x4a
|
0x6
|
u8[6]
|
|