1
votes

I'm trying to load a pretty simple model with two materials (applied per-face) in Three.js exported from Blender. The issue I'm running into is that with multiple materials applied via the code below the mesh disappears entirely, but I can easily use materials[0] or materials[1] in place of materials and see a solid object. My export settings from blender along with what it should look like are below and the json of the model is visible online here.

enter image description here enter image description here

1

1 Answers

2
votes

I tried your JSON file and it displayed just like your image. Here's the code I used (three.js r83):

var mesh = new THREE.Object3D();
var jsonLoader = new THREE.JSONLoader();
jsonLoader.load('/js/models/cube.json',
    function (geometry, materials) {
        mesh = new THREE.Mesh(geometry,
            new THREE.MultiMaterial(materials));
        scene.add(mesh);
    }
);

http://www.threejsworld.com/tutorials/working-with-materials-in-threejs