I'm currently trying to work out some of the different structures of the files within the pk2's
.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. Havn't look into those int bsrType; rages 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:.bms Structure 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) { vertCount * 6 of unkown data. Have not looked into this yet } int faceCount for(int i = 0; i < faceCount;i++) { int16[i,3] faces; }Code:.bmt structure 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:.ban structure I havn't looked into these very much yet. Basicly everything is guessed right now. 12 byte header int unk int unk string name; of the animation int timeInMs; I assume this is the duration of the animation int framesPerSecond? just a guess (seems to always be 30) int unk int keyframeCount; pure guess. but would make sense int[keyframeCount] keyframes; int boneCount for(int i = 0; i < boneCount;i++) { string boneName; int count; same as keyframeCount for(int p = 0; p < count;p++) { Vec4 rotation; Vec3 transform; } } //End of file
.bsk structure
So thanks to this post
I will edit my post as i learn more about the structures.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.




Reply With Quote![[WIP] Silkroad File Formats (.bsr .bms .bmt .bsk .ban )](http://ragezone.com/hyper728.png)


