材料似乎没有加载Three.js

时间:2017-04-19 09:50:46

标签: javascript json three.js blender

我正在尝试使用Three.js导出器加载我在Blender中导出的对象(是的,我导出了所有材质)但是当我用Three.js加载对象时它们似乎没有出现。

这是我得到的: chair with weird blue colors

我可以给椅子任何我想要的颜色,但椅子的一部分总会变成某种奇怪的蓝色或绿色,我没有选择。

这是JSON数据:

"materials":[{
    "DbgIndex":1,
    "colorSpecular":[0.5,0.5,0.5],
    "colorDiffuse":[0.68928,0.212069,0],
    "specularCoef":50,
    "shading":"phong",
    "transparent":false,
    "doubleSided":true,
    "wireframe":false,
    "depthTest":true,
    "DbgColor":15597568,
    "opacity":1,
    "colorEmissive":[0,0,0],
    "blending":"NormalBlending",
    "depthWrite":true,
    "DbgName":"Ch_seat",
    "visible":true
},{
    "DbgIndex":0,
    "colorSpecular":[0.454809,0.454809,0.454809],
    "colorDiffuse":[0.4878,0.471319,0.471319],
    "specularCoef":74,
    "shading":"phong",
    "transparent":false,
    "doubleSided":true,
    "wireframe":false,
    "depthTest":true,
    "DbgColor":15658734,
    "opacity":1,
    "colorEmissive":[0,0,0],
    "blending":"NormalBlending",
    "depthWrite":true,
    "DbgName":"Ch_leg",
    "visible":true
}],

座椅应该有一种材料,腿部应该有一种材料。

我正在加载它:

var loader = new THREE.JSONLoader();
loader.load('./frontend/base/img/chair.json', function(geometry, materials) {
    console.log(geometry, materials);
    var material = new THREE.MultiMaterial( materials );
    var mesh = new THREE.Mesh(geometry, material);
    mesh.translation = geometry.center(geometry);
    mesh.scale.x = mesh.scale.y = mesh.scale.z = 8;
    scene.add(mesh);
    render();
});

那么这里出了什么问题?我忘了什么吗?

0 个答案:

没有答案