Game Development Community

dev|Pro Game Development Curriculum

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.
#141
05/02/2005 (8:41 am)
=)...
#142
05/02/2005 (8:45 am)
I forgot to add to my 2nd paragraph above... "It's good to now know where the env map is coming from... thanks Dave!" It wasn't supposed to be a question... DOH!
#143
05/02/2005 (8:49 am)
=)...
#144
05/02/2005 (1:16 pm)
Quote:Ed: Do you have any thoughts about the vertex blending issue I was talking about earlier?

The DTS format expects an array of size [numBones*numVerts], where each entry is the weight of the bone affecting the mesh vert. At the moment, the bone that is attached to the vert gets weight=1, and all other bones get weight=0 (for that particular vertex).

Once you have the blending algorithm sorted out it would be easy enough to add to the exporter. Just determine the weights for each bone and fill in the array accordingly.

I don't really have time to add something like that myself, but if you are interested in adding the feature, I'm sure I could hook you up with a copy of the source code.
#145
05/02/2005 (1:31 pm)
Sure Chris... I'd definitely like to give it a shot. Of course, I can't promise success... ;-)

Oh and btw... I'm starting to see more of the "seams" in my objects, like in the chalice above. My first thought was that gS was doing something screwy with the vertex normals because it was a lathed object, etc., etc. But then last night, I noticed that my bendy-rod object (which is made out of a simple cylinder) was showing a seam all the way down its long side as well. So at this point, I figure either the gS MS3D exporter is messing up, or something in MS is messing up (or possibly both). I still need to investigate further, but I just wanted to touch base quickly and see if you might have noticed anything like this in your testing, or have any idea what might be causing a "permanent" seam. Does MS keep a separate copy of a vertex for each face it is a member of, along with a separate vertex normal for each copy of the vertex, or does it use a sharing scheme based on smoothing groups, etc.?

Thanks Chris!
#146
05/02/2005 (1:33 pm)
Quote:This post will self-destruct in 3 days.....

No! That's good stuff!
#147
05/02/2005 (1:34 pm)
Chris: Do I need a particular compiler to build your plugin?
#148
05/02/2005 (1:38 pm)
@Ed: Let's continue this discussion outside this thread. Feel free to email me at the address in my profile.
#149
05/03/2005 (10:02 am)
@EddieRay, about the bad seams; have you taken a look at the Smoothing Groups the faces are in? Try Clear All on an example shape and take a look. This will put all faces/groups into 1 smoothing group and 'should' get rid of any 'seams', if welding had no effect. Milkshape does some weird stuf to groups/smoothing sometimes, I've seen where it comes and goes on shapes after a save.
#150
05/03/2005 (10:38 am)
@Rex: Thanks for the tip... I'll try it. I just need to figure out how Smoothing Groups work... ;-)
#151
05/04/2005 (1:39 am)
Note to all: Ed Phillips has joined our development team, and will also be helping out with the exporter. From now on you can speak with either Ed or Chris with your input.....

.
#152
05/24/2005 (6:01 am)
Okay, I have tried just about everything I can think of, and I'm having a bugger of a time getting this to work and have become quite frustrated, so will now ask the experts.

I have been using the exporter for a while, but have not been using ground transforms or my own bounding box, and I cannot get either to work. If I let the exporter create the bounding box, it all works, but of course, my model hovers above the ground has he moves over hilly terrain because the bounding box is larger than the model. But when I create my own, smaller "Bounds0" mesh, it seems to have NO effect and everything is the same. I have found that I MUST attach the bounds0 mesh to the root node or else everything gets messed up in terms of rotation (my model will slide around on its back, etc).

Speaking of this root node. Again, things only seem to work when I use the exporters created root node which is placed on the ground between my models feet. The problem comes with animating, as I am trying to use ground transforms so the animated model actually moves, of course, this root node is not attached to the skelton, so it does not move with the model. But the bounds mesh has to be attached to this root node, and ground transforms are based off the movement of the bounds mesh. So, taking all that into account, do I have to animate and move the "root" node to follow the model?

Now, in terms of the bounds mesh, does it have to completely encompass the entire model at all times? If so, I can see major problems with trying to completely bound a model through its animations. I guess I am trying to create a bounds mesh that is smaller than the total model and animates with it (attached to the skelelton) but of course, I cannot do that because it has to be attached to the root node, which cannot be attached to the skeleton. (grrrr.... frustration builds)

I really feel that I am just not understanding, or missing something, and I would really appreciate any help. Until this most recent release, I was just scaling my models animation fps to match the speed it was moving along the map (not using ground transforms) and this just isn't the right way.

thanks for listening, and I realize I'm new at the modeling side of things.... just trying to get over this part of the learning curve.

MEL
#153
05/24/2005 (1:11 pm)
Hi Mel,

The bounding box does need to be attached to the root node. I think I mention this somewhere in the documentation (Animation page?), but since I'm not all that familiar with bounding boxes/ground transforms I may not have been very clear.

The auto-created root node is just placed at (0,0,0), there should be no reason why you couldn't place it anywhere else, but it does need to be a top level joint (ie not the child of any other joint). The way I think the skeleton is set up (someone correct me if I'm wrong) is with the root at the top of the hierarchy, with all other bones as children. Check the skeleton in the example folder to see what the orc hierarchy looks like.

The bounds mesh only needs to encompass all model geometry when not animated (ie what you see in milkshape when not in animation mode). The exporter uses the bounding box to determine what geometry to include in the export.

If you do find something wrong, let me know, and I'll be happy to fix it for you. Even better, if you gain some experience with ground transforms and could add something to the documentation (especially an example), I'd love to hear from you! ;-)
#154
06/06/2005 (7:13 pm)
This is really great! Now I don't have to force the artists to learn the arcane arts known as Blender! (I am a programmer of the team, and leader of the current project)

This would be great in the SDK release, but then again, I say everything would be great in the SDK release (mostly).

I look forward to any improvements on this.

Robert
#155
06/14/2005 (2:45 pm)
Chris and others,

I have the ground transform stuff working, I had to add some code to switch between animations for run and walk based on the speed, but all is well and it was easy, and if I can figure out this last problem, I'll be able to devote a little bit of time to adding some information for the documentation for ground transforms. The scaling of the animation to match the velocity of the player/bot happens natively, with no code change.

But here is my problem:
Way back yonder when I first went to milkshape, I added a bot to my game, and low and behold, it worked.... kind of. It seems that when I set the bot's movement speed to anything beyond default, the bots walk and/or run animation has problems anytime it would go up, or down hill. The animation resets to the initial frame after about 5-10 frames of the animation. So it looks like my bot is doing a shuffle up or down the hill. Has anyone ran into this problem? It seems that the velocity of the bot gets set to zero on occasion as the bot goes up or down hill, there fore setting the animation to the root animation, it then goes to the next tick and the velocity is back to where it was and so it starts the walk animation over again. If the bot is running at default speed (not set to anything) the animations run great, or if the bot is walking along level ground, no problems. I'd appreciate any help on this, as I've spent about 2 weeks trying to debug/figure it out. I think its a milkshape problem, perhaps something with key frames, though I'm not sure. I am not sure if it has anything to do with the exporter....

MEL
#156
06/17/2005 (8:54 am)
I had tried Visibility animations earlier and failed but now have a working example of a successful ms3d--DTS shape with visibility working. I created two sequences and embedded them within the shape and it exported just fine, ;). Mark that feature as tested and working...
#157
06/17/2005 (3:36 pm)
Thanks Rex! Any chance you would consider donating such an example shape to the ms2dtsExporterPlus documentation?
#158
06/17/2005 (4:49 pm)
There is every chance...;). I'll zip it up and send an e-mail to you, Chris, thru your profile. A couple notes, and you're off...I've noticed a couple 'quirks', but it does function.

Sent a few more notes on the process....6/18
#159
06/18/2005 (9:20 pm)
Hey, Chris...I got a return to sender from your IP address on the email I zipped up with the goods. Let me know how to get the files to you.

Rex
#160
06/19/2005 (2:06 pm)
@Mel: It would be great if you could add something to the documentation about ground transforms.

If you send me the bot model that is causing you trouble (perferably .ms3d), I can take a look at what is going wrong for you.