I succeed to load my obj file with the JSON loader of three JS however I can't succeed to have the materials too. I have two errors:
Uncaught TypeError: Cannot read property 'attributes' of undefined @ three.min.js:455h....
Uncaught TypeError: Cannot read property 'transparent' of undefined
Here is the code I use to load the object on the scene:
var loader = new THREE.JSONLoader();
loader.load("obj/littlebig.json", function(geometry, mat) {
var material = new THREE.MeshFaceMaterial(mat);
var object = new THREE.Mesh(geometry, material);
object.scale.set(100, 100, 100);
scene.add(object);
}
);
Here is the export from blender: http://pastebin.com/Uae3qC1w. (I voluntarily removed some uvs, vertex and normals).
And here is the screenshot of the export I made from blender:
Here is the a part of the value of the mat variable, if you need the rest I will upload it:
Do you see what is wrong?
Edit : I tried many things and it seems that my export was bad, because with another model I succeed to load the materials, so if you see what options I miss...
Hi Take a look at the example i created . Its modular , and allows you to load materials and animations easily.
https://github.com/master-atul/blender3js
I hope it helps :)