[Tutorial] Import MESH into 3DS MAX

13567

Comments

  • No offence mented , and yeah I would love that you would help me out, as you said 2 r better then 1 :D

    you go ahaid and do that vertex color if you want, by the way, you can download a demo of the game thru wildtangent website, then you have all the files you want, it is porbably not playable for long but at least you have the files :)

    I will be figuring out the bones stuff since I now know where the data is 8-) , we can always do this together asswel if you like ?
    here is the link
    http://www.wildgames.com/download/torchlight

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • ill give it a look and see what i can come up with, will have to start from scratch on exporting stuff though. shouldnt be much of a problem but you never know ;)
  • already got a little question here :
    - <skeleton>
    - <bones>
    - <bone id="0" name="Bip01">
      <position x="7.27596e-010" y="-1.02795e-008" z="1.06012" /> 
    - <rotation angle="1.57079">
      <axis x="-0" y="-0" z="-1" /> 
      </rotation>
      </bone>
    - <bone id="1" name="Bip01 Head">
      <position x="0.121033" y="0.0130018" z="-1.01585e-007" /> 
    - <rotation angle="0.0171247">
      <axis x="7.96876e-010" y="-7.01347e-007" z="1" /> 
      </rotation>
      </bone>
    - <bone id="2" name="Bip01 L Calf">
      <position x="0.423679" y="-5.96046e-009" z="0" /> 
    - <rotation angle="0.221386">
      <axis x="-9.54303e-009" y="2.71446e-007" z="-1" /> 
      </rotation>
      </bone>
    ...
    

    what do you think the axis coordinates are for ?
    note that at the end of this file is the parent child relation

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • SkiffySkiffy Posts: 38
    I would venture a guess that we are maybe dealing with quaternion rotations instead of Eular ones. Thats what I think that number is.
  • TiptoeTiptoe Posts: 184
    CaSCaDe wrote:
    ill give it a look and see what i can come up with, will have to start from scratch on exporting stuff though. shouldnt be much of a problem but you never know ;)

    No need to worry about an exporter Cascade, Runic said they are going to release their own Max exporter. It's just the importer we need, and you guys are doing some awesome work on that :mrgreen:.
  • tiptoe i ment exporting assets fro mthe game so i can import them in max :P

    taylor - not sure, i would imagine it gives the rotation point angle, as a hinge, describing the way it will rotate, as in rotation is always done along one axis, but in order to get the rotation angle to use the right direction is sets the root angle. not sure will have to take apeak at biped scripting to see how those values could be used.

    [edit] after a quick look it seems to indicate numbers from an angleaxis system which is a regular expresion with in max script.
    test = $.transform as angleaxis
    test.angle
    test.axis
    

    that should give you the same type of numbers. hope that helps

    [edit2]

    looking a bit further the following will set the rotation to the specified numbers, notthat i used numbers from the file and it seems to work.
    $.rotation = angleaxis 0.0171247 [7.96876e-010,-7.01347e-007,1]
    

    that will result in a rotation of 0,0,0.017

    [edit 3] removing the e-010 and e-007 actualy gives me a different value... hmm its probably safe to remove them since max doesnt handle that much after the comma any how. it might lead to some undesired rotation though will have to test on import to see the result.

    [edit4] on further inspection, this can not be used on biped systems, it will simply ignore it, will look into a bit more.

    [edit5] after a bit of testing the biped transforms can be set with the following.
    Bnode=$bip01
    biped.settransform Bnode #rotation (angleaxis 1.57079 [0,0,-1]) false
    
  • after importing the bones as regular bones (no linking yet just bones, could as well have been points) ive come to the conclsion the position has nothing to do with the actual location off the bone, its all over the place in most cases. looking at the numbers already seemed a bit odd to me, but after testing them they have no bearing on the model what so ever. more research will be needed for this. im thinking it might have something to do with relative location from the root so ill try comming up witha sollution that will allow me to do just that.
  • jamesLjamesL Posts: 3,568
    CaSCaDe wrote:
    tiptoe i ment exporting assets from the game so i can import them in max :P
    you don't have to export them from the game
    the meshes are there as plain ogre .mesh files, you just have to use the ogre's mesh to xml tool to convert them to xml so your script can import them to max
    I don't have a sig
  • Hi all,

    I have a few .mesh files that I need converted into 3DStudio files. I understand how I do this, but the technicalities elude me. I have spent 3 days downloading blender, OGREXML converter, but I am just not technical enough to figure it all out. (I am on a Mac, which explains alot).

    Can someone help with two small files?

    Thanks heaps

    Please email me. [email protected]
  • TiptoeTiptoe Posts: 184
    No problem Redone. Just upload them to a file host such as Rapidshare: http://rapidshare.de/ and I'll convert them for you :mrgreen:.

    What format do you want them in .3ds or .obj?
  • First try, no success, the script runs through the file and reads all the data in it, it even sets the length of the bone depending on the parent, but no luck :evil:

    so if anyone feels like it...

    I could use a little ( a lot ... cascade :) ) help plz

    http://users.telenet.be/u122561/downloads/ImportOgreXmlBones.ms

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • i have been working on a solution as well, what ive figured out so far is that the location and rotation of the bone is relative to its parent. im workin on a solution to build the tree based on the hierarchy described in the file, but no luck so far, will post some more findings tommorrow. i have been able to import the skeleton and set the rotations accordingly, and have had some succes with that, atleast it looked like a skeleton although the rotations where pretty off, the solution im working on now should yield better results. i have put all the info, including all parent child relations into an array and build a function to sort trough it and build the tree based on the hierarchy order, hope it works.

    tayler, ill take a look at your solution so far and see if i can get some ideas from that.
  • k, cause I build first the bones and structures from the data in the files and put it in a structure array ( you'll see what I mean in the file ) then I try to build the bones, no luck so far eather :(

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • i did it :D \o/ works on all skeletons i have imported so far.

    give it a go

    http://dl.dropbox.com/u/867177/ImportOgreXmlSkel.ms

    also made a minor ajustment to the model importer to line up everything as it should, ogre coord system works different then the max coord system so adjusted to make it work.

    http://dl.dropbox.com/u/867177/ImportOgreXml_Fix.ms
  • TiptoeTiptoe Posts: 184
    Holy cow! I'm gonna go test it right now :mrgreen:.
  • TiptoeTiptoe Posts: 184
    Hooray! It's working for me too :mrgreen:.

    There is no animation, but the bones are all there. Brilliant job! You guys are just awesome.
  • yeah im not reading the animation data yet, it just skips it for now, thats the next part, but first i guess ill have to add some vert colors to the mesh importer
  • Ha, but what you can do now, with the docs and examples of Runic Games, is you can import a model, and change the model in max using the bones, export it using the official stuff and it will use the animation from the game !!

    So you can start building your own models now :)

    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • Cascade, dude, you rock, it works perfect :twisted:
    T.
    9757-albums2216-picture19549.png
    9757-albums2216-picture19984.png
  • ive been working on getting the animations imported, so far i have been able to import the animation data and set the keys accordingly, but for some reason the rotations and translations are all out off whack, will probably have to build an other function to do the animated rotations in hierarchale order again.

    will keep you all posted...

    side note im thinking of re-writing the mesh importer to have have some better error handling and easier addition of information (like the vert colors) that is not included yet, taylor if you have a problem with this just lemme know
  • DushoDusho Posts: 988
    Why not using .max files with characters rigs provided in TorchED assets?
    Additionally can I ask someone to convert character rigs into .obj or .dae (collada) or any common format (.3ds) so that other 3D editors can read it. Pretty please...
  • SkiffySkiffy Posts: 38
    Why? well the models we are after dont come in the assets zip. The importer gives us the ability to study all the assets in the game including all tilesets and monsters. Sadly not everything was included in that lovely source zip. But the max source files wont have to be reverse export / imported anymore which is a great thing!
  • the rotations may be coming in wacked due to the absolute Horrid nature of the way max handles rotations.

    you may need to do some experimentation with something along the lines of
    in max script:
    
    in coordsys local $r_elbow.rotation.x = 20
    
    

    The key here being the "in coordsys local" for the animation and pose library I wrote for Max I had to do a lot of this, but in gimbal format. Otherwise what you get is roations in quaterion rotation matrix. =P which is ok to a point. I had a lot more sucess with my roation storage values and reading them both into and out of binary format using Euler format with the in the coordsys gimbal.
  • most rotations in the orge format are parent based, but ive tried every coord (including a custom one) and they still go out of whack.

    what im doing is mostly
    in coordsys parent rotate Node (angleaxis ((180/pi)*angle) axis)
    

    this has yielded good result in all other cases but the animation.s mainly cuse the xml format describes the rotations relative to its parent axis in quaternions with radians rather then just setting a rotation, there for i do a transform function on the matrix to get more accurate results.

    ill try and see if a single axis rotation will work, but i have my doubts, since ill have to convert to eulerangles to get the proper axis rotation relative to its parent, possible but i think the results will be the same or be worse then doing the direct rotation.

    any way thanks for the tip ill try it out
  • what you are seing is the BS that is Max's rotation system. I should just stop before I get started on the annoyance that is the rotation system in Max. I would suggest taking the problem to the CGtalk forums in the App Specific (for Max/Max Script) a lot of the guys there have a ton of experience and can answer most any question. While I can answer a good number of questions I know my limits.

    My inital thought is to read in the values to an array, apply those rotation matrix to a dummy object and reread the values in gimbal format and apply those to the actual object. Which is just a stupid amount of work for a very simple thing. When I wrote my animation and Pose library in Max Script I made sure to read out and read back in gimbal format so that I could use single rotations greater than 180 degrees in Euler format.
  • i tried the seperate one in eular angles and the results where actualy worse then i thought.
    doing the stuff on a dummy first was actualy my next plan off attack before writing the hierarchy loop function just for this.

    thanks for the help
  • graboigraboi Posts: 38
    cascade

    I have the animations largely figured out , your problem is that the xml file
    stores the keyframes as the "difference" from the bone pose in the skeleton part
    of the file, so you have to aggregate each keyframe with the initial skeleton pose
    to get the full transform at each keyframe.
    I can e-mail you my maxscript of the vanq run anim mostly
    working if you want, please be aware however that it is a coding mess right now
    as i have very limited time to work on it and i have been "hacking" away at it.
    the easiest way to compile the keyframe is to turn the pose angleaxis and the
    keyframe angleaxis into quats them multiply them together then out to a matrix

    q1 = pose.angleaxis as quat
    q2 = key.angleaxis as quat
    q3 = q2 * q1

    mat = q3 as matrix3

    mat.row4 = pose.position + key.position

    etc..
  • graboigraboi Posts: 38
    Ok I've cleaned this up a little but its all the time I have for tonight.
    This will import "some" of the animation files i haven't tested too many.
    This is based on Taylormouse's original script with some createbones stuff
    borowed from gildor's actorximport script as well as stuff gleaned from
    cascades work. Disclaimers -- this will probably crash! -- it will most certainly
    not work on all files -- stop crying ;) -- its not perfect some of the bones aren't
    exactly right -- ok have fun
    http://rapidshare.com/files/305254527/ImportOgreXmlBonesTest.ms
  • ive been trying a similar approach but for some reason the pose is all screwed up now, if i dont do/have animations all is fine, but the multiplication of the matrix with the parent seems to throw it off. ill go trough it some more to see what else i can come up with.

    thanks for the help any how :P
  • graboigraboi Posts: 38
    I have most of the animations working now.
    If you want to post your script I will take a look and see if I can help.
    Cheers
Sign In or Register to comment.