如何为Three.js模型加载器将对象转换为json文件 [英] How to convert object to json file for three.js model loader

查看:1072
本文介绍了如何为Three.js模型加载器将对象转换为json文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用three.js构建浏览器游戏,并且想将Maya 2013中的模型加载到场景中.我已将模型导出为obj文件.

I am building a browser game with three.js and I want to load a model from Maya 2013 into my scene. I have exported the model as an obj file.

现在,我需要知道如何将其转换为three.js -loader的JS文件.

Now I need to know how to convert it into an JS file for the three.js-loader.

到目前为止,这是我的装载机:

This is my loader so far:

 var jsonLoader = new THREE.JSONLoader();
 jsonLoader.load( "models/model.js", addModelToScene );

预先感谢

推荐答案

如果您不想使用Blender,mrdoob(由threejs制成)有一个简单的python脚本将obj转换为json.只需运行-此脚本-在终端中像这样:

If you don't want to use blender, mrdoob(made threejs) has a simple python script to convert obj to json. Just run --this script-- in terminal like so:

python convert_obj_three.py -i infile.obj -o outfile.js

这篇关于如何为Three.js模型加载器将对象转换为json文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆