彩色点云 (.ply) 不显示在three.js 中

问题描述

我正在尝试使用层加载器在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 文件。所以上面的代码适用于彩色层点云。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...