I'm attempting to import a JSON file that I exported from Blender. The file contains two separate meshes and materials. Below is the code snippet that I've been using to load this JSON data:
var self = this;
var mushroomLoader = new THREE.JSONLoader();
mushroomLoader.load('/js/Mushroom.js', function(mushroomGeometry, mushroomMaterial) {
var shrooms = new THREE.Object3D();
var mushroomCount = 10;
var radius = 30;
for(var i = 0; i < mushroomCount; i++) {
var m = new THREE.Object3D();
m.add(new THREE.Mesh(mushroomGeometry, mushroomMaterial[0]));
m.add(new THREE.Mesh(mushroomGeometry, mushroomMaterial[1]));
m.position.x = radius * Math.cos(Math.PI * 2 * i / mushroomCount);
m.position.z = radius * Math.sin(Math.PI * 2 * i / mushroomCount);
shrooms.add(m);
}
self.scene.add(shrooms);
}, 'images/textures');
The mushroom model consists of two distinct parts - the top and the trunk, each utilizing MeshPhongMaterial. There seems to be an issue with the texture on the top part of the mushroom flashing or disappearing, although some instances display correctly.