GithubHelp home page GithubHelp logo

shuihan03 / convert_obj_to_js_three Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ningbonb/convert_obj_to_js_three

0.0 1.0 0.0 16 KB

将 Obj 模型转换为 js ,适用于 Three.js ,目的为提取顶点信息

Python 100.00%

convert_obj_to_js_three's Introduction

Obj 转 js/json

将 Obj 模型转换为 js 或 json ,适用于 Three.js ,目的为提取模型的顶点信息。

前言

Three.js 在 R94 版本移除了该转换器。取而代之的 obj2three.js 转换器使用更加方便,但提取顶点的时候因为没有去除 WebGL 绘制的重复点,导致顶点数量翻倍,对于制作粒子效果来说,性能也就随着粒子数量的增加而减弱了,因此旧的 convert_obj_three 转换器在提取顶点信息的时候还是很有必要的。

配置环境

Python 安装

convert_obj_three 转换器使用的是 python 环境,而且只支持旧版本的 python,推荐使用 python 2.7.1

配置环境变量

  1. 右键点击"计算机",然后点击"属性";
  2. 然后点击"高级系统设置";
  3. 选择"系统变量"窗口下面的"Path";
  4. 然后在"Path"行,添加python安装路径即可(如的C:\Python27);
  5. 设置成功以后,在命令行输入命令"python",有版本号则说明配置完成了。

开始转换

  1. 保存 convert_obj_three.py 文件到本地;
  2. 打开命令行,切换到该目录下;
  3. 将 obj 文件复制到该文件夹内;
  4. 使用命令完成转换。
python convert_obj_three.py -i model.obj -o model.js

总结

  • model.obj 为输入文件
  • model.js 为输出文件,可以转为 json 文件
  • model.js 文件中的 vertices 属性即为模型的全部顶点信息

convert_obj_to_js_three's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.