Materials in the exported Blender model for the non-working.

I am trying to use a model created using Blender with Three.js. The model is very simple, two cubes on top of each other. One cube is red and the other is green.

I exported the model using the Blender exporter plugin from Three.js when I manually assign material to an object, for example:

loader.load("model.js", function ( geometry, material ) {

    material = new THREE.MeshBasicMaterial( { color: 0xFF0000 } );

    mesh = new THREE.Mesh( geometry, material);

    scene.add(mesh);

    animate();

});

no problem, as shown at https://googledrive.com/host/0B9t0vRo6sUnzWndDTGxicENIdDg/index.html

However, when I delete the line:

material = new THREE.MeshBasicMaterial( { color: 0xFF0000 } );

model material is used. Which causes the Three.js error:

TypeError: program undefined [Break On This Error]

p_uniforms = program.uniforms,

You can verify this https://googledrive.com/host/0B9t0vRo6sUnzWndDTGxicENIdDg/index2.html

- , ? Blender https://googledrive.com/host/0B9t0vRo6sUnzWndDTGxicENIdDg/model.blend

+5
1

. . :

loader.load( "model.js", function ( geometry, materials ) {

    mesh = new THREE.Mesh( geometry, materials );

    scene.add( mesh );

    animate();

} );

three.js r.88

+9

All Articles