问题描述
我正在尝试使用层加载器在three.js 中加载彩色点云。我遵循 this example 但它与我的用例不同。我使用的是点云而不是网格。
所以,这是what I want to load.
你可以看到它looks like from here.
以及我上传 ply 文件的代码部分:
const loader = new PLYLoader();
loader.load( 'samplePcd/fragment.ply',function ( geometry ) {
const material = new THREE.PointsMaterial( {size: 0.01} );
material.vertexColors = true;
const mesh = new THREE.Points( geometry,material );
mesh.position.x = 0;
mesh.position.y = -1;
mesh.position.z = 0;
mesh.scale.multiplyScalar(0.2 );
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add( mesh );
} );
结果什么都没有。我不能显示任何东西。如何用他们的颜色来点?
要repoduce,您可以创建一个本地服务器并使用this html。
解决方法
这确实是我的错。我无法以正确的方式下载 ply 文件。所以上面的代码适用于彩色层点云。