5

I have a maya model done in maya 2008. I need to be able to convert it a JSON format for use with three js. So far , I have tried

1) threeJsFileTranslator.py which is a maya plugin to export a model and is provided as a part of the threejs package.

2) MDD-OBJ-EXPORTER - with this , I was successfully able to import the animated model into blender but when I tried to export it to threejs , the js file didn't work.

I am breaking my head over this from the past 2 weeks. So please bear with me if this question is too silly but I do need help with successfully converting an animated maya model to json format.

ISSUES IMPORTING ANIMATED MODELS FROM MAYA TO BLENDER TO THREE JS

MAYA TO THREE JS WITH ANIMATION

E_net4
  • 27,810
  • 13
  • 101
  • 139
Harsha Venkataramu
  • 2,887
  • 1
  • 34
  • 58
  • try this link this may help you http://creativejs.com/2012/02/quake-style-animated-models-in-three-js/ –  Aug 20 '13 at 07:29

4 Answers4

4

It's not answered because at this point (8/2013) it's not simple :0

I have not tried it but it's been suggested that the Quake2 MD2 format offers a pathway for animated models into Three. Theres an online MD2 > JSON converter (again, haven't tried it). MD2 plugins for maya are hard to come by: you can build one using the source on github. Older versions of blender (< 2.5) apparently also export md2.

The Three JSON format - at least the publicly available one on the web site - doesn't seem to have any animation support ATM.

theodox
  • 12,028
  • 3
  • 23
  • 36
  • Looks like you are correct. A problem with using md2 is that it supports only 450 triangles at the max. I just started a bounty , let's see if anybody comes up with any answer. If no , I guess I'll have to model in blender. – Harsha Venkataramu Aug 16 '13 at 07:07
  • Here is an example of an (apparently) working animated JSON. It "should" be possible to work up a maya exporter that handles this format, the only real issue will be consistent quaternionization of the rotation values in Maya. There will be no support for pivot points or joint orients but you can work around that by deriving the values from the maya matrix not by polling the transforms information http://mrdoob.github.io/three.js/examples/obj/buffalo/buffalo.js – theodox Aug 16 '13 at 15:38
  • Let's see when things get simpler with converting animated models to three js format. If you find simpler ways , please do let me know. Awarding you with the bounty now :-) Thanks man .. – Harsha Venkataramu Aug 23 '13 at 18:32
  • 1
    I don't know if you guys still care about this, but I am banging my head on the keyboard over this same issue. I have tried 2 different ways of using Collada, they are broken. There is a nice example on youtube, but it is not very helpful, has anyone found a clear solution yet? – Ryan Blevins Dec 17 '13 at 22:23
  • @RyanBlevins : Check out http://Clara.io .. have to try it yet , if you do n get the results , do let me know as well .. n wish you a very happy new year:-) – Harsha Venkataramu Jan 01 '14 at 20:36
3

You can export your model as FBX from Maya and then load it into http://Clara.io (the online 3D modeling, animation and rendering tool). From there you can export it in the various ThreeJS JSON formats pretty easily.

http://Clara.io supports loading at least the following formats:

  • .blend - Blender 3D
  • .3ds - 3D Studio
  • .dae - Collada
  • .dxf - AutoCAD
  • .fbx - FilmBox (Autodesk FBX)
  • .irr - Irritch Scenes
  • .irrmesh - Irritch Meshes
  • .iv - Inventor
  • .json - Three.JS Meshes
  • .lwo - Lightwave Objects
  • .lws - Lightwave Scenes
  • .lxo - Modo Objects
  • .q3d, .q3s, .md, .md2, .md3, .md4 - Quake/Doom Meshes
  • .mtl/.obj - Wavefront Objects
  • .ply - Polygon Type
  • .pov - PovRAY
  • .shp - Shape Files
  • .stl - Stereolithography (3D Printing)
  • .vismat, .vismatzip - VRay Vismat
  • .xgl, .zgl, .wrl, .wrz - VRML X3D Scene Files
bhouston
  • 955
  • 9
  • 14
  • Take a look at this http://clara.io/editor/5b4a472c-1753-4864-b7d5-4e7cc480dfa5 It's a simple bouncing ball animation. I exported it as a .dae file , included it in https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_collada_keyframe.html and when I tried to run it , I get this issue. Cannot set property 'visible' of undefined webgl_loader_collada_keyframe.html:123 What could be wrong ? – Harsha Venkataramu Jan 06 '14 at 11:29
  • 1
    @harsha, I checked it out. The issue is that in the ThreeJS exaple you are using they have hard coded two lines that look for specific scene nodes in the import Collada file, but these are not in the file you exported. I fixed the issue by commenting out these two lines: ``` //model.getChildByName( 'camEye_camera', true ).visible = false; //model.getChildByName( 'camTarget_camera', true ).visible = false; ``` – bhouston Jan 06 '14 at 18:08
  • accepting this as the answer because clara.io seems to be the future! – Harsha Venkataramu Jan 07 '14 at 05:25
  • clara.io can export .json but threejs uses .js .. Any ideas ? – Harsha Venkataramu Jan 07 '14 at 16:32
  • The *.json format exported from http://Clara.io can be loaded by the ThreeJS ObjectLoader: https://github.com/mrdoob/three.js/blob/master/src/loaders/ObjectLoader.js (which is different from the OBJLoader.) – bhouston Jan 07 '14 at 17:51
  • Has anyone had this work? I can export a threejs scene, but need something formatted for the `JSONLoader` - that is, with bones, `skinWeights`, and `skinIndices`. – Peter Ehrlich Feb 12 '14 at 06:23
1

If you're starting with Maya you can try www.inka3d.com. You also need a newer Maya, you can get a trial at autodesk (and install it in a vm when you need to export)

Jochen
  • 754
  • 7
  • 21
0

You might be aware that THREE.js comes with an exporter for Maya, but it only works for static models.

I have created an updated version that also supports exporting rigged and animated models. It doesn't require any intermediate steps: it just outputs straight to a .JS file. We have a pull request to integrate the updated exporter with the THREE trunk, but if you want to get the new and improved exporter immediately you can get it from this repository: https://github.com/BlackTowerEntertainment/three.js/tree/maya_animation_exporter. The exporter files are in utils/exporters/maya.

datmorrison
  • 128
  • 9