I just created a random mesh using Blender and I want to export it to be used in HTML5 via the Three.js. I haven\'t seen any decent tutorials that shows how to do this. Can
I used the: Blender3d ver 2.78, export script add-on found in three.js utilities folder with the three.js version 60, I added this script to my Blender's add-ons folder where the blender program was setup. Modeling in Sketchup, I exported as a model.dae ( Collada file ), imported that into Blender3d version 2.78 ran the setup for the add-on exporter, exporting Blender3d as a Three.js file. This json file I saved as a .js ( javascript-object ) and not as a .json (JavaScript Notation object)
that object, ( textured correctly ) was ran like this:
///// GROUND CHERRY MESH
var myShaderMaterial = new THREE.MeshPhongMaterial({
// ADDING TEXTURE
map: THREE.ImageUtils.loadTexture('models/MyBistro/ShelfTextures/ground_cherryTEX_001a1.png'),
specular: 0xFFFFFF,
shininess: 80,
});
// ADDING MODEL OBJ
var loader = new THREE.ObjectLoader( manager );
loader.load( 'models/MyBistro/ShelfTextures/MyShader1aTEST_TWO.js', function ( object ){
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
var geometry = child.geometry;
object = new THREE.Mesh(geometry, myShaderMaterial);
object.scale.set(1.60, 1.60, 1.60);
object.position.x = + 22.10;
object.position.y = - 84.0;
object.position.z = - 4.0;
object.rotation.y = Math.PI / 0.10;
object.castShadow = true;
object.receiveShadow = true;
child.material.map = myShaderMaterial;
child.material.needsUpdate = true;
}
});
scene.add( object );
});