Updated milkshape exporter
by Chris Robertson · 06/19/2004 (4:40 pm) · 257 comments
Last Updated: 12/11/08
Download the new milkshape exporter here.
You must be using at least Milkshape 1.8.3 to use this exporter.
Features:
- Triangle stripper
- Multiple collision meshes
- LOS collision meshes
- Full level of detail control
- Blended animations
- Mesh visibility animation
- Auto-details
- Auto-billboards
- Easy to use sequence/mesh/material property editor
Geometry
Any mesh whos name begins with 'Collision' will be interpreted as a collision mesh. These meshes should have a negative detail level. Any mesh whose name begins with 'LOScol' will be interpreted as a line of sight collision mesh.
LOD
The exporter supports any number of detail levels per mesh. Detail levels are stored as numbers at the end of the mesh name. If your meshes already have numbers at the end of their name, you will need to add a non numerical character at the end, or they will be interpreted as LOD. eg.
body0 will produce a mesh called 'body' with detail level 0
foot12d5 will produce a mesh called 'foot12d' with detail level 5
The original milkshape exporter output shapes with all visible meshes at detail level 0. If you are not making use of LOD, this is the best value to give to visible meshes. Meshes with a negative LOD will be exported but are not visible (eg collision meshes).
Sequences
Sequence special material naming convention has changed, as there is much more information to pack into the name now. Old sequence names are supported, but will be converted to the new convention when you apply changes to the model. All sequence information is now stored in the comment string of the special material.
A '*' at the start of the name indicates that this is a sequence special material
The best way to edit sequences is via the exporter dialog. Just add/select a sequence, then press the Edit button.
Configuration Files
The exporter supports configuration files using the same format as 3dsmax. The configuration file should use the same name as the exported dts shape. eg. use a configuration file called shape.cfg when exporting shape.dts. For most shapes you will not need to use a configuration file, the defaults provided by the exporter will be sufficient.
Documentation
Some alpha documentation is located within the zip file. It is based mostly on the existing 3dsmax/maya documentation and is still a work in progress. If you find any errors, or would like to add something, please feel free to contact me.
Known Issues
- Alpha sorting is supported (in that sorted meshes are passed through the sorting code), but I have not actually seen it working yet. When you view a sorted mesh in the show tool, some of the faces have been split (the poly count goes up), but the faces still appear sorted incorrectly.
I have tried hard to make this exporter fully functional, but it is quite possible that there are still problems with it. I advise you to SAVE your work before you export it, and because the exporter modifies the ms3d file to apply your changes, you should backup your files before using it. If you find something wrong, or even have a suggestion, please let me know.
Download the new milkshape exporter here.
You must be using at least Milkshape 1.8.3 to use this exporter.
Features:
- Triangle stripper
- Multiple collision meshes
- LOS collision meshes
- Full level of detail control
- Blended animations
- Mesh visibility animation
- Auto-details
- Auto-billboards
- Easy to use sequence/mesh/material property editor
Geometry
Any mesh whos name begins with 'Collision' will be interpreted as a collision mesh. These meshes should have a negative detail level. Any mesh whose name begins with 'LOScol' will be interpreted as a line of sight collision mesh.
LOD
The exporter supports any number of detail levels per mesh. Detail levels are stored as numbers at the end of the mesh name. If your meshes already have numbers at the end of their name, you will need to add a non numerical character at the end, or they will be interpreted as LOD. eg.
body0 will produce a mesh called 'body' with detail level 0
foot12d5 will produce a mesh called 'foot12d' with detail level 5
The original milkshape exporter output shapes with all visible meshes at detail level 0. If you are not making use of LOD, this is the best value to give to visible meshes. Meshes with a negative LOD will be exported but are not visible (eg collision meshes).
Sequences
Sequence special material naming convention has changed, as there is much more information to pack into the name now. Old sequence names are supported, but will be converted to the new convention when you apply changes to the model. All sequence information is now stored in the comment string of the special material.
A '*' at the start of the name indicates that this is a sequence special material
The best way to edit sequences is via the exporter dialog. Just add/select a sequence, then press the Edit button.
Configuration Files
The exporter supports configuration files using the same format as 3dsmax. The configuration file should use the same name as the exported dts shape. eg. use a configuration file called shape.cfg when exporting shape.dts. For most shapes you will not need to use a configuration file, the defaults provided by the exporter will be sufficient.
Documentation
Some alpha documentation is located within the zip file. It is based mostly on the existing 3dsmax/maya documentation and is still a work in progress. If you find any errors, or would like to add something, please feel free to contact me.
Known Issues
- Alpha sorting is supported (in that sorted meshes are passed through the sorting code), but I have not actually seen it working yet. When you view a sorted mesh in the show tool, some of the faces have been split (the poly count goes up), but the faces still appear sorted incorrectly.
I have tried hard to make this exporter fully functional, but it is quite possible that there are still problems with it. I advise you to SAVE your work before you export it, and because the exporter modifies the ms3d file to apply your changes, you should backup your files before using it. If you find something wrong, or even have a suggestion, please let me know.
About the author
#202
05/14/2006 (4:00 pm)
Anyone know if the newest milkshape release has this exporters powers integrated yet.. or should we still find the .dll from one of the older versions of the exporter?
#203
05/16/2006 (9:22 pm)
It doesn't have it, you'll have to add it.
#204
=Params::AnimationDelta//pretty sure I know this one-amount of difference in rotation value
=Params::SkinWeightThreshold//most especially this one!
=Params::SameVertTOL
=Params::SameTVertTOL
=Params::weightsPerVertex//and I'm sure this one is important too
Say I had data in the Scene, what would I need to do to these values to get it exporting the weighting, my current .dmp files always indicate a value of 1.00.
Rex
05/27/2006 (10:20 am)
Say, Chris. I'm interested in finding out about some of the configure file settings and multiple vertex weighting. I may be onto something that will allow the data to be placed within the Scene[while not rendering it]; and was curious about=Params::AnimationDelta//pretty sure I know this one-amount of difference in rotation value
=Params::SkinWeightThreshold//most especially this one!
=Params::SameVertTOL
=Params::SameTVertTOL
=Params::weightsPerVertex//and I'm sure this one is important too
Say I had data in the Scene, what would I need to do to these values to get it exporting the weighting, my current .dmp files always indicate a value of 1.00.
Rex
#205
- Params::AnimationDelta: This is used in a number of places during export to determine whether two positions/scales/transforms are identical (ie difference < Params::AnimationDelta).
- Params::SkinWeightThreshold: This specifies the minimum weight a bone must have for it to affect the vertex it is attached to. Bones with weight less than this value are considered as not attached to the vertex.
- Params::SameVertTOL: This specifies the minimum distance two vertices must be apart for them to be stored as separate vertices in the DTS file. The DTS format stores all the verts in a single table, then each triangle just stores an index into the table for its three verts. If two verts (A and B) are closer than this value (in MS units), only A vert is stored in the table, and triangles that use B would have their indices updated to use A.
- Params::SameTVertTOL: Same idea as Params::SameVertTOL, but for UV mappings.
- Params::weightsPerVertex: This defines the number of bone weights per mesh vertex. For milkshape (which supports only one bone attached to a vert), this is always 1.
To get more than one bone weighting per vert would require a change to the exporter - it currently only supports one bone per vertex (since that is all that milkshape supports).
05/27/2006 (10:42 pm)
Hi Rex,- Params::AnimationDelta: This is used in a number of places during export to determine whether two positions/scales/transforms are identical (ie difference < Params::AnimationDelta).
- Params::SkinWeightThreshold: This specifies the minimum weight a bone must have for it to affect the vertex it is attached to. Bones with weight less than this value are considered as not attached to the vertex.
- Params::SameVertTOL: This specifies the minimum distance two vertices must be apart for them to be stored as separate vertices in the DTS file. The DTS format stores all the verts in a single table, then each triangle just stores an index into the table for its three verts. If two verts (A and B) are closer than this value (in MS units), only A vert is stored in the table, and triangles that use B would have their indices updated to use A.
- Params::SameTVertTOL: Same idea as Params::SameVertTOL, but for UV mappings.
- Params::weightsPerVertex: This defines the number of bone weights per mesh vertex. For milkshape (which supports only one bone attached to a vert), this is always 1.
Quote:Say I had data in the Scene, what would I need to do to these values to get it exporting the weighting, my current .dmp files always indicate a value of 1.00.
To get more than one bone weighting per vert would require a change to the exporter - it currently only supports one bone per vertex (since that is all that milkshape supports).
#206
05/28/2006 (6:41 am)
Well, I think I may have found a plugin that will allow multiple weighting, just not render it in the Ms3d environment; but perhaps allow it for exportation. I'm extending an invitation to chat via MSNmessenger or email about perhaps getting it working...if you have time/inclination?! I haven't dug around on the Milkfarm in quite a while, if this could get functioning, it will be another nice boost for the Milkshape exporting...;). I'm working a demo Scene right now, so I'm ready to pound something together in a Vat here at the Werks...:).
#207
Time is not something I have a lot of these days, but depending on how this plugin you have works, it might not be too large a job to modify the exporter to use the extra weighting info.
Flick me an email sometime.
05/30/2006 (9:24 pm)
Hi Rex,Time is not something I have a lot of these days, but depending on how this plugin you have works, it might not be too large a job to modify the exporter to use the extra weighting info.
Flick me an email sometime.
#208
Thanks for the attention! I'll keep you informed.
06/09/2006 (6:51 am)
Hey, Chris; didn't get the email, got the followup though. I'll be on all day today, try again at yer leisure...Thanks for the attention! I'll keep you informed.
#209
06/09/2006 (3:21 pm)
No problem - I've sent you the new exporter.
#210
06/09/2006 (10:08 pm)
Dude. It works! :).
#211
06/10/2006 (1:29 pm)
Nice work.
#213
Current build in my toolBox is v2.61: 6/18/06 :662KB
10/02/2006 (10:13 am)
...not sure what you mean, but yes! Chris R. updated the exporter to include vertex weights and they will export once setup with the Ms3d native SIMS2 weight dialog. You need to run a .CFG file and it has a parameter line for how many vertex weights it supports, that is needed. Not sure, but I know at least 3 and perhaps 4 weights are supported.Current build in my toolBox is v2.61: 6/18/06 :662KB
#214
Is the latest version of the exporter v2.6.1? I'm getting a lot of crashes when exporting my DTS and DSQ files. I can make it export, but it crashes probably 14 out of 15 times. The log sometimes ends on:
But sometimes crashes even before asking for a filename and at other times pops up a request box with "Error 103".
Any ideas?
Thanks, Gords
10/31/2006 (5:31 pm)
Chris, Is the latest version of the exporter v2.6.1? I'm getting a lot of crashes when exporting my DTS and DSQ files. I can make it export, but it crashes probably 14 out of 15 times. The log sometimes ends on:
Third pass: Collapsing unneeded nodes... Removing node "__mainTree" Removing node "__meshes"
But sometimes crashes even before asking for a filename and at other times pops up a request box with "Error 103".
Any ideas?
Thanks, Gords
#215
Here's some info on the unwelding and native Milkshape3D format....I think this is perhaps the direction to look into, Chris; for the issue Ari is having[as well as myself], about the shape not exporting with seam welded. I think you changed the dataModel over for the extra memory space for Comments on Objects for 1.7.4, I think Mete altered it again[v1.7.7] to suit Wes H's plugin for the Unimesh dialogs...
Taken from here.
11/20/2006 (7:53 am)
Quote:believe that the Model Information tool passes the same data model that was passed from MilkShape back when you close it, which replaces what is in memory. For models that need unwelded parts, like Sims2 meshes, this creates side effects.
The problem with this is that the OLD data model, which is used by the plugin, merges duplicate vertices which is unwelding. This has to stay that way for compatibility.
Mete introduced a new data model in 1.7.7 that doesn't do this, but plugins need to ask for the data differently so that old plugins still work. While my newer Sims2 plugins all use this method (UniMesh), so far as I know, the Model Information tool hasn't been updated.
However, if the plugin passed a return value of -1 to MilkShape when you closed the window, then the data model in memory would not get modified. This would make the tool a read-only report.
I find the plugin quite useful, but I know not to use it without saving first and reloading my project after each use. The plugin shows it was written by ScorpioMidget. He is still a member here, but was last active last February.
<* Wes *>
Here's some info on the unwelding and native Milkshape3D format....I think this is perhaps the direction to look into, Chris; for the issue Ari is having[as well as myself], about the shape not exporting with seam welded. I think you changed the dataModel over for the extra memory space for Comments on Objects for 1.7.4, I think Mete altered it again[v1.7.7] to suit Wes H's plugin for the Unimesh dialogs...
Taken from here.
#217
11/26/2006 (11:26 am)
@Rex: Do you have a (preferably simple) model that displays the unwelding problem (plus a quick description of how to reproduce it)? The changes wes describes seem simple enough, but I want to see it fix the problem before I release a new version of the exporter.
#218
...and before posting this, I've gone ahead and replicated the 'quirk'. It didn't 'appear' at first[seams appearing], because in making a "simple" shape, I used a Ms3d native 'primitive' which already has default mapping and somehow it doesn't unweld the coordinates. I only got seams between separate meshGroupings[2 groups in all, and I think I forgot to weld the groups together,d'oh!], so I'm not surprised at that result. This ONLY happened[seams appearing] after I unwelded[with NO welding after] a likely 'edge' of the UV mapping and exported; again, no surprises there.
It would seem that this 'quirk' only manifests itself AFTER some form unwelding is done and then the verts rewelded[probably bad native ms3d{I think} welding formula??], which is what I do before exporting to erase the seams.... Most developers, I think, tear the meshes apart for UV mapping at some point and this is where it's generated.
I have a few files to send. The namingConvention is pretty straitforward. seamTester.ms3d: exported as is, with default Ms3d cyclindrical mapping[only seams between groupings]. Then the manually unwelded version. Then a rewelded version, and lastly a second proofing of the rewelded copy. The seam appears with the unwelded file and persists no matter what, in fact; you'll see the unwelding happen after the Export Process is finished.....even if you reweld BEFORE exporting. This is the 'effect' most are describing in the Threads concerning this topic.
I checked the seam in ShowToolPro and manipulated the Lighting Object around untill I found my seam on the side.
Rex
PS:Here's a snapshot of the seam in question in ShowToolPro:

...you can see the seam and the outline of the Light Object in the UI.
11/27/2006 (7:42 am)
I'm free today, Chris, and I just visited the Thread at the Chum site. Yes, I'll certainly put something together that reproduces the 'effect' of passing the shape with unwelded seams and send it your way. I've fiddled with my email servers recently and may not get a return email, please be patient....and before posting this, I've gone ahead and replicated the 'quirk'. It didn't 'appear' at first[seams appearing], because in making a "simple" shape, I used a Ms3d native 'primitive' which already has default mapping and somehow it doesn't unweld the coordinates. I only got seams between separate meshGroupings[2 groups in all, and I think I forgot to weld the groups together,d'oh!], so I'm not surprised at that result. This ONLY happened[seams appearing] after I unwelded[with NO welding after] a likely 'edge' of the UV mapping and exported; again, no surprises there.
It would seem that this 'quirk' only manifests itself AFTER some form unwelding is done and then the verts rewelded[probably bad native ms3d{I think} welding formula??], which is what I do before exporting to erase the seams.... Most developers, I think, tear the meshes apart for UV mapping at some point and this is where it's generated.
I have a few files to send. The namingConvention is pretty straitforward. seamTester.ms3d: exported as is, with default Ms3d cyclindrical mapping[only seams between groupings]. Then the manually unwelded version. Then a rewelded version, and lastly a second proofing of the rewelded copy. The seam appears with the unwelded file and persists no matter what, in fact; you'll see the unwelding happen after the Export Process is finished.....even if you reweld BEFORE exporting. This is the 'effect' most are describing in the Threads concerning this topic.
I checked the seam in ShowToolPro and manipulated the Lighting Object around untill I found my seam on the side.
Rex
PS:Here's a snapshot of the seam in question in ShowToolPro:

...you can see the seam and the outline of the Light Object in the UI.
#219
11/29/2006 (2:27 pm)
I am getting a crash when I try to export, I'm using 1.7.10 and the 29/11/06 release.
#220
11/29/2006 (2:35 pm)
@Master Treb: Send me the model (email is in my profile) and I will take a look. 
Associate Chris Robertson
The usual problem with replacing the player model is that it's trying (and failing) to load one or more DSQ animations. Look in player.cs and remove any lines loading DSQ files that are not compatible with your DTS model. Search the forums for more details - I'm sure I've seen people have this issue before. I don't think there is anything wrong with your exported model or animations.