Wireframes
-
I’m here to share a success story. After some discussion over at TLR (before Crazy took the database), Dev, OP, LS, and myself were involved in a discussion on wireframes. I decided to play around a bit when I realized that wireframes are stored as pairs of vertices to make a line. I thought that I could craft a wireframe by using certain vertices from the CMP model (this is what vanilla ships do). I was right. Take a look at my result:
This resulted in a much cleaner wireframe than the one Dev’s makewire did, which was (excluding one port wing) this:
Great. Very well done. I did, however, encounter a problem. It took three days to make! That’s working on it almost constantly. I was dull, tedious, and took forever. It went like this: I found out, via MilkShape, what the number of a given vertex was, converted it to hex, put it into the VWireData with a hex editor, finding an adjacent vertex, finding out its number, converting to hex, putting it in to the VWireData with a hex editor, repeat ad nausum. I swear by the end of it my brain forgot how to do decimal. Here was the final data for the wireframe for just the main hull:
VWireData Section
–---------------VWireData header :
header_size : 0x00000010 (always 0x00000010
vmeshlib_crc_id : 0x05FDBA27 #1 (crc of .vms used for vertices)
vertex_offset : 0x0000 #2
no_vertices : 59 #3
no_ref_vertices : 178 #4
max_vert_no_plus_one : 414 #5VWireData lines :
Vert -> Vert
159 -> 15
15 -> 43
15 -> 20
20 -> 40
43 -> 40
20 -> 203
203 -> 202
202 -> 206
202 -> 204
204 -> 199
204 -> 217
217 -> 26
20 -> 19
41 -> 56
56 -> 61
199 -> 26
26 -> 25
25 -> 206
206 -> 199
159 -> 160
160 -> 154
160 -> 157
157 -> 153
157 -> 158
158 -> 22
158 -> 159
15 -> 16
43 -> 48
48 -> 53
152 -> 23
23 -> 22
22 -> 151
151 -> 152
22 -> 10
10 -> 11
11 -> 26
26 -> 25
25 -> 23
10 -> 6
6 -> 8
8 -> 27
8 -> 33
33 -> 18
18 -> 17
17 -> 32
32 -> 6
6 -> 412
412 -> 413
413 -> 8
412 -> 315
315 -> 319
319 -> 413
315 -> 259
259 -> 264
264 -> 319
264 -> 18
259 -> 17
53 -> 116
116 -> 122
122 -> 61
23 -> 102
116 -> 102
102 -> 103
122 -> 103
103 -> 25
18 -> 20
17 -> 15
42 -> 47
47 -> 57
57 -> 58
47 -> 80
80 -> 79
79 -> 57
80 -> 93
93 -> 96
93 -> 54
54 -> 53
54 -> 116
54 -> 62
62 -> 96
96 -> 79
62 -> 122
62 -> 61
62 -> 57
47 -> 54
153 -> 154
154 -> 23
153 -> 22
203 -> 217Let me explain the # signs. #1 is the CRC of the mesh you use to make the wireframe. For Vanilla ships, as well as this one, it’s the same as the main mesh; before, I had to load several separate meshes into the CMP because this line referred to them. #2 is for ships with multiple components. The main part of the ship starts with the first vertex, but the other parts start at another one. My port wing, for instance, started at around the 500th vertex. By setting this to the first vertex of the part the wireframe is for, it saves a lot of math. This number is the same as the one found in the VMeshRef for the particular part. #3 is the number of unique vertices, which can be somewhat of a pain to calculate. #4 is, as best as I can tell, the number of lines in the wireframe. This was rather easy to calculate. #5 is self-explanatory, the highest number vertex you use plus 1.
It was very easy to get a crash. My most common error was getting the vertices out of whack. They’re stored in two-byte hexadecimal numbers, so FF 00 is 255 (the numbers, as always, are reversed for some reason). I could easily get something like:
54 -> 54
Which means I left out or added an extra vertex. Generally, this would led to a crash once I clicked on the object, or tried to view its wireframe. Another common error was getting #4 wrong; if it was too high, FLModelTool shows several vertices with absurd numbers, often in the thousands (this would lead to a CTD upon launch from a base); if it was too low, the wireframe would be messed up, and it would either crash early or when I tried to exit the game. I only got #5 wrong once, and it led to a CTD upon launch. Getting #3 wrong led to a CTD upon trying to leave the game.
What really would help would be an editor that showed the data as it was displayed above. I’d still have to find the right vertex and calculate its number, but at least I could see what I was doing instead of an ocean of hex. GAH! I’m hoping LS (I think he pokes about here) can accomplish this. Otherwise, I have a hell of a lot of work ahead of me.
MK
-
Yes, I poke about here, I’m one of the admins. I will look over your info posted here, glad you reposted it.
-
mknote wrote:
What really would help would be an editor that showed the data as it was displayed above.Adoxas XML->UTF convertor pumps out the vmeshwire date in pretty much that format, very useful for changing the wires crc names aswell
-
Using the new 3ds Max .cmp exporter, it automatically creates a wireframe for you, so long as you include the wireframe model you’d like to be included. Ya, it’s pretty sweet
-
sumanuti wrote:
Can be also Pip3r’s MS-CMP exporter be used to make wireframe from SUR model (hitbox.cmp) and in UTF editor transfered to actual CMP file?Ya, that’s how you make a wireframe using Dev’s tool. You export the model you wish as a .cmp. You then take the .vms data and run it through Dev’s program, which spews out the .vms needed to make the wireframe work in game.
W0dk4’s and SilentAssassins tool allows you to place the model you wish into the .cmp directly with no fuss or fiddling. It’s great.