我正在使用 THREE.Plane 来裁剪我的 STL 模型。
localPlane = new THREE.Plane( new THREE.Vector3( 0, -1, 0 ), 4);
.
.
.
material = new THREE.MeshPhongMaterial( {
color: 0xffffff,
side: THREE.DoubleSide,
clippingPlanes: [
localPlane,
],
clipShadows: true
} );
它正在工作;但问题是整个物体的顶部都被这个无穷大的平面 chop 了。我想让它只剪掉它的一小部分(好像没有办法缩放THREE.Plane)
我也尝试过使用 ThreeCSG.js,但它似乎对 STL 对象不方便!
最佳答案
是的,three.js 支持删除剪切平面的交点。您可以使用这样的模式:
// clipping planes
var localPlanes = [
new THREE.Plane( new THREE.Vector3( - 1, 0, 0 ), 1 ),
new THREE.Plane( new THREE.Vector3( 0, - 1, 0 ), 1 )
];
// material
var material = new THREE.MeshPhongMaterial( {
color: 0xffffff,
side: THREE.DoubleSide,
clippingPlanes: localPlanes,
clipIntersection: true
} );
另请参阅 three.js example .
three.js r.85
关于javascript - Threejs 将裁剪应用于对象的特定区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44325757/