Three.js - 从Blender导出模型时创建的额外面

时间:2015-09-06 01:01:01

标签: three.js blender

Three.js版本: 71

Blender版本: 2.75a

我想从blender中导出线框模型,让它们出现在我的Three.js场景中,看看它们在Blender中的显示方式。这样我就可以将它们用作模型的轮廓边框。例如,以下是启动blender时默认多维数据集的线框模型:

wireframe model of default Blender cube inside Blender

以下是我导出后该模型的JSON:

{
    "uvs": [],
    "name": "CubeGeometry.1",
    "materials": [{
        "wireframe": true,
        "DbgName": "Material",
        "depthWrite": true,
        "transparent": false,
        "depthTest": true,
        "specularCoef": 50,
        "colorAmbient": [0.64,0.64,0.64],
        "opacity": 1,
        "vertexColors": false,
        "DbgIndex": 0,
        "DbgColor": 15658734,
        "shading": "phong",
        "visible": true,
        "colorEmissive": [0,0,0],
        "blending": "NormalBlending",
        "colorSpecular": [0.5,0.5,0.5]
    }],
    "faces": [35,0,1,2,3,0,0,1,2,3,35,4,7,6,5,0,4,5,6,7,35,0,4,5,1,0,0,4,7,1,35,1,5,6,2,0,1,7,6,2,35,2,6,7,3,0,2,6,5,3,35,4,0,3,7,0,4,0,3,5],
    "vertices": [1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,0.999999,1,1,-1,1,1,-1,1,-1],
    "metadata": {
        "uvs": 0,
        "materials": 1,
        "generator": "io_three",
        "vertices": 8,
        "faces": 6,
        "normals": 8,
        "type": "Geometry",
        "version": 3,
        "colors": 0
    },
    "normals": [0.577349,-0.577349,-0.577349,0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,-0.577349,0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,0.577349,0.577349,0.577349,0.577349],
    "colors": []
}

注意有6个面孔。我希望它在我的Three.js场景中看起来完全像这样。然而,额外的面孔被绘制。这通常是因为由于某种原因,Three.js连接了未在Blender中连接的角顶点。以下是我将其加载到场景中后的样子:

wireframe model when loaded into Three.js scene

1 个答案:

答案 0 :(得分:0)

您想要在线框模式下渲染多维数据集或框,但没有对角线。

这样做的一种方法是使用EdgesHelper,如下所示:

var helper = new THREE.EdgesHelper( mesh, 0xff0000 );
helper.material.linewidth = 2;
scene.add( helper );

您还可以看到this related answer

three.js r.71