2

我正在尝试使用 制作双面网格THREE.MeshLambertMaterial,但只有正面是阴影。当我使用THREE.MeshBasicMaterial. 我正在使用THREE.WebGLRenderer57 版。

这是一个带有矩形的简化示例:

var rectWidth = 100, rectLength = 100;
var geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(0, rectWidth, 0));
geometry.vertices.push(new THREE.Vector3(rectLength, rectWidth, 0));
geometry.vertices.push(new THREE.Vector3(rectLength, 0, 0));
geometry.vertices.push(new THREE.Vector3(0, 0, 0));
geometry.faces.push(new THREE.Face4(0, 1, 2, 3));
// MeshBasicMaterial works
var material = new THREE.MeshLambertMaterial({
    color: 0xCC0000,
    side: THREE.DoubleSide,
});
geometry.computeFaceNormals();
geometry.computeVertexNormals();
var rect = new THREE.Mesh(geometry, material);
scene.add(rect);

我究竟做错了什么?我找到了http://mrdoob.github.com/three.js/examples/webgl_performance_doublelateral.html,这表明THREE.DoubleSide可以使用THREE.MeshPhongMaterial(在我的情况下也不起作用)。不过,该示例使用了内置几何,而我正在构建自定义几何,所以我想我在那里遗漏了一些东西。

4

0 回答 0