I am facing an issue with loading a facial mesh and separate eye mesh into three.js from Blender. The face is set as the parent and eyes as the child in Blender. How can I accomplish this task successfully?
Additionally, there seems to be a problem with loading textures, as only one can be loaded at a time. Can someone provide assistance with resolving this issue? Thank you.
var loader = new THREE.JSONLoader();
loader.load( "./three/models/JSON/Blender/DM_Face.json", addModelToScene ); //function( geometry, material ) {
//loader.load( "./three/models/JSON/Blender/DM_Eye.json", addModelToScene );
//var materials = [material1, material2];
//var meshFaceMaterial = new THREE.MeshFaceMaterial( materials );
function addModelToScene( geometry, materials ) { //sphereGeometry1, sphereMaterial1 ) {
var material = new THREE.MeshPhongMaterial({morphTargets: true, map: THREE.ImageUtils.loadTexture('./three/models/JSON/Blender/DM.fbm/RyEddie_face_1001.jpg')});
var Mouth = new THREE.MeshPhongMaterial({map: THREE.ImageUtils.loadTexture('./three/models/JSON/Blender/DM.fbm/RyEddie_mouth_1005.jpg')});
mesh = new THREE.Mesh( geometry, material, Mouth )
mesh.scale.set( 17, 13, 13 );
mesh.position.x = 0; //Position (x = nach rechts+ links-)
mesh.position.y = -17; //Position (y = nach oben +, unten-)
mesh.position.z = 0; //Position (z = nach vorne +, hinten-)
scene.add( mesh )
//var sphereMaterial1 = new THREE.MeshPhongMaterial( {map: THREE.ImageUtils.loadTexture('./three/models/JSON/Blender/DM.fbm/RyEddie_eyes01_1007.jpg')});
//sphareMesh1 = new THREE.Mesh( sphereGeometry1, sphereMaterial1 )
//sphareMesh1.scale.set( 30, 30, 30 );
//sphareMesh1.position.x = 0; //Position (x = nach rechts+ links-)
//sphareMesh1.position.y = 0; //Position (y = nach oben +, unten-)
//sphareMesh1.position.z = 0; //Position (z = nach vorne +, hinten-)
//scene.add( sphareMesh1 );
mixer = new THREE.AnimationMixer( mesh );
var clip = THREE.AnimationClip.CreateFromMorphTargetSequence( 'test', geometry.morphTargets, 30 );
mixer.clipAction( clip ).setDuration( 6 ).play();
};
The JSON file specifies the texture materials as follows:
"materials":[{
"depthTest":true,
"transparent":false,
"depthWrite":true,
"colorSpecular":[0.5,0.5,0.5],
"DbgName":"Face",
"wireframe":false,
"visible":true,
"DbgIndex":5,
"DbgColor":61166,
"doubleSided":false,
"specularCoef":103,
"colorEmissive":[0,0,0],
"opacity":1,
"colorDiffuse":[0.8,0.8,0.8],
"shading":"phong",
"blending":1
},{
"depthTest":true,
"transparent":true,
"depthWrite":true,
"DbgName":"Eyelashes",
"wireframe":false,
"visible":true,
"DbgIndex":0,
"DbgColor":15658734,
"doubleSided":false,
"colorEmissive":[0,0,0],
"opacity":0,
"colorDiffuse":[0.0414118,0.0379608,0.0310588],
"shading":"lambert",
"blending":1
},{
"depthTest":true,
"transparent":true,
"depthWrite":true,
"colorSpecular":[0.5,0.5,0.5],
"DbgName":"EyeMoisture",
"wireframe":false,
"visible":true,
"DbgIndex":14,
"DbgColor":15658734,
"doubleSided":false,
"specularCoef":103,
"colorEmissive":[0,0,0],
"opacity":0,
"colorDiffuse":[0.8,0.8,0.8],
"shading":"phong",
"blending":1
},{
"depthTest":true,
"transparent":false,
"depthWrite":true,
"colorSpecular":[0.5,0.5,0.5],
"DbgName":"Torso",
"wireframe":false,
"visible":true,
"DbgIndex":9,
"DbgColor":15658734,
"doubleSided":false,
"specularCoef":103,
"colorEmissive":[0,0,0],
"opacity":1,
"colorDiffuse":[0.8,0.8,0.8],
"shading":"phong",
"blending":1
},{