Page 1 of 2 12 LastLast
Results 1 to 20 of 33

Thread: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

  1. #1
    KnightErrant's Avatar Taihō no heishi
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    This is an update to the importer/exporter of Milkshape .ms3d files into
    3ds Max and Gmax. Monkwarrior and I have added two new buttons
    for importing and exporting geometry only parts of a model and along
    the way found and corrected three bugs (described below). You can
    find the script and some other files here:

    http://www.twcenter.net/forums/downl...o=file&id=1745

    The zip file contains the MaxScript ms3dimportexport_ver1_1.ms,
    the original readme.txt file, now called readme_ver1_0.txt, a
    readme_ver1_1.txt file which contains the information from this post
    in a little more detail, and two files needed by Gmax users but not
    by 3ds Max users. The script can be placed in your scripts
    subdirectory or any place convenient to your workflow. Click
    the Max Script menu item, then Run Script, then mouse to the
    directory containing ms3dimportexport_ver1_1.ms and double click
    to run it. It will display a simple rollout with "import ms3d file",
    "export ms3d file", and the two new buttons, "import geometry only"
    and "export geometry only".

    The two new buttons can be used this way. Suppose one likes a shield
    on one model and wants to use it on another model or several other
    models. Import the full model using "import ms3d file" and then click
    "export geometry only". This will display a listbox containing the meshes
    in the scene. Double click an entry to select it. Your selection will be
    echoed in the listener. You are not limited to a single selection so
    double click all the meshes you wish to export; they will also be echoed
    in the listener. The script does check if you select an item twice which
    it doesn't allow. Click the "finished selecting" button when done.

    (1) If you are a 3ds Max user the script will open a file chooser for you to
    enter a name for the .ms3d file to save to. It will then write the file.

    (2) If you are a Gmax user the script exports the data to the listener just
    like exporting a full model. You then have to use the supplied
    GMaxSLGRAB.exe utility to copy the data from the listener into an
    ASCII text file that you name. Then you have to run the Python
    ascii2ms3dconverter.py utility to convert it into a binary .ms3d file with
    the same name but .ms3d extension.

    You can then reset and import a desired model you want to add your
    saved shield to. Delete the shield you don't want and then click the
    "import geometry only" button and select the file you saved previously.
    The desired object should appear in the scene. If you exported a
    fully defined object, that is, one with uv coordinates and bone assignments
    and weighting, that information is preserved and a skin modifier will be
    put on the object.

    -------------------------------------------
    MORE ERROR CHECKING
    -------------------------------------------
    On export the script now checks for defined grouptypes and groupflags.
    Rather than just stopping with an error, it now prompts you to enter
    these. On exporting a full model without a bounding sphere, it tells you
    it is supplying a default one. If it finds an unassigned vertex, it will
    inform you which mesh the problem occurs in and then terminate.

    -------------------------------------------
    BUG FIXES
    -------------------------------------------
    Fix 1: Most glaring bug is that the uv maps are upside down in version 1_0.
    The correct transformation was in Vercingetorix's script, I just didn't
    see it. Monkwarrior showed me how to see uv coordinates on textures
    through the UI where it is pretty obvious what is going on. It is
    v -> 1 - v when converting from meshes and Milkshape to
    3ds Max and Gmax. This is now done for all imports and exports.

    Fix 2: A more subtle bug, again correctly done in Verc's script, is that
    texture vertices and geometry vertices have no 1-1 correspondence in
    3ds Max. You don't notice this if you just import a model and then export
    it because they do have a 1-1 correspondence in a mesh file. Here's the
    documentation on the subject.

    It is very important to note that

    A - There can be more or less texture and color vertices than there are mesh vertices

    B - There are always exactly as many mesh faces as there are texture and color faces!

    So there is no one-to-one correspondence between mesh vertices and texture and color vertices.
    You cannot take vertex number 10 from the mesh and expect that texture vertex 10 will store
    the information about its texturing or color vertex 10 would define its vertex color.

    As mentioned in B , the number of faces is always identical. Not only this, the indices of
    the mesh and texture resp. color faces have a one-to-one correspondence! If face 5 has 3 mesh
    vertices you are interested in, their corresponding texture vertices will be the 3 vertices
    referenced by the texture face number 5.

    This is the key to access to texture and color information in 3ds Max!


    Finding the corresponding vertices

    In order to find out which texture vertex corresponds to a mesh vertex, you have to do the following:

    1. Take the index of the mesh vertex.

    2. Find out which faces reference the index of the face.

    3. Note the number of the vertex (1st, 2nd or 3rd - .x, .y or .z) inside each face.

    4. For each face referencing the vertex, get the texture face with the same index.

    5. Get the index of the respective texture vertex from the face - 1st, 2nd or 3rd / .x, .y or .z

    6. The vertex you got corresonds to the mesh vertex we started with.

    7. Repeat steps 3 to 6 for all faces found.

    Same applies to color vertices.
    The release notes in the header comments of ms3dImportExport_ver1_1.ms
    have the commands you have to use to implement the above algorithm.


    Fix 3: For animated files I said I had computed the basevert_array so that
    on back conversion you obtain the basepose when you open the file in
    Milkshape. Well, that was half true, you get the basepose if you are a
    Gmax user but I forgot to implement that for the 3ds Max side. There
    you get the regular vert_array which would be whatever animation frame
    was displayed when you exported. The animation data in the bones was
    still correct, you just got a distorted mesh that would look terrible if you
    played the animation in Milkshape. Now on the 3ds Max side, it looks at
    a flag to decide if there is animation data present and stored in the root
    bone (an animheader entry). If so, it writes out the basevert_array.

  2. #2
    filip_f
    Guest

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    Hello ! there

    KNight Errant you have make a amazing tool can you make a manual / tutorial to use this tool ? Iam very need this tutorial because iam very new in modding and to make new attatachment , make a spear more longer (in step by step please )
    Last edited by filip_f; December 03, 2007 at 11:07 PM.

  3. #3
    Alletun's Avatar Artifex
    Join Date
    Jan 2007
    Location
    Denmark
    Posts
    747

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    Awesome, thanks KE

    i got the import thing to work with the trolls, and been working on a wood elf model in max. Milkshape is a fine modeling program but nothing beats 3dsmax.

    i'll update the tome to 1.3 soon with a part dedicated to this script (now i just gotta find some time to write it ..)

    @filip_f
    for a modding related perspective i recommend this:
    http://www.twcenter.net/forums/downl...o=file&id=1672
    it's quite good, but then ... i wrote it so im biased

    for a tutorial on 3dsmax i can strongly recommend the Swordmaster e-book from www.3dtotal.com. it's only 10£ i think
    Unit makers Tome of Knowledge:
    http://www.twcenter.net/forums/showthread.php?t=127787
    Warhammer: Total war modeller. Orc & Goblins (GREENSKINS!) creator
    http://forums.totalwar.org/vb/showthread.php?t=90663&page=2
    Third Age: Total war. Modeling and Skinning. Working on Isengard.

  4. #4
    filip_f
    Guest

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    for Aletun
    I have already downolad it very nice tutorial !

    thanks for the link
    for your recomandation for tutorial .what i need as the begginer in modeling unit and add new attatchment ?

  5. #5
    Alletun's Avatar Artifex
    Join Date
    Jan 2007
    Location
    Denmark
    Posts
    747

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    Unit makers Tome of Knowledge:
    http://www.twcenter.net/forums/showthread.php?t=127787
    Warhammer: Total war modeller. Orc & Goblins (GREENSKINS!) creator
    http://forums.totalwar.org/vb/showthread.php?t=90663&page=2
    Third Age: Total war. Modeling and Skinning. Working on Isengard.

  6. #6
    KnightErrant's Avatar Taihō no heishi
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    @Alletun
    Bought the e-book today and skimmed it at lunch, excellent.
    ($17.10 in US dollars, if anyone is interested.) The chapter on
    uv unwrapping looked really good.

    @filip_f
    I can't do tutorials because I only know how to get numbers in and
    out of Gmax. But Monkwarrior taught me how to see textures with a
    multi jpeg tutorial so to return the favor:
    I'll do armored_sergeants but pick any unit you like. The texture is
    en_lmail_hail_england.texture for this example. Convert to DDS format
    with alpaca's converter or edit with a hex-editor and delete the first
    48 bytes (up to the ASCII letters "DDS") and save as dds. GMax doesn't
    read .dds files so it has to be converted. Open with Photoshop and you
    get this DDS read properties dialog. The load Mip maps checkbox is
    checked by default so uncheck it (circled in red)



    (the Mip maps stretch out the uv coords
    so they don't display properly) and load. Should have a 1024x1024 image.
    Now save it as a targa .tga file, GMax can read these.



    Call up the material editor by pressing m and you should see the following.
    Press the new button circled in red:



    You'll get the New Material dialog, pick standard, and click OK.



    Back in the material editor click on the maps rollout circled in red:



    On the second entry, diffuse color, click the none button circled in red and
    the GMax material navigator appears. Double click on the black box labeled
    bitmap to get to a filechooser. Select your .tga file.



    You should see your texture on the sphere like below:



    Now select all the meshes that are part of the figure, i.e. everything but
    weapon and shield.



    Then click the apply button followed by the show texture in viewport icon
    button (both circled in red). Then your texture appears in the perspective
    viewport:




    To see a uv map click a mesh, here I've selected head_01, and then in
    the modify panel I've clicked out the modifiers and selected
    Unwrap UVW



    Now click the edit button circled in red:



    You will see the uv coords in the Edit UVWs dialog. Click the drop down
    and select pick texture. Now choose the .tga you made before.



    You should see something like the figure below.



    Same thing for a body mesh:



    That's the only thing I know how to do in GMax, courtesy of Monkwarrior.

  7. #7
    killerxguy's Avatar Artifex
    Join Date
    Sep 2005
    Location
    Dubai, United Arab Emirates
    Posts
    2,369

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    Does this mean I can use 3dsmax instead of MS3D!? OMG! If this is true I'll be so happy!!!

    EDIT: In short words, Rise of The Caliphate is not dead .
    Under the patronage of Evariste.

  8. #8
    KnightErrant's Avatar Taihō no heishi
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    @killerxguy,

    I was going to reply to your Milkshape query in the other thread by
    sending you to Allentun's Milkshape tutorial. But this works too. Please
    post if you run across any bugs.

  9. #9
    killerxguy's Avatar Artifex
    Join Date
    Sep 2005
    Location
    Dubai, United Arab Emirates
    Posts
    2,369

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    I downloaded Alletun's tutorial yesterday night, but the reason I downloaded it was to discover how to use the text files of M2TW (which are different than RTW text files).

    The importer/exporter works perfectly and I actually changed a model and it worked in-game 100% with no bugs...I'm so happy now .

    +rep KnightErrant.
    Under the patronage of Evariste.

  10. #10
    Babur's Avatar ز آفتاب درخشان ستاره می
    Join Date
    Jun 2007
    Location
    Agra,Hindustan
    Posts
    15,812

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    +rep KnightErrant.You have saved ROC
    Under the patronage of Gertrudius!

  11. #11
    killerxguy's Avatar Artifex
    Join Date
    Sep 2005
    Location
    Dubai, United Arab Emirates
    Posts
    2,369

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    For some reason the importer/exporter doesn't import smoothing groups.
    EDIT: Oops, just found out it does, and I was doing something wrong...mods can delete this post if they want.
    Last edited by killerxguy; December 30, 2007 at 05:42 AM.
    Under the patronage of Evariste.

  12. #12
    Code_Knight's Avatar Dread Penguin
    Join Date
    Oct 2007
    Posts
    3,686

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    i get an error is says undefined to type:integer, why do I get this?
    Son of _Pontifex_Father to Mithrandir
    - Citizen, Artifex, Civitate - Librarian

    Third Age: Total War - Most Promising Mod of 2008
    2D Graphical Artist & Moderator

  13. #13
    Atman's Avatar Yoshihara
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    79

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    allright guys, I have some newbie questions.

    Milkshape 1.8.2 seems to be able to export to just about any format, including 3ds; so your script is only meant to add some functionality to this, like exporting only a piece of geometry - is that right? Or is it necessary to properly export/import?

    I'm a modo user. Milkshape seems to be able to export to obj, which I'd normally use for getting my model into another 3d package.

    So I assume Milkshape doesn't do that right, otherwise you guys would simply use obj's to get the model to MAX or whatever (?)

    Can you sort out my confusion here..

    thanks!

  14. #14
    KnightErrant's Avatar Taihō no heishi
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    Most of those other formats like obj don't support the bone information
    like assignments and weighting. The importer/exporter is for bringing
    over a complete model. The import/export geometry bits are just meant
    as a convenience, sort of like the merge function for GrumpyOldMan's
    converter for Milkshape. You can switch out weapons for example.

  15. #15
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,959

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    Oh KE, this is NICE. Big reps!!!


    "You must spread some reputation around before giving it to KnightErrant again."


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  16. #16
    born2dive67's Avatar Ishiyumi no shashu
    Join Date
    Nov 2007
    Posts
    715

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    wow saw what the company sells the 3ds max for is there lol a cheaper way to get it?

  17. #17
    Icedie El Guaraní's Avatar Margmiðlunarskólinn
    Join Date
    Jan 2008
    Location
    Njarðvik
    Posts
    1,466

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    Well, to bump up this thread with another question.
    @ KE i use gmax to make a new celtic chariot model, i uvmapped , set the bones in skin modifier, but when i try to export it with the script, i have this error.
    Code:
    --runtime error: array index must be +ve number , got 0
    I can do the export geometry thing, but it make things much longer i suppose.
    more thing, when i export the model , grab it, and convert it to ms3d, in milkshake prompt me that has an invalid group of triangules, do you want to remove it? when i hit yes i delete the whole thing, it work normally after i add bones and all the things but its just 1 of those things that keep me wondering that is all.
    Edited
    Come on Guys, somebody? KE?
    Last edited by Icedie El Guaraní; February 20, 2009 at 09:42 PM.
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  18. #18
    Icedie El Guaraní's Avatar Margmiðlunarskólinn
    Join Date
    Jan 2008
    Location
    Njarðvik
    Posts
    1,466

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    BUMP
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  19. #19
    Raiken's Avatar Murakawa
    Join Date
    May 2009
    Posts
    10

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    Hmm... Don't know about Icedie's problem, but my problem (i think) is simpler. I get a MAXscript rollout handler exception saying: --Incompatible types: 0, and "

    When first exporting i got some bone comment error and it asked me to enter new ones, and something about 0 being all the time and 1 being optional. So i called them all 0. Yea, i probably screwed up...

    So, how do i change this, what does it need to say, and last but not least, what the heck is a bone comment? (I've done a lot of modeling in max, but that's for animation films, so i'm in waaay over my head when it comes to game implementing)

    P.S: It's a full model rigged to a skeleton imported with an animmerged file via the GOAT toolbox. I just skinned another mesh to the one i animmerged. I'm sure there's an easier way of doing this, but it this way seemed to work, and i got animation to see if the skin deformation looked good.

    P.P.S: Big thanks to Knight Errant for all the Wonderful tools he's made. And every other person in here thats ever written a program or tutorial. Would never have got this far without you.

    EDIT: Meh, messed up again. What i was missing was group comments. Figured out from deleting what it said in the user defined tab in the mesh object properties, and doing the export over again that it needed separate names and flags, wrote some descriptive names, and yay it worked! (I think...)

    HOWEVER: Now i got a message after choosing which file to save it in that i exceeded vertex count. I've made sure that all the verticies are skinned to a bone. What gives? I haven't exceeded the allowed face count of the engine (which should be about 6000 or so).

    EDIT 2: (Heh, this is gonna be one long post of edits isn't it?) Dunno what it was but i restarted MAX and the export worked. Now i actually got into milkshape. This time i get an error message about the MS3D file having invalid groups/triangles and if i want to remove them. Saying yes removes the entire mesh, saying no gets it in, but when i try the animation the skin behaves like crap. I suppose its the group comments thats messed up. Does it need some special format or so?
    Last edited by Raiken; July 07, 2009 at 07:32 PM. Reason: Problem update

  20. #20
    dome's Avatar supersonic
    Join Date
    Sep 2007
    Posts
    743

    Default Re: Milkshape .ms3d importer/exporter for 3ds Max and Gmax, version 1.1

    it does not works for me ! I use 3dsmax2010
    can someone help me?

    d.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •