提问人:Nick 提问时间:11/15/2023 更新时间:11/15/2023 访问量:13
SurfaceSampling ThreeJS
SurfaceSampling ThreeJS
问:
我想利用 ThreeJS 将视觉元素添加到 3D 模型对象的表面,类似于此示例中添加噪声的方式(参考本文):SurfaceSampling
const sampler = new THREE.MeshSurfaceSampler(torusKnot).build();
———
但是,当尝试将此技术应用于我的示例时,我收到一个错误:
this.geometry.getAttribute is not a function
或(取决于版本):
THREE.MeshSurfaceSampler: requires BufferGeometry triangle mesh
当前代码:
var loader = new THREE.OBJLoader( manager );
loader.load( 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/40480/head.obj', function ( object ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
var scale = 8;
$(child.geometry.vertices).each(function() {
p_geom.vertices.push(new THREE.Vector3(this.x * scale, this.y * scale, this.z * scale));
})
let sampler = new THREE.MeshSurfaceSampler( object.children[0] )
}
});
Background.scene.add(p)
});
———
在我的示例中,如何使用 ThreeJS 的 MeshSurfaceSampler(或其他技术)将视觉元素添加到 3D 模型的表面?
答: 暂无答案
评论
BufferGeometry