I'm having trouble rendering an object in three.js from a .obj file exported from 3ds max and a .mtl file with the materials. The textures don't seem to be loading properly. Below is the javascript code I'm using:
var texture = THREE.ImageUtils.loadTexture( 'items/m16/m16.jpg' );
var loader = new THREE.OBJLoader();
loader.load( "items/m16/m16.obj", function ( object ) {
for ( var i = 0, l = object.children.length; i < l; i ++ ) {
object.children[ i ].material.map = texture;
}
// object.position.y = -100;
scene.add( object );
} );
Here is the content of the .mtl file:
newmtl Material__25
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka m16.jpg
map_Kd m16.jpg
I can't seem to figure out what I'm doing wrong.