Open Source Project Share的专栏

Open Source Project Share

Convert a model from Maya to WebGL for use with THREE.js

Convert a model from Maya to WebGL for use with THREE.js

    I’ve been a bit busy, but lots of folks have asked for this so here is the quick step by step on how I export from Maya to WebGL for use with three.js.

    Within the THREE.js github project, under utils/exporter there is a obj conversion tool called It’s written in python as a command line script, so a python executable is required to make it work. If you don’t have Python, you can download the version appropriate for your platform from I drop both the python.exe and in the folder where I save my models, just to avoid typing lengthy paths into the command line.

    In Maya, there’s a few things which I do to retain consistancy in translations and scaling before importing the model in THREE.js. I ensure that the model’s xyz translation’s and rotation’s values are 0, and the xyz scaling is at 1. The model also needs to be a child of the world and not under any groups or objects, due to inheritated transformations from the parent group or object. At this point I delete any available history of the model, and select “freeze transformations” from the MODIFY menu.


    I export the model as an obj (make sure that the plugin(objExport) is loaded) into the folder I have the python converter script in. “All File Type Specific Options” can be left checked.


    Run cmd(command prompt). Go to the directory which the models and “” is located and run the exectution line as such for a basic conversion:


-i for import, -o is output, -x is truncation and scaling. I typically use 1000 so it truncates the vertice values as intergers, and rescaling is easy to remember via 10, 100,1000 etc.

Now the exported model is ready for use in THREE.js. If transformations need to be inherrited from Maya, just multiply by 10, 100 or 1000 depending on your preferred scene scaling.


个人分类: 游戏开发
想对作者说点什么? 我来说一句



Convert a model from Maya to WebGL for use with THREE.js