I'm currently trying to work out some of the different structures of the files within the pk2's
[Only registered and activated users can see links. Click Here To Register...]
.bsr Resource file. References meshes, materials, animations, skeletons etc.
.bms Meshes
.bmt Material file that references different .ddj textures
.ban Animation
.bsk Skeleton
.bsr Structure
.bms Structure
.bmt structure
.ban structure
.bsk structure
So thanks to this [Only registered and activated users can see links. Click Here To Register...]
I will edit my post as i learn more about the structures.
Please excuse the poor structure of my post and also my bad english.
[Only registered and activated users can see links. Click Here To Register...]
.bsr Resource file. References meshes, materials, animations, skeletons etc.
.bms Meshes
.bmt Material file that references different .ddj textures
.ban Animation
.bsk Skeleton
.bsr Structure
Code:
12 byte Header 52 byte unknown. Havnt look into those int bsrType; ranges from 0x20000 to 0x20006 (could be more) string bsrTitle; From here on out they seem to differ depending on their bsrType 28 byte unknown string meshReference Not in every .bsr. References a .bms file. Although the .bms file referenfces come later. float[2,6] boundingBox; outlines the mesh int unknown; int bmtFileCount; int unknown; string[btmFileCount] paths to the different materials used on the model int bmsFileCount; string[bmsFileCount] paths to the different meshes used int unknown int unknown int banFileCount; string[banFileCount] paths to the different animation files int bskFileCount; should be 1 for most models string[bskFileCount] path to the skeleton files. this is how far im parsing these files right now
Code:
12 Bytes header
int index; position in the stream where the vertex information start
48 bytes uknown
int lightmapResolution; as far as i can tell. didnt check yet
int uknown
string meshname;
string materialname;*
int unknown;
int vertexCount;
for(int i = 0; i < vertexCount;i++)
{
float[3] vertices
float[3] normals
float[2] textureUV
if(lightmapResolution != 0)
{
float[2] lightmapUV
}
12 bytes uknown //didnt look into this yet
}
if(lightmapResolution != 0)
{
string lightmapPath;
}
int boneCount;*
string[boneCount] bones
if(boneCount != 0)
{
//This is needed for animation.
for(i = 0; i < vertexCount;i++)
{
byte BoneIndex_1 //Index of bonename in array above
ushort BoneWeight_1 //used for animation to weigh the two transformation matricies
byte BoneIndex_2
ushort BoneWeight_2
}
}
int faceCount
for(int i = 0; i < faceCount;i++)
{
int16[i,3] faces;
}
Code:
12 byte header
int textureCount
for(int i = 0; i < textureCount;i++)
{
string name; // will be used in the mesh to identify which texture to use
48 bytes of unknown data
string texturefilename;
7bytes of unkown data
}
Code:
12 byte header
int unk
int unk
string name; //name of the animation
int duration
int framesPerSecond
int unk
int keyframeCount;
int[keyframeCount] keyframes; //timings of the keyframes, so you can interpolate between two poses.
int boneCount //Amount of bones that have transformations that are diffrent from their bind poses.
for(int i = 0; i < boneCount;i++)
{
string boneName;
int count; same as keyframeCount
for(int p = 0; p < count;p++)
{
Quaternion rotation;
Vector3 translation;
//These two together give you the transformation Matrix relative to it's partent bone/joint.
}
}
//End of file
So thanks to this [Only registered and activated users can see links. Click Here To Register...]
Code:
12 byte header
int boneCount;
for(int i = 0; i < boneCount;i++)
{
if(not first bone)
{
int count; // Number of bones with same parent bone. Bone itself included
for(int x = 0; x < count; x++)
{
string boneName;
}
}
byte unk;
string boneName;
string parentBoneName;
//This next part is taken from Cruor's post.
Vec4 rotationToParent;
Vec3 translationToParent;
Vec4 rotationToOrigin;
Vec3 translationToOrigin
Vec4 rotationUnkown;
Vec3 translationUnkown;
}
int unk;
int unk;
int unk;
//End of file
Please excuse the poor structure of my post and also my bad english.