mrdoob/three.js — Issue #984: Exported model from Blender fails on loading
Author: prasincs
Created: 2011-12-29 22:41:42+00:00
State: open

I have exported a cube from blender that resulted in the file:

```
{
"metadata": {
"formatVersion" : 3,
"generatedBy" : "Blender 2.60 Exporter",
"vertices" : 8,
"faces" : 6,
"normals" : 8,
"colors" : 0,
"uvs" : 0,
"materials" : 1,
"morphTargets" : 0
},

"scale" : 1.000000,

"materials": [	{
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material",
"colorAmbient" : [0.0, 0.0, 0.0],
"colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
"colorSpecular" : [0.5, 0.5, 0.5],
"shading" : "Lambert",
"specularCoef" : 50,
"transparency" : 1.0,
"vertexColors" : false
}],

"vertices": [],

"morphTargets": [],

"normals": [0.577349,0.577349,-0.577349,0.577349,-0.577349,-0.577349,-0.577349,-0.577349,-0.577349,-0.577349,0.577349,-0.577349,0.577349,0.577349,0.577349,-0.577349,0.577349,0.577349,-0.577349,-0.577349,0.577349,0.577349,-0.577349,0.577349],

"colors": [],

"uvs": [[]],

"faces": [35,0,1,2,3,0,0,1,2,3,35,4,7,6,5,0,4,5,6,7,35,0,4,5,1,0,0,4,7,1,35,1,5,6,2,0,1,7,6,2,35,2,6,7,3,0,2,6,5,3,35,4,0,3,7,0,4,0,3,5]

}

```

I have the following loader:

```
var scene;
$(document).ready(function(){
init();
});
function init(){
container = document.getElementById('container');

scene = new THREE.Scene();

var material = new THREE.MeshFaceMaterial();
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 100;
scene.add( camera );

var loader = new THREE.JSONLoader();
loader.load({model:'untitled.Cube.js', callback:createScene});
renderer = new THREE.WebGLRenderer();
renderer.render(scene, camera)
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild(renderer.domElement);

}
function createScene( geometry ) {
console.log(geometry);
geometry.materials[0][0].shading = THREE.FlatShading;
geometry.materials[0][0].morphTargets = true;

var material = new THREE.MeshFaceMaterial();

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

scene.addObject( mesh );
}
```

The rest of the code may not really make sense - I'm just starting this but my code is failing on

`loader.load({model:'untitled.Cube.js', callback:createScene});`

It fails on line `3452` of the un-minified code

`face.centroid.addSelf( this.vertices[ face.a ].position );`

Upon introspection, it's clear that vertices is an empty array. Any ideas what's wrong here?