Convert a 3D model to JSON with Three.JS library

Problem 

Converting a given 3D model (a .obj file) to JSON format

Solution

Three js has its own converter now

requirements

  • A model file (.obj file)
  • NodeJs needs to be downloaded and installed 
  • ThreeJs needs to be downloaded

The converted location in source code

https://github.com/mrdoob/three.js/tree/dev/utils/converters

So if you just downloaded three.js you should goto  <your threejs root folder >/utils/converters  to find the converter.

now in the command lin

 

cd <your threejs root folder >/utils/converters

node obj2three.js <path to your model or .obj file>

  Now a JSON file will be created in the folder you are in. You can use this with your JS code. Have . fun