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
#122
04/29/2005 (10:56 pm)
=)...
#123
04/30/2005 (7:22 am)
How does this weighting work once the shape is back in Milkshape for export?, since Ms3d doesn't support less than full? I've looked at CF, but there hasn't been any update in quite some time? Isn't it a fairly non-growth product, with no direct author response? Not exactly what I'd be looking for in a tool...now if it exported DTS shapes and accompanying .DSQ files...it would change the horizon, but not something I would expect.
#124
I see now that the result in TGE doesn't appear to be using vertex blending at all. I must've not used a large enough bend angle in my first bendy-rod test. Here's a link to a series of screenshots from my most recent test - the first is a shot of the bendy-rod in gS, then the second is in MS, and the third is in TGE:
copland.udel.edu/~ed/tge/bendyrod4
The one thing I noticed is there needs to be some scaling applied at some point - gS's normal working scale is in the 0-10 range, and MS seems to default to a bit larger scale (10-100 range?) and that causes gS models to come out really tiny when taken through this pipeline. Buy, hey, I'm just excited to see how easily this worked!
I have an idea that even though MS doesn't support vertex blending, it should be possible to make the DTS exporter automatically compute which vertices should be "blended" and which should be "fully attached"... but there's still one question that this all depends on: Does DTS format support vertex blending?
@Chris: I can try to describe the algorithm if you like... or once the code is released, I can take a look and see if I can add it myself. What do you think?
Thanks,
Ed
04/30/2005 (12:36 pm)
Thanks for the tips Rex. Naming the bones has allowed me to export from gS to MS3D format, and succesfully load my model into MS and export to DTS - and the animation was done in gS (made it all the way through to TGE without changing anything along the way). Sweet!I see now that the result in TGE doesn't appear to be using vertex blending at all. I must've not used a large enough bend angle in my first bendy-rod test. Here's a link to a series of screenshots from my most recent test - the first is a shot of the bendy-rod in gS, then the second is in MS, and the third is in TGE:
copland.udel.edu/~ed/tge/bendyrod4
The one thing I noticed is there needs to be some scaling applied at some point - gS's normal working scale is in the 0-10 range, and MS seems to default to a bit larger scale (10-100 range?) and that causes gS models to come out really tiny when taken through this pipeline. Buy, hey, I'm just excited to see how easily this worked!
I have an idea that even though MS doesn't support vertex blending, it should be possible to make the DTS exporter automatically compute which vertices should be "blended" and which should be "fully attached"... but there's still one question that this all depends on: Does DTS format support vertex blending?
@Chris: I can try to describe the algorithm if you like... or once the code is released, I can take a look and see if I can add it myself. What do you think?
Thanks,
Ed
#125
04/30/2005 (12:47 pm)
@Rex: Let me just say thanks! again... I don't know how you figured that one out (naming the bones makes MS exports work correctly in gS), but that is AWESOME! Being able to export from gS to MS and have the model and skeleton and animation and vertex assignments all intact is a HUGE win! MS supports so many formats (and CORRECTLY I'm guessing... which is important!) that this just opens up a great big world of "easy street" for me. Hurray!
#126
[Edit: section removed... never mind]
04/30/2005 (1:36 pm)
Regarding Joint Size: I just wanted to note that I had to set joint size to around 0.1 for my bendy-rod4 example after exporting it from gS and loading into MS. That makes sense because the gS "normal world units" size seems to be around one tenth the "normal world units" size in MS. But thankfully, the DTS exporter has a "Global scale" setting which I can tweak (seems like around 0.5 to 1.0 is probably good so far)... thanks Chris![Edit: section removed... never mind]
#127
All these tricks were discovered after countless hours of working with all 3 programs over a span of about 2 years now, ;)...I am most proud of the gS-Bones to Milkshape trick...;)!
04/30/2005 (6:15 pm)
If you're using the default, Mr. Box, Chris supplies, edit the Scale parameter in the Exporter Dialog to value of [1]. As a default, it's set at [.1], this will produce a tiny shape inside the engine. I use a player default height of 2.4 UNITS in Milkshape, to base all my shapes upon, and edit the Scale factor to 1. All these tricks were discovered after countless hours of working with all 3 programs over a span of about 2 years now, ;)...I am most proud of the gS-Bones to Milkshape trick...;)!
#128
04/30/2005 (8:16 pm)
@Ed: The DTS format allows any number of individually weighted bones to be attached to a single vertex. Milkshape only allows a single bone per vertex (assumed to have weight=1).
#130
Okay, setting Env Mapping in the exporter dialog for a material doesn't change the "NeverEnvMap=1" setting in the material comment... so unless I change it by hand, env mapping won't work.
The bounding box seems a bit bigger than my object:
copland.udel.edu/~ed/tge/chalice3.zip
Wow... env mapping + self illumination looks cool...
copland.udel.edu/~ed/tge/chalice3.jpg
Side note: Can someone tell me how to get the ugly seam removed from my chalice3.ms3d? I think gS must've made internal faces when I lathed it, or something... but welding only makes it "look" like it's fixed temporarily in the 3D view in MS. After exporting, the 3D view reverts back and shows the seam again. Very strange...
04/30/2005 (11:02 pm)
Let's see... second try now... 1st posting try disappeared... grrrrrr...Okay, setting Env Mapping in the exporter dialog for a material doesn't change the "NeverEnvMap=1" setting in the material comment... so unless I change it by hand, env mapping won't work.
The bounding box seems a bit bigger than my object:
copland.udel.edu/~ed/tge/chalice3.zip
Wow... env mapping + self illumination looks cool...
copland.udel.edu/~ed/tge/chalice3.jpg
Side note: Can someone tell me how to get the ugly seam removed from my chalice3.ms3d? I think gS must've made internal faces when I lathed it, or something... but welding only makes it "look" like it's fixed temporarily in the 3D view in MS. After exporting, the 3D view reverts back and shows the seam again. Very strange...
#131
What form should the reflectance map take... an image with alpha values of 255 where there should be no reflection and alpha values < 255 where there should be env mapping (0 meaning completely env mapped)... or do I have it completely backwards?
Does TGE support bump mapping (DOT3 normal mapping)...? I can't fill in a bump-map texture either.
"Detail Map" seems disabled too.
Thanks,
Ed
04/30/2005 (11:09 pm)
Oh... and how do I use an env map texture to mask sections of the object that should or should not be env mapped? Is that the "reflection map" texture in the material dialog? It seems disabled and I can't set it...What form should the reflectance map take... an image with alpha values of 255 where there should be no reflection and alpha values < 255 where there should be env mapping (0 meaning completely env mapped)... or do I have it completely backwards?
Does TGE support bump mapping (DOT3 normal mapping)...? I can't fill in a bump-map texture either.
"Detail Map" seems disabled too.
Thanks,
Ed
#132
Thanks,
Ed
[EDIT: I see in the exporter docs that TGE doesn't support bump mapping... has that changed?]
05/01/2005 (9:40 am)
Okay... I see in the docs where it says those 3 things (Detail Map, Bump Map, Reflection Map) have been disabled last year. Does this stuff not work correctly in TGE...?Thanks,
Ed
[EDIT: I see in the exporter docs that TGE doesn't support bump mapping... has that changed?]
#133
- the neverEnvMap sounds like a bug, I'll take a look.
- the bounding box is deliberately set slightly larger (1 ms unit) than the actual model extents
- detail maps just combine two textures. You can do this easily enough in any paint program, so it didn't seem worth enabling.
- I could not get reflectance maps to work, so disabled them. I think you can use the alpha channel of a texture to control the amount of environment mapping
- bump mapping is not available in TGE. The DTS format allows a bumpmap texture to be specified, but it has no effect, so I have disabled it.
05/01/2005 (1:58 pm)
Ed: Thanks for all the feedback!- the neverEnvMap sounds like a bug, I'll take a look.
- the bounding box is deliberately set slightly larger (1 ms unit) than the actual model extents
- detail maps just combine two textures. You can do this easily enough in any paint program, so it didn't seem worth enabling.
- I could not get reflectance maps to work, so disabled them. I think you can use the alpha channel of a texture to control the amount of environment mapping
- bump mapping is not available in TGE. The DTS format allows a bumpmap texture to be specified, but it has no effect, so I have disabled it.
#134
For Reflectance Maps... I think it'd be nice to try again to get it working. It should allow people to add an alpha channel to they're player's (or other shape's) texture map that will control which sections will be env mapped (those parts that are supposed to be "shiny") and which will not (other parts that are supposed to be "cloth" or whatever).
05/01/2005 (3:16 pm)
Chris: Okay... thanks! I'll keep it comin'...For Reflectance Maps... I think it'd be nice to try again to get it working. It should allow people to add an alpha channel to they're player's (or other shape's) texture map that will control which sections will be env mapped (those parts that are supposed to be "shiny") and which will not (other parts that are supposed to be "cloth" or whatever).
#135
- Fixed bug where NeverEnvMap was not being cleared for materials using environment mapping
- Made main export dialog box modal
- Updated documentation
@Ed: You can already use the alpha map of a material to control whether a part of the object will use environment mapping.
05/01/2005 (10:43 pm)
Updates:- Fixed bug where NeverEnvMap was not being cleared for materials using environment mapping
- Made main export dialog box modal
- Updated documentation
@Ed: You can already use the alpha map of a material to control whether a part of the object will use environment mapping.
#137
05/02/2005 (7:35 am)
=)... yes
#138
05/02/2005 (7:46 am)
=)...
#139
And I was wondering where the environment map was actually coming from. The default starter.fps env map is a bit awkward since there is no "ground" in the lower half (hence, my chalice looks like it's surrounded by clouds and sky even on the bottom)... but that's probably easily fixed...
05/02/2005 (8:22 am)
Okay... now I understand how the terms are being used. Really, we're talking about real-time "reflection mapping", which in the demos I've seen, have been done with shaders and typically compute a cube map at a given location in the scene in real-time, and then apply it to the scene (along with bump-mapping, specular highlighting, etc.) I remember an ATI demo of a chest that could run at a good 30-60fps on my old Radeon 8500 with all that stuff enabled. Of course, that particular technique would likely perform a little worse in a TGE outdoor environment with lots of buildings nearby I'd bet... ;-)And I was wondering where the environment map was actually coming from. The default starter.fps env map is a bit awkward since there is no "ground" in the lower half (hence, my chalice looks like it's surrounded by clouds and sky even on the bottom)... but that's probably easily fixed...
#140
05/02/2005 (8:23 am)
@Chris: Do you have any thoughts about the vertex blending issue I was talking about earlier? 
Torque Owner Rob Riddell
Anyone else try that?
smiles . . .