-
Notifications
You must be signed in to change notification settings - Fork 5
bMesh
Lukas Dürrenberger edited this page Sep 19, 2021
·
5 revisions
bMesh files, which I assume stands for Binary Mesh are used for the majority of the meshes in Firefall, with R5A files holding some UI meshes and the terrain geo being in another.
- Reader and Writer have been implemented in FauFau: BMesh.cs
The format is chunk based. Below is the format of each section/chunk or data types.
ID : 5 chars equaling "bMesh"
Version : a short for the version of the format
Padding : 1 byte // Must be 0
X : a float
Y : a float
Z : a float
U : a float
V : a float
X : an unsigned byte
Y : an unsigned byte
Z : an unsigned byte
d : an unsigned byte
v1 : an int32
v2 : an int32
v3 : an int32
Length : an int32
String[Length] : an ubyte array
Name : a bMeshString
FaceRangeStart : an int32
FaceRangeEnd : an int32
VertRangeStart : an int32
VertRangeEnd : an int32
Min : a Vertex (or 3 floats if you prefer)
Max : a Vertex (or 3 floats if you prefer)
NumMaterials : an int32 saying how many Materials follow
Materials[NumMaterials] : an array of Materials
Pseudo code
Header head = Read();
Bounds bounds = Read();
short padding = Read();
int32 NumVerts = Read();
Vertex Vertices[NumVerts] = Read();
int32 unknown = Read():
int32 NumVertsNormals = Read();
Vec4 Normals[NumVerts] = Read();
int32 NumUVs = Read();
UV UVs[NumVerts] = Read();
int32 marker = Read();
if (marker != 0)
{
Seek(marker*8); // Not sure what these are, most likley related to bones
}
else
{
int32 NumTangents = Read();
Vec4 Tangents[NumTangents] = Read();
}
Int32 marker = Read();
if (marker != 0)
{
Seek(marker*4); // Not sure what these are, bone weights?
int32 unknow = Read(); // Seems to always be 0
int32 NumIndices = Read();
int32 Indices[NumIndices] = Read();
// Bone data normaly follows?
}
else
{
int32 NumIndices = Read();
int32 Indices[NumIndices] = Read();
}
// That was as much as I figured out
The normals and tangents seem to be encoded in some compressed format, I'm not entirely sure the right way to uncompress them but below is what I did that looks somewhat ok
x = (x/256*100);
File version 30 is the most current any version less is out dated and the engine will attpemt to update.