colored point cloud (.ply) does not display in three.js

Viewed 478

I'm trying to load a colored point cloud in three.js with a ply loader. I follow this example but it's different from my use case. I`m using point cloud not mesh.

So, this is what I want to load.

You can see what it looks like from here.

And the code part where I uploaded the ply file:

    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 );
        } );

The result is nothing. I can`t display anything. How can get point with their colors?

To repoduce you can create a local server and use this html.

1 Answers

That is literally my bad. I could not download the ply file in the correct way. so the above code works well for colored ply point clouds.

Related