.CMP file format clarification
-
Hay, at the moment i am writing the .cmp file part of the modification guide and i have come up with a couple of holes in my knowledge of the format, so maybe some of you can help here are the things i have come up with so far:
-What does the three digit number at the end of the nodes in VMeshLibrary mean? Does it ever change from 112?
-In the Cons section what does sphere constraints do?
-What does the Number at the end of the .3db parts of the model mean, i think they are a crc for something but I don’t remember.
I will add anything else about the file format that i come up with. Also please don’t say that that knowledge is useless because on-one does that and it works without it, because i am trying to document everything!
Thanks
OzedEdit: Ok looking through VMeshData their are a couple things that need explaining, here they are:
Mesh type - What does the number mean/does it change
Surface type - same as above
Flexible Vertex Format - Is this connected to the 112 in the name/what does it actually do?
QtyRefVertex - How is this calculated?
Padding - does this ever change/what does it effect?
Normal X/Y/Z - Again What does this do/effectSorry guy’s for all those extra questions, i understand those last few are less about the .CMP file format and more about 3d/computer modeling.
Thanks
Ozed -
112 at end of node name, irrelevant, it is the FVF value
Mesh type & surf type, sorry, forgot
FVF - DirectX FVF format (Flexible Vertex Format) - this determines the layout of your vertices and directly matches what is in DX, it is bit-wise flags in the list below// Flexible vertex format bits // #define D3DFVF_RESERVED0 0x001 #define D3DFVF_POSITION_MASK 0x400E #define D3DFVF_XYZ 0x002 #define D3DFVF_XYZRHW 0x004 #define D3DFVF_XYZB1 0x006 #define D3DFVF_XYZB2 0x008 #define D3DFVF_XYZB3 0x00a #define D3DFVF_XYZB4 0x00c #define D3DFVF_XYZB5 0x00e #define D3DFVF_XYZW 0x4002 #define D3DFVF_NORMAL 0x010 #define D3DFVF_PSIZE 0x020 #define D3DFVF_DIFFUSE 0x040 #define D3DFVF_SPECULAR 0x080 #define D3DFVF_TEXCOUNT_MASK 0xf00 #define D3DFVF_TEXCOUNT_SHIFT 8 #define D3DFVF_TEX0 0x000 #define D3DFVF_TEX1 0x100 #define D3DFVF_TEX2 0x200 #define D3DFVF_TEX3 0x300 #define D3DFVF_TEX4 0x400 #define D3DFVF_TEX5 0x500 #define D3DFVF_TEX6 0x600 #define D3DFVF_TEX7 0x700 #define D3DFVF_TEX8 0x800 #define D3DFVF_LASTBETA_UBYTE4 0x1000 #define D3DFVF_LASTBETA_D3DCOLOR 0x8000 #define D3DFVF_RESERVED2 0x6000 // 2 reserved bits
112 is 0x002 D3DFVF_XYZ | 0x010 D3DFVF_NORMAL | 0x100 D3DFVF_TEX1
This means it will contain XYZ vertices, xyz normals & 1 UV map
QtyRefVertices is actually the index count * 3, divide by 3 to get the face index count (a face is a minimum of 3 vertices)
Hope that helps
-
-What does the Number at the end of the .3db parts of the model mean, i think they are a crc for something but I don’t remember.
Just a time stamp I think - YYMMDDHHMMSS.
Mesh type - What does the number mean/does it change
Surface type - same as aboveThey’re always 1 and 4 in the vanilla files, so I guess their meaning is largely irrelevant. … A quick look at the disassembly shows that mesh type must have bit 0 set; surface type seems to indicate how many vertices make a face (so with 4 it divides by 3).
Padding - does this ever change/what does it effect?
It’s padding, so it doesn’t matter what the value is and its effect is to align the next value (to improve processor performance).
-
The padding is actually part of the QtyRefVertex. This is one of those rare 24 bit values used in the CMPs. On some of the massive FL vanilla models you will find this is bit 16-23 of the indices count.
-
Alright, i think I’ve got that all (well writing it all in) you’ll both get credits for the respective parts. With the number at the end of the part, i have to disagree with you adoxa, when i compared the number as you have shown it with the time stamp in the Exporter Version.
I don’t really understanding 100% Mesh type and surface type, the mesh type must be 1? And how do you manage to get 3 from 4 for surface type? So with Mesh type and Surface type, if we where to edit them we could utilize quads but only quads in theory.
And with the padding, if the number is high then it will incorporate those bytes. Right?
Thanks, i will upload what i’ve got when i get all this down.
Ozed
-
If it is non-zero then you can treat it as a 24 bit number, if it’s 0 then simply use the count as a 16 bit number (WORD)
, your choice, I simply pad it into a 32 bit unsigned integer. -
Alright got the Padding stuff down packed, also i tried out my thought that you could use quads if you changed the surface type, and to my surprise, it didn’t crash! and the model appeared sort of normal, i guess it was getting four vertex values rather than the three that they where set out for, maybe once someone makes an exporter for a different modelling software (eg. Blender) that can use quads (milkshape can’t) maybe we could even get bezier curves and NURBS to work but that would really be stretching it.
I still don’t understand what the Mesh means or How 4 in surface type means 3 vertex’s is it that it cannot be an empty byte and that 1 means 0 vertex’s
Thanks
Ozed -
The material CRC is a dword, the start vertex, end vertex and vertex count are all words, so the pad is used to bring the total to 3 dwords. It’s strange that the pad is 0x00CC, but there’s lots about FL that’s strange…
Mesh type and surface type go something like this:
if (!(mesh_type & 1)) Log( "mesh in old format" ) int get_face_count( int surface_type, int vertex_count ) { switch (surface_type) { case 0: return 0; case 1: return vertex_count; case 2: return vertex_count / 2; case 3: return vertex_count - 1; case 4: return vertex_count / 3; case 5: return vertex_count - 2; case 6: return vertex_count - 2; } return 0; } ```Why would you think the .3db timestamp is related to the exporter version? Run UTFXML with the timestamps option and you'll see.
-
Alright, so with surface type = 5, it doesn’t really make quads it just subtracts 2 from the vertex count and messes up the model, strange that case 6 is the same as case 5 rather than following the pattern and dividing by 4, but who said it had to make sense? Does Mesh type use this as well?
Yes you are right about the time stamps sorry, I assumed that Exporter Version was an actual time stamp for the model, don’t know why though, kind of silly now looking back at it
Great to get all this info, keep it coming guys, i still need to know what a sphere constraint does.
Any feedback for the CMP readme? A think it’s around 1200 words so far and haven’t gone into animation or the Part files
Ozed
Edit: Ok a couple thing I’ve come up with, that i don’t know what do:
First with hardpoints, what does the Axis node do?
What does the Offset do in the Revs node?
What does the bounding box do in VMeshRef?
With animations, does the Sc_end anim get played after every animation to return it to it’s original position? or is the animation to say open the bay doors played in reverse to close them?Ozed
-
Any feedback for the CMP readme?
Run it through a spell checker…
First with hardpoints, what does the Axis node do?
I thought it determines how the hardpoint moves, but after doing some testing for the hardpoint display in the UTF Editor, it doesn’t seem to do anything.
-
Run it through a spell checker…
Ha yeah i’ll do that once i get everything written down.
OK, the questions that i still need answering are:
What does sort of movement does the sphere node control.
What does the Offset do in the Revs node?
What does the bounding box do in VMeshRef?And their are a couple things that i have come up with that some will find interesting.
1. Their are several models that use/have FVF’s that aren’t standard, such as li_01_manhattan_cityscape.cmp and repair.cmp, they both have FVF’s of 0x212 and both contain 2 sets of UV coordinates. Note that manhatten has more vertex’s and tri’s in the 0x212 version when compared to the 0x112, but in repair the 0x212 version has considerably less vertex’s/tri’s.
2. In the animation nodes, the header’s types section doesn’t change from 1, whether rev or pris, with one exception. In Manhattan again, the one joint map that controls banner3 which is the only one which is under the sphere node has a type of 4. Furthermore, the header says it has 16 frames and an interval of -1 (variable frame timing) but the frames node has 80 lines, read that again 80! What does this mean, well there where 5 lines per frame, the one for the variable timing and the four controlling well i don’t know, four variable controlling movement, maybe, i don’t know. But the important thing is that the four lines is the same as the type value.
Ok i think that’s it…
Maybe some of that info will help other’s but i still need those questions answered that are above.
Ozed
-
2. In the animation nodes, […] But the important thing is that the four lines is the same as the type value.
Coincidence. It’s a bit mask - have a look at UTFXML\channel.cpp in the XML Project. I got distracted before adding this to the UTF Editor.
-
Looking at channel.ccp seems to back what i though that it effects the number of values for each frame, just that the number wasn’t an exact reflect-ant of the number of floats per frame. Anyway the questions that still need answering, and remember I don’t want to rely on adoxa for all the answers, are:
What does sort of movement does the sphere node control.
What does the Offset do in the Revs node?
What does the bounding box do in VMeshRef?
Are the values in the Axis rotate a decimal percentage of the measure written in the frames?
Does freelancer actually use the switch2 values for LoD switching, or are they just ignored for the value in the ini’s?Thanks
Ozed -
I’ve started this where I will place all of the stuff I decompiled out of the UTF format, feel free to add to it, I will link it in when I see the post.
http://digitalbrilliance.com/modules.php?name=Forums&file=viewtopic&p=3482#3482
-
Yeah sure i can help you out Lancer, but first i want to get at least the .CMP file format finished and hopefully shiparch.ini (shiparch should be a lot quicker than CMP since it is far more understood). Again guys going over everything (and there’s a lot) i am missing a couple extra things, all the stuff before and extra:
What does sort of movement does the sphere node control.
What does the Offset do in the Revs node?
What does the bounding box do in VMeshRef?
Are the values in the Axis rotate a decimal percentage of the measure written in the frames?
Does freelancer actually use the switch2 values for LoD switching, or are they just ignored for the value in the ini’s?
Mesh type, still don’t know what that does (sorry adoxa, understood surface though!)
The .cam node and everything that is under it, that is just the values for the camera when in cockpit mode right? Can you explain how they work?Lancer you can look at what i’ve got done for the CMP and find all the things you need to add to your site! Be warned, i haven’t done a spell check and some explanations will need simplifying but you should get the idea.
Ozed
-
Basically, mesh_type = 1 good, anything else bad. That’s just from where it reads it, though, I haven’t run it through the debugger to see if it’s used anywhere else.
What is the “.cam node”?
-
Ha that’s all i needed for Mesh type!
the .cam files/nodes only exist in .cmp file that are used for cockpits, for example in:
DATA\COCKPITS\LIBERTY\MODELS\li_elite_cockpit.cmp
There is a node called “cockpit cam020620232716.cam”, which is the cockpits .cam node, in it, it has fovx, fovy, Znear and Zfar values and i need to know what these do.
Also looking at the manhatten cityscape there is a MaterialAnim node, i’m guessing this is a whole new can of worms, does anyone understand Material Animation?
So the question’s are:
What does sort of movement does the sphere node control.
What does the Offset do in the Revs node?
What does the bounding box do in VMeshRef?
Are the values in the Axis rotate a decimal percentage of the measure written in the frames?
Does freelancer actually use the switch2 values for LoD switching, or are they just ignored for the value in the ini’s?
Mesh type, still don’t know what that does (sorry adoxa, understood surface though!)
The .cam node and everything that is under it, that is just the values for the camera when in cockpit mode right? Can you explain how they work?Thanks
Ozed
6/17