Reading PLY file with color

I have a PLY file (exported from Solidworks incl. vertex colors), which I want to visualize using vtk. The header information of the file shows that it contains some color information:
format binary_little_endian 1.0
comment SOLIDWORKS generated,length unit = Millimeter
element vertex 8927
property float x
property float y
property float z
element face 17436
property uchar red
property uchar green
property uchar blue
property uchar alpha
property list uchar int vertex_indices

I read the file using vtkPLYReader, but somehow I do not see different colors on the model. The whole model is represented as white. If I open the file in e.g. ParaView or MeshLab, the colors are there.

dataPath = 'model.PLY'

 reader = vtk.vtkPLYReader()

polyDataMapper = vtk.vtkPolyDataMapper()

actor = vtk.vtkActor()


How could I visualize it with colors?

Hi, friend,

Why did you disable rendering of scalar fields?



This is the ColorMode you want to use.

None of the color mode in mapper shows the colors on the model.

Unfortunately there is no difference between on or off for the representation.

Can you share one file so we can check what is going on here?

Please see a sample file testModel.PLY (48.8 KB). As mentioned above, I can see all colors (yellow and black), if I open it via ParaView or MeshLab
Thank you!

In PV I had to remove the 4th component otherwise it would be all transparent when I disable the “Map Scalars”

Sorry what do you mean with PV exactly? The file? What is the 4th component?

In ParaView I had to use the calculator to strip down the alpha component of the RGBA provided to get the black/yellow color. Since the available alpha is only equal to 0.

Could you please explain how to do that in ParaView, so that I can follow your steps?
Thank you!

Ok. No need to explain. I figured it out. In “Color Map Editor” I select the “Interpret Values As Categories” and under “Annotations”, I select the desired color. During export as ply file, I deselect the “Alpha” value and write it only with RGB color information.
Thank you for your effort.

Actually that is not it. That is what I did…