I have been able to load and render 3D models along corresponding textures from 3D model files with OBJ format using three.js API. I wanted to try loading models with JSON (.js) format. So I download a 3D model (this mill) and converted it to JSON format using mrdoob python script. It outputted a .js file along with textures inside a folder. I copied everything intact to my localhost folder and inserted below code into my html page hoping to get the mill with all textures:
var loader = new THREE.JSONLoader();
loader.load( 'mill.js', function ( geometry ) {
var mesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({overdraw: true}));
mesh.scale.set(0.005, 0.005, 0.005);
mesh.castShadow=true;
scene.add( mesh ); });
But the result I got is this:
Obviously it lacks corresponding textures. i had a look inside mill.js
file; although I didn't understand it, I could see the textures are introduced inside materials
array. While JSON file refers to corresponding textures, what should I do in my code to bring textures to model surfaces?