Import color from ply file

ply file format is as follows

It is based on the webgl_loader_ply and I want to render the color information of the ply file.
The color is not applied and it comes out like the picture below.

	const loader = new PLYLoader();

				loader.load( './models/ply/test/basketball_player_vox11_00000001.ply', function ( geometry ) {

					var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 200, vertexColors: THREE.VertexColors} );
					const mesh = new THREE.Mesh( geometry, material );

					mesh.position.x = - 0.2;
					mesh.position.y = - 0.52;
					mesh.position.z = - 0.0;
					mesh.scale.multiplyScalar( 0.0006 );

					mesh.castShadow = true;
					mesh.receiveShadow = true;

					scene.add( mesh );

				} );

help me…

Do you mind sharing the PLY asset in this topic?

do you mean share the ply file?
The file is large and cannot be uploaded here.

uploaded here

The asset looks as expected in the three.js editor.

Since the PLY represents a point cloud, it’s important that you don’t create a mesh. Try it like so:

const material = new THREE.PointsMaterial( { size: 0.01, vertexColors: true } );
const object = new THREE.Points( geometry, material );

Besides, don’t call computeVertexNormals(). This is only relevant for meshes. You can also remove the lines mesh.castShadow = true; and mesh.receiveShadow = true; since point clouds do not cast or receive shadow.

1 Like

Thank you very much. Very helpful.!!!