Problems exporting milkshape materials
by Michael Hotchkiss · in Artist Corner · 03/26/2007 (2:51 pm) · 31 replies
I downloaded a cobra helicopter in 3ds format and import it to milkshape and everything seems fine. It uses milkshapes materials instead of a bitmap and when I try to export I check the export materials box, but when I open it in showtool it stays gray. I've checked the materials list in showtool and it has the right material names. I don't have any experience with 3d modeling so I have no idea what i need to do to fix this. Any help would be greatly appreciated.
Thanks
Thanks
About the author
#2
Thanks for your help.
03/26/2007 (3:42 pm)
I don't know how to attach files to the posts yet so I emailed you.Thanks for your help.
#3
Gotta stick with textures for now. And as Fucifer said, each side has to be a power of 2 (although they don't need to be the same. For example, you can have a 1024x128 texture).
What engine are you using? Feel free to contact me--I've become a total expert at getting models from Turbosquid to Torque via Milkshape. I've done about 200 of them for my game.
03/27/2007 (9:05 pm)
TGE doesn't support materials, unfortunately. I'm pretty sure TGEA doesn't, either (although it has shaders, of course, which I suppose could substitute).Gotta stick with textures for now. And as Fucifer said, each side has to be a power of 2 (although they don't need to be the same. For example, you can have a 1024x128 texture).
What engine are you using? Feel free to contact me--I've become a total expert at getting models from Turbosquid to Torque via Milkshape. I've done about 200 of them for my game.
#4
03/28/2007 (4:56 am)
Lee do you have a tutorial on how to export the models.
#5
Preface: If you haven't already got it, be SURE to get the latest and greatest DTS exporter (called DTS+). This will solve all kinds of problems, run out and do it now if you haven't already.
Note: If you're just starting out, I would scan this whole thing before beginning, as I have necessarily put some things back asswards.
Okay, first things first--you gotta get your model in there. I've had by far the best success with 3ds and *.obj files. Much of the stuff you'll run into is in *.max, which is a nasty, aggressively closed format which is not supported by anything other than 3DS Max (as far as I can tell), so you'll need to get it translated into something Milkshape likes. I've had almost no luck with anything but 3DS or OBJ files in MS3D. Occasionally directX *.x files have been the only way in though, now that I think about it. You'll need to run the directX tool within MS3D to import an *.x file.
Once it's in you'll usually want to rotate it so that it will be upright in the right-top window (default MS3D configuration), which will make it upright in Torque. Check example vehicle/weapon files for orientations for non-static shapes. Don't worry too much...you'll figure out what's wrong when you're plane flies backwards...but you can save some time by doing it right the first time.
Then, the most essential thing you must do is rename the groups. All the group names need to end in a number. This represents the LOD (Level Of Detail) level in Torque. The DTS Exporter will put the group into the DTS at the level of the number at the end of it. Thus, if your groups are named:
group1
othergroup1
thisgroup1
thatgroup1
Those groups will go in at LOD 1. I recommend that you start off simply making sure all your group names end in 1. Later on you can go back and redo the model in lower detail, and add, for example:
group128
othergroup128
thisgroup128
thatgroup128
which will be the groups that will get displayed when the model is rendered 128 pixels in size, in theory.
Notes: In theory, also, you should start with LOD 0, and have 0's at the end of the group names. But when I try this, I get invisible models. 1 seems to work just fine.
Also, I've actually seen my FPS go DOWN after adding LOD levels to my models. But that's another discussion.
Also, you can't have a minus (-) sign before the LOD number, although underscore is ok.
You can change the LOD levels in the DTS Exporter, but it's a pain if there are very many groups. It's a pain in the main interface as well, but not as bad.
Two special groups may also be made. A mesh called Collision-1 (-1 means it's never seen, get it?) defines how the engine will, uh, handle collisions. It must have no concave parts! Just like a bsp/map. Keep it simple for best performance. You'll find that your vehicle models will crash the game if they don't have a collision mesh. And btw I've always heard that a wheeled vehicles axles should be WITHIN the collision mesh, although I haven't yet heard why, or seen any difference when I experimented with it myself. I'd like to know....
bounds0 is the other one, and this one is a bit murky to me. The engine DOES use it. The exporter has a nice "create bounds" function to do this for you. It does affect the physics as well, but I don't understand how, precisely (anyone care to expound?)
Now, before you do all that...hehe...you might find it desireable to simplify your materials a bit. For example, some models you'll get will have 185,000 groups, which can be a little tedious to rename. For our Torquey purposes, this may be extreme overkill. What I've done several times when encountering a model like this is check out the materials list, which may be MUCH smaller. Then I'll go through and select by material, and regroup according to the materials. This preserves the material mapping on the UV's, and reduces the number of groups. Just note that this may or may not make it more difficult to edit the model later.
Materials have to be textures. Thus, you will need to replace material-only model colors with textures. I find it handy to create a pallette of colors to use on all my models. I used 64x64 monochromatic png's to make up the pallette. 1x1 works, too, and uses less memory. I could find no significant performance difference untill I got to 1024x1024, which was too big. It would be nice if a torque god could set us straight on the optimal size for this kind of texture.
A lot of 3rd party models will have odd sized textures. For TGE, textures must have sides sized as a power of 2, measured in pixels. Thus, textures must be (1x1 works) 2x2, 4x4, 16x16...128x128, 1024x1024, 2048x2048. They do not have to be square, however. 128x64 is ok, as well as, for example, 1024x128, 512x1024, etc. This is nice if you get a model with a long, rectangular texture that is say 1050 x 400, which you can resize to 1024x512 and it will look pretty good in TGE.
I have found no limit to the number of textures you can have.
Textures must be jpg or png. Use png, it's lossless!
I have also not had performance issues as long as textures are 1024x1024 and below on my high end (in 2006-2007) machines. If you're aiming for a more general market, legend has it 512x512 is as big as you want to get.
Note that those odd sized textures will show up fine in Milkshape--just not in the DTS.
Note also that you may need to change the diffuse or ambient colors for the material in Milkshape to, say, white instead of black, to see your texture in Milkshape the way it will be in TGE. If it looks all black, that's your problem.
Okay, so you have your textures and groupnames Torqueified, so you're ready to export. One thing you may run into is if you need to set a texture to translucent, in the exporter you'll select the material, but the dialog will pop up with a different material selected. This happens when you have a material in your list that isn't used in the model! My suffering is your benefit!
If you bring in your model and it seems like only a few groups are displayed, you have neglected to assign the LOD level to all your groups. Even one group can screw up the whole thing. I still do this on a regular basis :-(
Every now and then you'll get a bizarre "fan" effect--thousands of vectors all spewing out from a central point in the game. Regrouping can solve this. First, just isolate the group that has the problem by deleting groups and re-exporting from MS3D. Once you've isolated the problem group, try splitting it in half. Most of the time, problem solved right there. Otherwise...keep splitting it up. I THINK it's from a group being too big.
Scaling--particularly dramatic scaling--is best done in the DTS Exporter, not in Milkshape. The Exporter has the outstanding property of saving your last scale value with the *.ms3d file, which is SWELL.
Skeletons:
You basically can't move a skeleton in Milkshape. So be sure your model is oriented and scaled how you want it BEFORE creating/importing your skeleton.
You can resize joints under the File | Preferences dialog.
The location of the root joint DOES matter to the physics of a vehicle, even if it's not connected to the skeleton. Try doing apply.Impulse to a vehicle and move the root joint around--you will get different results. I'm still working out what other stuff matters--and I'm pretty sure there is other stuff to find out in that department.
I've been using the BraveTree wheeled vehicle and flying vehicle skeletons, however, which has been very helpful.
--------------------------------------
There, that's a good start. I think I've covered all the major Torque-specific issues I've run into. Although I'm sure I'm forgetting something...I'll edit later if so.
03/28/2007 (11:45 am)
"Milkshape DTS exporting issues version .01a, with an emphasis on 3rd party model translation" :-)Preface: If you haven't already got it, be SURE to get the latest and greatest DTS exporter (called DTS+). This will solve all kinds of problems, run out and do it now if you haven't already.
Note: If you're just starting out, I would scan this whole thing before beginning, as I have necessarily put some things back asswards.
Okay, first things first--you gotta get your model in there. I've had by far the best success with 3ds and *.obj files. Much of the stuff you'll run into is in *.max, which is a nasty, aggressively closed format which is not supported by anything other than 3DS Max (as far as I can tell), so you'll need to get it translated into something Milkshape likes. I've had almost no luck with anything but 3DS or OBJ files in MS3D. Occasionally directX *.x files have been the only way in though, now that I think about it. You'll need to run the directX tool within MS3D to import an *.x file.
Once it's in you'll usually want to rotate it so that it will be upright in the right-top window (default MS3D configuration), which will make it upright in Torque. Check example vehicle/weapon files for orientations for non-static shapes. Don't worry too much...you'll figure out what's wrong when you're plane flies backwards...but you can save some time by doing it right the first time.
Then, the most essential thing you must do is rename the groups. All the group names need to end in a number. This represents the LOD (Level Of Detail) level in Torque. The DTS Exporter will put the group into the DTS at the level of the number at the end of it. Thus, if your groups are named:
group1
othergroup1
thisgroup1
thatgroup1
Those groups will go in at LOD 1. I recommend that you start off simply making sure all your group names end in 1. Later on you can go back and redo the model in lower detail, and add, for example:
group128
othergroup128
thisgroup128
thatgroup128
which will be the groups that will get displayed when the model is rendered 128 pixels in size, in theory.
Notes: In theory, also, you should start with LOD 0, and have 0's at the end of the group names. But when I try this, I get invisible models. 1 seems to work just fine.
Also, I've actually seen my FPS go DOWN after adding LOD levels to my models. But that's another discussion.
Also, you can't have a minus (-) sign before the LOD number, although underscore is ok.
You can change the LOD levels in the DTS Exporter, but it's a pain if there are very many groups. It's a pain in the main interface as well, but not as bad.
Two special groups may also be made. A mesh called Collision-1 (-1 means it's never seen, get it?) defines how the engine will, uh, handle collisions. It must have no concave parts! Just like a bsp/map. Keep it simple for best performance. You'll find that your vehicle models will crash the game if they don't have a collision mesh. And btw I've always heard that a wheeled vehicles axles should be WITHIN the collision mesh, although I haven't yet heard why, or seen any difference when I experimented with it myself. I'd like to know....
bounds0 is the other one, and this one is a bit murky to me. The engine DOES use it. The exporter has a nice "create bounds" function to do this for you. It does affect the physics as well, but I don't understand how, precisely (anyone care to expound?)
Now, before you do all that...hehe...you might find it desireable to simplify your materials a bit. For example, some models you'll get will have 185,000 groups, which can be a little tedious to rename. For our Torquey purposes, this may be extreme overkill. What I've done several times when encountering a model like this is check out the materials list, which may be MUCH smaller. Then I'll go through and select by material, and regroup according to the materials. This preserves the material mapping on the UV's, and reduces the number of groups. Just note that this may or may not make it more difficult to edit the model later.
Materials have to be textures. Thus, you will need to replace material-only model colors with textures. I find it handy to create a pallette of colors to use on all my models. I used 64x64 monochromatic png's to make up the pallette. 1x1 works, too, and uses less memory. I could find no significant performance difference untill I got to 1024x1024, which was too big. It would be nice if a torque god could set us straight on the optimal size for this kind of texture.
A lot of 3rd party models will have odd sized textures. For TGE, textures must have sides sized as a power of 2, measured in pixels. Thus, textures must be (1x1 works) 2x2, 4x4, 16x16...128x128, 1024x1024, 2048x2048. They do not have to be square, however. 128x64 is ok, as well as, for example, 1024x128, 512x1024, etc. This is nice if you get a model with a long, rectangular texture that is say 1050 x 400, which you can resize to 1024x512 and it will look pretty good in TGE.
I have found no limit to the number of textures you can have.
Textures must be jpg or png. Use png, it's lossless!
I have also not had performance issues as long as textures are 1024x1024 and below on my high end (in 2006-2007) machines. If you're aiming for a more general market, legend has it 512x512 is as big as you want to get.
Note that those odd sized textures will show up fine in Milkshape--just not in the DTS.
Note also that you may need to change the diffuse or ambient colors for the material in Milkshape to, say, white instead of black, to see your texture in Milkshape the way it will be in TGE. If it looks all black, that's your problem.
Okay, so you have your textures and groupnames Torqueified, so you're ready to export. One thing you may run into is if you need to set a texture to translucent, in the exporter you'll select the material, but the dialog will pop up with a different material selected. This happens when you have a material in your list that isn't used in the model! My suffering is your benefit!
If you bring in your model and it seems like only a few groups are displayed, you have neglected to assign the LOD level to all your groups. Even one group can screw up the whole thing. I still do this on a regular basis :-(
Every now and then you'll get a bizarre "fan" effect--thousands of vectors all spewing out from a central point in the game. Regrouping can solve this. First, just isolate the group that has the problem by deleting groups and re-exporting from MS3D. Once you've isolated the problem group, try splitting it in half. Most of the time, problem solved right there. Otherwise...keep splitting it up. I THINK it's from a group being too big.
Scaling--particularly dramatic scaling--is best done in the DTS Exporter, not in Milkshape. The Exporter has the outstanding property of saving your last scale value with the *.ms3d file, which is SWELL.
Skeletons:
You basically can't move a skeleton in Milkshape. So be sure your model is oriented and scaled how you want it BEFORE creating/importing your skeleton.
You can resize joints under the File | Preferences dialog.
The location of the root joint DOES matter to the physics of a vehicle, even if it's not connected to the skeleton. Try doing apply.Impulse to a vehicle and move the root joint around--you will get different results. I'm still working out what other stuff matters--and I'm pretty sure there is other stuff to find out in that department.
I've been using the BraveTree wheeled vehicle and flying vehicle skeletons, however, which has been very helpful.
--------------------------------------
There, that's a good start. I think I've covered all the major Torque-specific issues I've run into. Although I'm sure I'm forgetting something...I'll edit later if so.
#6
03/28/2007 (4:10 pm)
Thanks, outstanding!
#7
Do you use the stock Torque skeleton, or do you make a custom one? I can get .dsq's working fine in Showtool, but the animations don't work in Torque.
03/28/2007 (6:29 pm)
I think with vertex weighing in 1.8, that Milkshape will become the standard for low budget games.Do you use the stock Torque skeleton, or do you make a custom one? I can get .dsq's working fine in Showtool, but the animations don't work in Torque.
#8
You basically can't move a skeleton in Milkshape. So be sure your model is oriented and scaled how you want it BEFORE creating/importing your skeleton.
You can resize joints under the File | Preferences dialog.
The location of the root joint DOES matter to the physics of a vehicle, even if it's not connected to the skeleton. Try doing apply.Impulse to a vehicle and move the root joint around--you will get different results. I'm still working out what other stuff matters--and I'm pretty sure there is other stuff to find out in that department.
I was unaware there was a stock Torque skeleton until this moment. New with 1.5 maybe? Sounds grand. I doubt it really matters whether you use it or make your own unless it's got some stock Milkshape animations included?
I've been using the BraveTree wheeled vehicle and flying vehicle skeletons, however, which has been very helpful.
Additional note for above: Scaling--particularly dramatic scaling--is best done in the DTS Exporter, not in Milkshape. The Exporter has the outstanding property of saving your last scale value with the *.ms3d file, which is SWELL.
03/29/2007 (12:23 pm)
Skeletons! I forgot all about them. They are a contrary beast to work with in Milkshape. Here is what I know (my work with them has been relatively limited):You basically can't move a skeleton in Milkshape. So be sure your model is oriented and scaled how you want it BEFORE creating/importing your skeleton.
You can resize joints under the File | Preferences dialog.
The location of the root joint DOES matter to the physics of a vehicle, even if it's not connected to the skeleton. Try doing apply.Impulse to a vehicle and move the root joint around--you will get different results. I'm still working out what other stuff matters--and I'm pretty sure there is other stuff to find out in that department.
I was unaware there was a stock Torque skeleton until this moment. New with 1.5 maybe? Sounds grand. I doubt it really matters whether you use it or make your own unless it's got some stock Milkshape animations included?
I've been using the BraveTree wheeled vehicle and flying vehicle skeletons, however, which has been very helpful.
Additional note for above: Scaling--particularly dramatic scaling--is best done in the DTS Exporter, not in Milkshape. The Exporter has the outstanding property of saving your last scale value with the *.ms3d file, which is SWELL.
#9
03/30/2007 (4:04 pm)
Added some collision and bounds stuff. The post is getting too long--I'll start a resource soon.
#10
The documentation that accompanies the DTSPlus! exporter pretty much describes all of the above and includes the previously 'unaware of' skeletal rig that actually loads all of the SDK default sequences! There is also an example of an IFL animation shape included with the packaged exporter, along with other examples. I, myself, have published a few guides to some Milkshape 'issues' online and entered few at TDN. I am Rex, the milkfarmer...
Also, TDN, is the 'logical' location for any such documentation hosting; posting them in Forum Threads will doom the next developer in line to countless hours of Searching[& not developing]...for old data, in some cases!.
@WillbKool: Everthing inside the Engine/gameworld needs to be scripted to function, including[but not all] animation sequences, there are a few that fire thru hardCoding. The weapon FSM sequences spring to mind immediately...I have no doubt the sequence works in ShowToolPro.
03/31/2007 (5:36 am)
Quote:I was unaware there was a stock Torque skeleton until this moment. New with 1.5 maybe? Sounds grand. I doubt it really matters whether you use it or make your own unless it's got some stock Milkshape animations included?= ????-it does matter which rig you use, always. The shape Transforms are all important and allow for the actual loading of the sequences into the Constructed DTS shape.
The documentation that accompanies the DTSPlus! exporter pretty much describes all of the above and includes the previously 'unaware of' skeletal rig that actually loads all of the SDK default sequences! There is also an example of an IFL animation shape included with the packaged exporter, along with other examples. I, myself, have published a few guides to some Milkshape 'issues' online and entered few at TDN. I am Rex, the milkfarmer...
Also, TDN, is the 'logical' location for any such documentation hosting; posting them in Forum Threads will doom the next developer in line to countless hours of Searching[& not developing]...for old data, in some cases!.
@WillbKool: Everthing inside the Engine/gameworld needs to be scripted to function, including[but not all] animation sequences, there are a few that fire thru hardCoding. The weapon FSM sequences spring to mind immediately...I have no doubt the sequence works in ShowToolPro.
#11
03/31/2007 (4:17 pm)
Wow...can't believe I never noticed that stuff coming with the exporter...! I've already learned a few things reading over it :-)
#12
Once again thank you for your tutorial.
05/01/2007 (7:52 pm)
Lee, Thanks for your reply, it helped a lot. I was wondering if you could help me out on my new project. I'm trying to model a chain link fence so I tried to make a transparent texture with a fence like grid to place on a simple box shape. It worked great in milkshape but in torque the transparent parts are black. Any suggestions?Once again thank you for your tutorial.
#13
05/01/2007 (7:57 pm)
Oh yeah, I forgot to mention that I need a lot of fence for my game so that is why I'm trying to keep the polygons so low
#14
05/01/2007 (8:46 pm)
I assume you've got transparent PNG you're using for your texture? If so, then the problem is likely that you aren't marking the material as "translucent" in the exporter.
#15
ms2dtsExporterPlus 2.6.1.0 Export (you must be on the export window for the following steps)
1. Click Material01 (your material) under the Materials section.
2. Click Edit button under the Materials section.
3. Check the Translucent check box under Flags section.
4. Click OK button then Click Export DTS.
05/02/2007 (9:32 am)
Make sure you Drag the slider under the word Emissive to the E. I dont know what export you using, but you using this one.ms2dtsExporterPlus 2.6.1.0 Export (you must be on the export window for the following steps)
1. Click Material01 (your material) under the Materials section.
2. Click Edit button under the Materials section.
3. Check the Translucent check box under Flags section.
4. Click OK button then Click Export DTS.
#16
05/02/2007 (11:18 am)
Fucifer, are you sure the Emissive slider has any effect at all (in Torque)?
#17
05/02/2007 (12:04 pm)
Yes If I leave it out then I will get no transparency in Torque. I am going to test it with milkshape 1.8.1 I will let you know what I find out.
#18
05/02/2007 (12:52 pm)
Yes it still work same way but I was not clear enough before. Dragging the slider under the word Emissive to the big E is for the old export that comes with milkshape. For ms2dtsExporterPlus use the steps (1-4) above, which now come with Milkshape to. Here a picture.
#19
05/02/2007 (1:11 pm)
Thanks for the effort!
#20
05/03/2007 (11:28 pm)
Thanks for the help guys. I'll have to look into that. I'll have to check which exporter I'm using.
Torque Owner Fucifer