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.
#161
06/30/2005 (4:32 pm)
I sent off to Chris an example rig that loads the default sequences[ones I checked], and has an additional weapon mountPoint located on the Left hand for those developers out there using the Milkshape DTSPlus! exporter and favoring their left hands...;). Or for items, images etc....heh, heh...that was fun, a bit tricky getting orientation right. I always felt the example should have included a player shape with more mounts....and I finally did something about it, :). Hardest part was the engineering of it, how would I keep the transforms from becoming Borked from the new Node in the chain. This all sprang about for some dual weapon holding I helped with a while back...

pages.sbcglobal.net/rexpiscator/_images/nNodePlayer.jpg
I had to proof this inside the engine, so......

I placed this new player.dts shape in my copy of the v1.3SDK and ran around a bit killing some bots, then fired up STP and checked the loading with a graphic readout of exactly the sequences[files] it loaded, and it was all the sequences a default player exhibits...:). I did not notice any errors in the Console...:).
#162
07/02/2005 (7:09 pm)
Chris,

I would like to take you up on that offer to load at my model to see what rigging problems I have. I sent you an email a few days ago but have not heard anything.

As long as I ONLY export the walk animation, it works fine. As soon as I export any other animation, then I get the walk animation restarting at random times (as mentioned above). If anyone else has ideas, I'm still open! (this is killing my production time)

MEL
#163
07/05/2005 (2:46 pm)
Hey Chris.

I was thinking the other day as I was working in Ms3d and the exporter; with the new addition of object Comment area in Ms3d[making the exporter nearly complete as ms3d will allow], would it be possible to work in the AutoDetail feature? I was just about to start slapping LOD's together for a player and wondered if it was possible now? I had it working in my GameSpace environment[which gets along fairly well with the milkfarm] and would like to get that feature under control so I can boot gS away from my main pipeline and use it for it's strengths[mesh construction]....not it's weaknesses[most everything else]...
#164
07/05/2005 (3:10 pm)
Hi Rex,

AutoDetail - is that auto generation of LOD meshes? That's not really anything to do with the exporter, just name the meshes correctly (with LOD numbers at the end of the name) and they should work fine. Or am I missing something?
#165
07/05/2005 (6:49 pm)
For Max and gS, it's a parameter you can put to the shape[mesh] that involves giving the highPoly mesh a trailing number and entering LOD information in the Object Notes. This inputs some data the engine sees and the TGE does the mesh generation, negating the need to build them in the modeling applications. A nice feature.

...very similar to the Alpha channels you use for the Visibility animation, you specifiy a LOD percentage to a pixelSize grouping, usually about 4/so lines of script...something like that, ;).
#166
07/05/2005 (9:14 pm)
@Rex: Are you sure about that? I thought that the lower detail meshes were generated by the modelling program. See this page from the Max documentation:

http://www.garagegames.com/docs/tge/general/ch08s03.php

It talks about a 'Multires' plugin of some kind. I think the actual mesh generation work is done by this plugin, not the exporter or TGE.
#167
07/05/2005 (10:03 pm)
Well, fairly certain...?? In GameSpace there is a similar 'modifier' but it's not used. You manually enter the data and I thought it allowed the engine to do the work, perhaps I'm wrong. This is an example of this data inside the Object Notes for a shape in GameSpace intended for DTS with 4 LOD's

7. Open the Object Notes of elfMesh and enter this data:
numAutoDetails 4

autoDetailSize0 128
autoDetailPercent0 1.0 //elfMesh of 1744 Detail Polys(100%)

autoDetailSize1 64
autoDetailPercent1 .5 //elfMesh of 832 Detail Polys(50%)

autoDetailSize2 32
autoDetailPercent2 .25 //elfMesh of 399 Detail Polys(25%)

autoDetailSize3 2
autoDetailPercent3 .1 //elfMesh of 150 Detail Polys(10%)

This is from my GameSpace2DTS online guide I did earlier this year to help demonstrate the workflow thru gS to TGE. By entering this data, I wound up with the detail levels in the ShowToolPro and the engine. I'm not exactly certain when the mesh generation occurs. I'm thinking that there are the two methods of doing LOD's. Either manually with trailing numbers on the meshes, or using the 'Auto' feature. Someone from GG may be the true solver of the question. It worked great from Max and GameSpace both.

It might be the engine, because this example when it's LOD's are viewed inside the ShowToolPro, 'seemed' to do the face culling like portals[what's viewed to camera] as opposed to a 'collapsed' mesh[still fully enclosed--no open 'edges'] to smaller poly count. It may be noticeable in the snap-links I provided for clear view of the UI...
#168
07/05/2005 (10:25 pm)
Yep... I think you're both right. You can specify the detail levels on meshes, to manually specify the geometry, or you can add the "flags" to have Torque automatically generate the detail meshes based on an algorithmic simplification of the high-detail mesh. My guess is that Torque does this at load time, since it looks like (with only a brief glance, and a while back) the code just picks the mesh with the appropriate detail level at render time.
#169
07/06/2005 (12:13 am)
Guys, there is no code in Torque to generate details levels upon loading of dts shapes. It gets done in the exporter. Max uses a multires plugin and I have no idea what the gamespace exporter does.
#170
07/06/2005 (12:47 am)
Hmmmm... maybe the gS DTS exporter is generating the simplifications... or maybe it's a feature of the dtsSdkPlus. Rex is right... you don't have to create multiple meshes for the gS exporter, but now that you mention it, I'm not sure exactly how the simplification is accomplished. I guess we could send Matt a note and ask him...
#171
07/06/2005 (12:51 am)
Doesn't the stock TGE demo app (torque.exe -game demo) show the use of autodetail via the Torque Ork? I thought that whole "slide" was devoted to showing off that feature...
#172
07/07/2005 (10:00 am)
pages.sbcglobal.net/rexpiscator/_uimages/Bender.gif

...Bender is a visual link, click on him...! LOL, it worked!....


and as of 1:07PM, I've gone and added more mountPoints, mount5-Left hip/holster and mount6-on the head for a hat/etc...:). I got one left, plus the weird mount2, which I don't know is for what[vehicles]?? I'm thinking of moving it somewhere for vehicle mounting...left mount1 as the CTF on the back Node....mount7 may end up as a mounting point for a weapon I've had in mind, but need scripting help with...;). Nasty, rusty thing....
#173
07/25/2005 (4:46 pm)
Has this exporter been updated recently?
The information on the hosting website doesnt seem to have been updated recently.
#174
07/29/2005 (8:41 am)
I am trying to use the exporter to export some very simple animations for an NON-biped character (a fish) from milkshape. I want to be able to trigger the animations using the keyboard. I cannot figure out how to cull the joints that I don't want to animate and how to call the blended animations as separate threads, so the root animation or "walk" animation keeps playing without interruption.

Any ideas out there?
#175
09/05/2005 (3:14 pm)
#176
09/29/2005 (10:25 pm)
Ok , i have been looking at some portion of the code and comparing what mesh items need to be named to get billboards working exported from ms2dts exporter plus.
I made a simple mesh, and a non alpha'd texture to go on it. when i named the mesh, say for example purpose name is "group" . In the code for the billboarding it compares the name for strings of the mesh portion "billboard", billboardz, and "enormals" in the form of "name:flag, flag" like "group: billboard, enormals" Now when i select or even not select, the exporter automatically adds a LOD value to the end of the name looking like "group: billboard0", when it should be "group0: billboard" , A temporary hack to get this to work right is adding the comma at the end of the mesh's name to get it to work right, so it would look like this "group: billboard," and when the exporter exports it the LOD which should be before the : will be ignored at the end of the string for billboarding to work right. Just a note of something i found. hope this helps the builder of this great exporter... Now if there is something i am doing wrong please advise, I did review the chm file that comes with the exporter. but the billboarding didn't have a great deal on it in there.
#177
10/05/2005 (8:34 pm)
@William: You shouldn't need to give the mesh any special name to get billboarding to work. ms2dtsExporterPlus does not use flags encoded into the mesh name. Although these flags are used in TGE, the ms2dts exporter takes care of building the name based on the settings in the mesh/material/sequence dialog boxes.

In your example, just call the mesh 'group'. Then open the Edit Mesh dialog (from the main export dialog box). Set the LOD to be 0, and make sure the 'Billboard' checkbox is ticked.

I just tried this now and it works fine (showtool and in starter.fps).

There is a known problem with Z Billboards (they are not exported), but a fix for this is coming in a couple of days.
#178
11/29/2005 (5:51 am)
Any change on the Z Billboards issue?

Also, I'd like to suggest a new feature..

Save settings to cfg file. Currently, the exporter can load from a cfg file so perhaps it wouldn't be too hard to make it save too.
The reasons are,
1: a cfg file is easier to edit for stuff like visibility animations
2: saving the ms3d file in UltimateUnwrap3D after exporting loses the extra information saved in the ms3d file.. Not the fault of the exporter, but it would be nice to be able to move between apps seamlessly.. So if I could save to cfg, I could adjust the texture co-ordinates, reload milkshape and reload the configuration settings.


I'm also getting a problem with visibility animation. The meshes are being set to visible and invisible, but not in the correct sequence. I'm trying to make a traffic light and I've got lit and unlit meshes for each of the lights. I mapped out the visible and invisible states on paper and then set them up in the exporter. But the sequence which is exported appears to be incorrect.

Has anyone else had a problem with visibility animation?
#179
12/01/2005 (2:47 am)
Chris: Does this work with milkshape 1.7.6?

I'm having trouble using an exported shape as a wheeledvehicle...

When I export the my bike it shows up correctly in the Show Tool Plus from David Wyand. And I can mount my wheels on the demo buggy...

But as soon as I replace my dts in the car.cs in die buggy demo, it crashes on loading.

I'm downloading 1.7.4 now to see if it resolves it...



EDIT: I just used the stock exporter and it seems to work... So there's something wrong with ya exporter... ?

EDIT: I'm using TGE1.4

Any help appreciated...
#180
12/02/2005 (5:07 am)
@Jason Farmer: I've got a fix for the Z billboard issue, but I'm having trouble with my ISP/webspace at the moment, so haven't been able to upload the new version.

Export properties are stored in the comment string of the various mesh/materials. It's recommended to edit them using the dialogs, but you can edit the strings directly in milkshape, although very little validation is done so edit at your own risk!

@Burning: I haven't tried the exporter with Milkshape 1.7.6 (haven't downloaded it yet), but I can't see why it wouldn't work.

I've posted in your bike thread.