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

转载 2012年03月24日 23:29:22

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 convert_obj_three.py. 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 python.org. I drop both the python.exe and convert_obj_three.py 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 “convert_obj_three.py” 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.

                                                                  

相关文章推荐

How To Use RMAN CONVERT DATABASE on Source Host for Cross Platform Migration

今天客户有个方案,想用RMAN将5个oracle 10g R2的数据库跨平台迁移,从linux x86 64bit迁移到AIX 6.1上。在metalink上查了下资料发现此方案行不通,参考文章ID ...

(WebGL) Max to Three.js workflow tips and tricks

(WebGL) Max to Three.js workflow tips and tricks By Thibaut Despoulain, posted Feb 1, 2012 in 3D ...

How To Use Box2D For Just Collision Detection with Cocos2D iPhone

How To Use Box2D For Just Collision Detection with Cocos2D iPhoneLike this post? Follow me on Twitte...

How To Use Box2D For Just Collision Detection with cocos2d-iphone

原文地址:http://www.raywenderlich.com/606/box2d-tutorial-for-ios-how-to-use-box2d-for-just-collision-det...
  • cubesky
  • cubesky
  • 2014年08月22日 11:52
  • 869
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Convert a model from Maya to WebGL for use with THREE.js
举报原因:
原因补充:

(最多只允许输入30个字)