How to render OBJ file using THREE.OBJLoader method, I\'ve a sample OBJ format but it won\'t render anything nor I see error in chrome dev tool
Check out the OBJLoader usage sample at https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_obj.html#L75
(In action http://mrdoob.github.com/three.js/examples/webgl_loader_obj.html )
var loader = new THREE.OBJLoader();
loader.load( objURL, function ( object ) {
scene.add( object );
} );
Try adding a light into the scene or just assign the Obj a MeshBasicMaterial to see its shape:
var objLoader = new THREE.OBJLoader();
var material = new THREE.MeshBasicMaterial({color: 'yellow', side: THREE.DoubleSide});
objLoader.load('file.obj', function (obj) {
obj.traverse(function (child) {
if (child instanceof THREE.Mesh) {
child.material = material;
}
});
scene.add(obj);
});
Then you are able to see that the model has actually already been loaded. If not, try adjusting the position of your camera.
The documentation has left out the light so that it seems quite confusing at this point for beginners including me. :)