[Tutorial] Import MESH into 3DS MAX

24567

Comments

  • We're also giving you all the raw max files and animations for the player classes and their wardrobes, as well as a few monsters, a full tileset, and some weapons and props

    This is great news! There is a lot that can be learned from the art you guys made!

    I can't wait.
    Freelance Artist: www.BradM3D.com
  • jamesLjamesL Posts: 3,568
    concerning the bug:

    does 3ds max know about xml by default ?
    or is that a special library you have to tell it to include ?

    because the GetAttribute function is all about xml

    if max does know about xml by default then perhaps this section could be rewritten to help debug it ?
    fn GetAttribute  xmlElement xmlAttribute =
    (
    	if FINDSTRING xmlElement xmlAttribute == 0 then return    
    
    could be rewritten to
    fn GetAttribute  xmlElement xmlAttribute =
    (
    	if FINDSTRING xmlElement xmlAttribute == 0 then 
            {
                print "no attribute found."
                return "JUNK !"   
            }
    

    it looks like the caller is expecting a sting to returned but I think the code doesn't return anything in case of an error;
    so if fails when it trys to assign that nothing value to the meshName
    I don't have a sig
  • VravVrav Posts: 66
    Going by the XML files output by OgreXMLConverter in the command line tools, everything in my doggles model should work; it's rigged, etc, completely sound - at that point. Converting it back to a .MESH should be okay, and then the engine loading that .MESH in the mods folder, should work. I read something posted by a dev that was like, the game just can't load new models and DDS files from the mods folders. If that's the case, my mod is good to go when the patch gets released - I'm really anxious to see if it will load correctly then.

    Of course, I assigned bone weights in a text editor, so for something more complexly animated than a static mesh tacked onto a bodypart, Max importers and exporters will be very helpful. Hope this all gets sorted. I'm sort of thinking that importing from .MESH is not going to work out properly, ever; it's just the export that the engine reads; this is why they're releasing the art source files.
  • TiptoeTiptoe Posts: 184
    I'm so glad other people are trying to help with this, cause I'm useless :roll:.

    Anyway, I tried L3xicon's solution first. I opened the .xml file in Notepad, but it didn't seem to contain any strange characters:

    meshnotepad.jpg

    However, I'm not using the OgreCommandLineTools that TaylorMouse linked to in his first post. I found a standalone version of the OgreXmlConverter.exe on Sourceforge that doesn't require installation:

    http://sourceforge.net/apps/trac/rigsofrods/browser/trunk/tools/windows/OgreXMLConverter.exe?rev=2

    You just need to put the EXE and the following OgreMain.dll into the same folder, then you just drag a .mesh file onto the EXE and viola!:

    http://sourceforge.net/apps/trac/rigsofrods/browser/trunk/tools/windows/OgreMain.dll?rev=2

    I just assumed that this standalone version was the same as the CommandLineTools version, but I could be wrong :roll:.

    Anyway, next test, I tried JamesL's solution. I opened the Maxscript in Max and added these lines to it (I remembered to remove the return after the: if FINDSTRING xmlElement xmlAttribute == 0 then return).

    {
    print "no attribute found."
    return "JUNK !"
    }

    Then I resaved the script and tested it. Still no luck, I'm still getting the same error message and that same line is still highlighted in the error log :(.

    But hey! It was worth a shot.
  • hey Tiptoe

    try changing the line

    <submesh material="Starter_Set/boots"

    to

    <submesh material="StarterSetboots"

    so removing the _ and the / which I think are causing the problems.

    There will almost certainly be more than one entry in the xml, so in notepad use the find tool and search for "material". and every line that is <submesh material="name/name" or whatever you remove non letters such as / # _ 1-9 etc as above. then resave the xml and try re-importing.

    good luck :mrgreen:
  • TiptoeTiptoe Posts: 184
    L3XICON wrote:
    hey Tiptoe

    try changing the line

    <submesh material="Starter_Set/boots"

    to

    <submesh material="StarterSetboots"

    so removing the _ and the / which I think are causing the problems.

    There will almost certainly be more than one entry in the xml, so in notepad use the find tool and search for "material". and every line that is <submesh material="name/name" or whatever you remove non letters such as / # _ 1-9 etc as above. then resave the xml and try re-importing.

    good luck :mrgreen:

    Ah bummer! It didn't work :( .

    I found four material entries in Notepad and I changed them all as you suggested:

    StarterSetBoots
    StarterSetChest
    StarterSetGloves
    StarterSetFace

    But no luck, it still gave me the same error message *grrrr
  • I suggest you try some debugging yourself, each time when max says there is an error I usually uncomment the line and add a PRINT statement with the variable to check if it really is there that the error occurs, sometimes maxscript shows an error line but that is not quit the plays where the actual error is. Makes sence ?

    Also shoose open script in stead of run script, then open the listener and then press control + e

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • TiptoeTiptoe Posts: 184
    Oops what you just said went completely over my head :roll:.

    Ah well, nevermind. Let's just hope Runic deliver the promised art packs sooner rather than later :mrgreen:
  • SkiffySkiffy Posts: 38
    I look forward to you finishing this script taylormouse! I know the runic dev crew will release proper exporters but I also want to take their models apart that come with the game and adapt them to look entirely new and not just a texture swap. You can make so many more creature out of the mechanical minigun mech in the dwarf levels for example. And decking out monsters with new gear parts or reusing animations from the spider for example for an entirely new spider mesh would also make for some quick but awesome additons to the game.

    So you have my full attention and support for this script. Same goes for tilesets btw! be nice to modify and extend on the already created tilesets by importing and exporting them again.

    "Skiffy the junkyard monster shuffles in the dark"
  • Well most of the time modding tools that are provided, just as the once by Runic Games, ( and those of blizzard for Warcraft 3 ) always have excellent exporters, but what if you would like to study the models already in the game ?

    Thats why I came up with this script, it is a pitty some of you have so much problems with it while I don't :/

    I updated it so now it should import all different kinds of MESH files for the game, next step, the BONES

    here is a little proof of the shield I just imported, it is SHIELD_15 from the pack.zip file

    I used 3ds MAX 2009 for this

    9757-albums2216-picture19753.png

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • xdanxxdanx Posts: 111
    Wow, nice tutorial :D I get the "Call needs function or class" but Monkeynutz's solution (using the 3D Object converter) seem to work fine for me :)

    The bad thing is that I can't find alchemist's summons models (Nether Imp, Golems, etc) xD
  • We will be including our official MAX exporters -
    We're also giving you all the raw max files and animations for the player classes and their wardrobes, as well as a few monsters, a full tileset, and some weapons and props.

    I love you guys so much. In a completely platonic way, of course, but in to the fullest extent a man can love a small company.
  • TiptoeTiptoe Posts: 184
    Thats why I came up with this script, it is a pitty some of you have so much problems with it while I don't :/

    I've just had a thought, can you tell me exactly what you did to import the model (I'm going to try and follow your steps to the letter) ie....put ImportOgreXml.ms in....extracted Pak.zip to.....bla bla bla.
  • OK, tiptoe

    1. open the pack.zip file ( double click on it )
    2. go to media\models\Alchemist
    3. extract it to some directory ( ex c:\Temp) -> extract everything, the MESH file the DDS file, the animation file ( SKELETON files are not needed )
    4. download the OgreToXmlConvertor ( see link above ) and extract it in the same folder ( or install it in the same folder )
    5. drag and drop the MESH file onto the OgreXMLConvertor ( this throws out a ****.MESH.XML file )
    6. open the xml file ( it should open internet explorer or something ) -> just for testing
    7. open MAX 7 or up
    8. open the Utilities tab, select MAXScript
    9. click on Open Listener
    10. in the menu click MAXScript and check the Macr Recorder
    11. click on Open Open Script
    12. select my script ( doesn't matter where it is located )
    13. set your cursor on the top of the script
    14. press CONTROL + e
    15. you should get the Open File Dialogue and select the xml file.
    16. Thats it !

    Hope this works !!

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • TiptoeTiptoe Posts: 184
    Drat! Drat! Drat! :evil:

    I still can't get it to work. I followed all those steps, but it just doesn't like me :( .
  • Hi guys!
    Great script TaylorMouse!
    I got it to work by changing:
    -- 6. Get the mesh name
    meshName = GetAttribute trimmed "material"
    print meshName

    to:
    -- 6. Get the mesh name
    meshName = GetAttribute trimmed "<material"
    print meshName


    hope it works for you too :)
  • STRANGE !! cause it should look for <submesch material="blabla" /> which is an attribute material from the element submesh and not <material

    weird, but hey if it works :)

    I'm happy

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • yes I was just happy to get the file into max since i'm not a script writer. I guess it eliminated something that was stopping the script from running on my setup. (3DS Max Design 2009). So far I have edited the mesh of the Cat into a lion like creature and am trying to make a uvw map of it for further fun. Will I be able to successfully paint the map? will I be able to reintroduce the altered cat.mesh and cat.dds into the game? I don't know but it's fun :)
  • TiptoeTiptoe Posts: 184
    ****!!!! Olympic that did the trick! It works!

    I opened the script in Max again and added the < symbol in front of "<material" like you said, and now it works :mrgreen:. I'm so happy right now, at last I can see how the models are constructed and what their poly count is.

    TaylorMouse and Olympic you guys are my heroes, thankyou so much for this.
  • TiptoeTiptoe Posts: 184
    Yep it works a treat, but there are a couple of hurdles to jump over before it works.

    If I open Max and simply select 'Run Script', I will get the same old error message. So this is what I have to do to get it to work:

    1. Open Max and click 'Maxscript, then select 'Open Script'.

    2. When the script is open, press Ctrl + e. Browse to the .xml file you want to import and click Open. Nothing will happen. But do not close the script window.

    3. Click 'Maxscript' again and this time select 'Run Script'. Again, browse to the .xml file you want to import and click Open. The model should now load into Max.

    The maxscript listener still reports an Error, but the model is imported, so I'm not worrying about it :mrgreen:.
  • OlympicOlympic Posts: 9
    edited November 2009
    :oops: hehe forget this post.. it turned out to be incorrect.. (deleted)
  • FINALLY thnx guys, althoug it does not work like that for me... well if it works for you I'm happy

    for static models, I will be making an export script, like for weapons etc...

    when I have the script ready, I'll post it here ofcourse :)

    trying to script the bones now, and yes it is TRYING, cause it looks kinda weird, caus the MESH file does not show anything on size or liked bones or anything :?: :?:


    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • VravVrav Posts: 66
    Have you converted the *.skeleton file using OgreXmlConverter? It contains bone information...
  • Have you converted the *.skeleton file using OgreXmlConverter? It contains bone information...

    For real ??

    Nope will do this right now !

    thnx
    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • Hi there,

    a friend of mine asked me to take a look at this script since he was having problems with it. did a few simple and quick fixes and it seems to work fine now, also added the uv in vert space or seperate check so it will import tile set files, it will need a bit of clean up but at least it will import.

    Hope you enjoy this and most props go to the original auther of this script.

    get it at http://dl.getdropbox.com/u/867177/ImportOgreXml_Fix.ms
  • SkiffySkiffy Posts: 38
    You sir RULE. I've been able to import all the models for monsters so far. Cant wait till bones work and vertex colors as well. Thanks to Taylormouse and Cascade. We would not be able to look at the original assets like this otherwise "unless runic releases ALL source.... :)"

    "Skiffy the Junkyard monster jumps with joy and rolls in garbage!"
  • TiptoeTiptoe Posts: 184
    I cannot tell you how awesome you guys are. When I looked at the script, it might as well have been written in Chinese for all the sense it made to me :roll:. You guys are really amazing.

    Anyway, I can confirm that the new script is working just fine in 3DS Max 8. Cascade I can't thankyou enough for taking the time to help out with this. I tried to help as much as I could, but I really have no idea what I'm doing :roll:.

    Now we just need to be able to import the bones/animation data and we are in business :mrgreen:.
  • Well, thanx CasCade, I would have prefered that someone asked me first to change something on my script, :x
    ... but since I'm not the expert and love to learn from my mistakes, I appreciate you fixing this and make it work ;)

    Maybe I'll ask you to evaluate my next script ( for the bones ) first before I make it public :D

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • VravVrav Posts: 66
    Awesome collaboration.
  • Sorry about that Taylormouse, a friend asked and i helped out. he told me to put it up here so i did, if it has offended i apologise for that.

    as for reviewing the next one, sure. just send it my way and ill take a look, im by no means an expert but 2 are always better then 1.

    i was going to add vertex color support so that some of the town houses can be imported as well, just gimme a shout if you have a problem with me changing it any more.

    Side note i dont have the game so if you want me to check some stuff it might be nice to send me some pre exported xml files to test with ;)
Sign In or Register to comment.