Online3DViewer icon indicating copy to clipboard operation
Online3DViewer copied to clipboard

No colors are shown when loading ascii PLY file

Open kovacsv opened this issue 3 years ago • 4 comments

(From #118)

Also, I tried to render a PLY file which has color information as " property uchar red property uchar green property uchar blue " But the rendering is not colored, it just shows a gray 3D model. Is this functionality yet to be developed or am I missing something.

new 22.zip

kovacsv avatar Aug 16 '21 12:08 kovacsv

Unfortunately vertex colors are not implemented for ascii ply files, only for binary ones. If you have the chance to save binary ply, it should work.

kovacsv avatar Aug 16 '21 12:08 kovacsv

Yes, I just checked, it works for binary ply file. Thank you.

sivaranjanija avatar Aug 16 '21 13:08 sivaranjanija

Three.js PLYLoader is capable of showing colored ascii PLY files and they actually have an example model titled "dolphins_colored.ply" in their "ascii" folder.

It shows colors in my viewer as well, see the attached picture.

The way I did it was to use the MeshPhongMaterial with "vertexColors: THREE.VertexColors" setting when creating a mesh.

Colored ASCII PLY model

GitHubDragonFly avatar Aug 18 '21 01:08 GitHubDragonFly

Also to mention that the PLYLoader should be updated at approximately line 365, which shows as:

var vertex_indices = element.vertex_indices;

but should also include "vertex_index" to avoid console error related to non-existing "vertex_indices" property in the file:

var vertex_indices = element.vertex_indices || element.vertex_index;

GitHubDragonFly avatar Aug 18 '21 02:08 GitHubDragonFly