Successfully loaded my model using the following code:
loader.load( "js/charWalk01.js", function( geometry, materials ) {
mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial() );
scene.add( mesh );
} );
However, encountered issues when attempting to implement MeshFaceMaterial to utilize the material in the JSON file resulting in two strange three.min.js error messages (shown below).
loader.load( "js/charWalk01.js", function( geometry, materials ) {
materials[ 0 ].morphTargets = true;
mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
scene.add( mesh );
} );
The errors are:
TypeError: 'undefined' is not an object (evaluating 'a.map') three.min.js:347
TypeError: 'undefined' is not an object (evaluating 'ma.attributes') three.min.js:429
The JSON file is in standard format (converted with the OBJ converter). Here is the material code extracted from it:
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Mat.1",
"colorDiffuse" : [1.0, 1.0, 1.0],
"colorSpecular" : [0.4, 0.52, 0.53],
"illumination" : 4,
"mapDiffuse" : "Character_01.jpg"
}],
Any insights into the possible causes of these errors?
Thanks, Ian