我想在ExtrudeGeometry的幫助下畫一個環。three.js中的光滑環3D
Ring3D = function(innerRadius, outerRadius, heigth, Segments) {
var extrudeSettings = {
amount: heigth,
bevelEnabled: false,
curveSegments: Segments
};
var arcShape = new THREE.Shape();
arcShape.moveTo(outerRadius, 0);
arcShape.absarc(0, 0, outerRadius, 0, Math.PI * 2, false);
var holePath = new THREE.Path();
holePath.moveTo(innerRadius, 0);
holePath.absarc(0, 0, innerRadius, 0, Math.PI * 2, true);
arcShape.holes.push(holePath);
var geometry = new THREE.ExtrudeGeometry(arcShape, extrudeSettings);
var material = new THREE.MeshPhongMaterial({
color: 0x00ffff
});
var mesh = new THREE.Mesh(geometry, material);
mesh.rotation.x = Math.PI/2;
mesh.position.y = heigth/2;
var object = new THREE.Object3D;
object.add(mesh);
return object;
}
由此產生的圖有明顯的傷疤。圓柱體和環面這樣的傷疤不是。如何擺脫它們?示例here。
與geometry.computeVertexNormals();
你找出解決的辦法 – 2016-11-11 17:29:44
貳號使用TorusGeometry – 2016-11-14 09:26:46