I try to import blender object to my javascript code. But the object doesn't render like in blender. I export as .obj from blender.
Here is my blender:
exporting options on left and on the right is how it look in threeJS:
I try to import blender object to my javascript code. But the object doesn't render like in blender. I export as .obj from blender.
Here is my blender:
exporting options on left and on the right is how it look in threeJS:
Here's a simple tutorial for Three.js and Blender.
As the easiest way to do this is to use the Three.ColladaLoader
. Place your .dae
files in a folder titled models
in your /root
directory.
Call the Collada
function from within the init()
function.
function init(){
scene = new THREE.scene;
...
var object1 = new PinaCollada('model1', 1);
scene.add(object1);
var object2 = new PinaCollada('model2', 2);
scene.add(object2);
...
}
function Collada(modelname, scale) {
var loader = new THREE.ColladaLoader();
var localObject;
loader.options.convertUpAxis = true;
loader.load( 'models/'+modelname+'.dae', function colladaReady( collada ) {
localObject = collada.scene;
localObject.scale.x = localObject.scale.y = localObject.scale.z = scale;
localObject.updateMatrix();
});
return localObject;
}
Following this answer or this one. Maybe it brings you ideas and maybe not, hope it helps!