Intro to Three.js

Three.js

  1. Download three.js from three.js website.

  2. Follow the Getting Started tutorial. We’ll go over this together.

  3. Import an external model into your project:

Save the file from here into a file called OBJMTLLoader.js, within your three.js folder.

Include this code to import an OBJ with materials:

var objMtlLoader = new THREE.OBJMTLLoader(); // create the OBJ loader

objMtlLoader.load("filename.obj", "filename.mtl", function(object, url) { // load the OBJ and companion MTL
    scene.add(object); // add it to the scene
});