Questions about the Point Cloud Data representation.

Hi all!

I have some questions about Point Cloud Data.

Question 1)
The colors are represented differently depending on zoom(In my code).
(zoom in)


(zoom out)

But ParaView shows the same color regardless of zoom.
(The below image is shown applied the Jet colormap.)
paraview
How to show the same color regardless of zoom?

Question 2)
When I dragging the point cloud data, the surface is shiny.
But ParaView, the surface is not shiny.

How to disable the shiny option on the code?

Could you please advise me? :cry:

Thank you :slight_smile:

Could you attach a data file of this data here for us to try out?

Looks like aliasing to me, but I’d be happy to give it a go with your data

Hi Bane Sullivan.

I attached my PLY file.

Please help me :cry:

Question 1

I can’t reproduce this issue - Using PyVista, the colors are the same regardless of zoom level - I have no idea why your code would do this.

import pyvista as pv
import numpy as np
# Re cast PolyData because file was not properly saved
bad = pv.read('myPLY.ply')
mesh = pv.PolyData(bad.points)
# Plot it
scalars = bad['RGB']
mesh.plot(scalars=scalars)

com-video-to-gif-3

Question 2

This likely has to do with the lighting set on your actor’s property: actor.GetProperty().LightingOn(). also, are you filtering this point cloud to a surface via a Delaunay filter or anything? Or are you keeping it a Points Representation?

I can’t say much more without seeing screenshots/your code.

Additionally

Another point - you have RGB values for this mesh - perhaps turn off the scalar mapping and just use the RGB values for coloring your mesh. This is streamlined in PyVista as:

mesh.plot(scalars=scalars, rgb=True)

Hi Bane!

Thank you for your reply :slight_smile:

My environment is as below:
IDE: Visual Studio 2015 MFC
VTK: ver 8.9

And my test code is:

vtkSmartPointer<vtkPLYReader> pPLYReader =
	vtkSmartPointer<vtkPLYReader>::New();
pPLYReader->SetFileName(path);
pPLYReader->Update();	

int numPts = pPLYReader->GetOutput()->GetPoints()->GetNumberOfPoints();

double bounds[6];
pPLYReader->GetOutput()->GetBounds(bounds);

// Find min and max z
double minz = bounds[4];
double maxz = bounds[5];

vtkSmartPointer<vtkLookupTable> lut =
	vtkSmartPointer<vtkLookupTable>::New();
lut->SetTableRange(minz, maxz);
//lut->SetHueRange(0.0, 0.667);
lut->SetHueRange(1.0, 0.0);
lut->SetNumberOfColors(numPts);
lut->SetScaleToLinear();
lut->SetAlphaRange(0.0, 0.0);
lut->Build();

vtkSmartPointer<vtkUnsignedCharArray> colors =
	vtkSmartPointer<vtkUnsignedCharArray>::New();
colors->SetNumberOfComponents(3);
colors->SetName("Colors");
for (int i = 0; i < numPts; i++)
{
	double p[3];
	pPLYReader->GetOutput()->GetPoint(i, p);

	double dcolor[3];
	lut->GetColor(p[2], dcolor);
	unsigned char color[3];
	for (unsigned int j = 0; j < 3; j++)
	{
		color[j] = static_cast<unsigned char>(255.0 * dcolor[j]);
	}

	colors->InsertNextTypedTuple(color);
}

vtkSmartPointer<vtkPolyData> pPolyData = pPLYReader->GetOutput();
pPolyData->GetPointData()->SetScalars(colors);

vtkSmartPointer<vtkPointGaussianMapper> mapper =
	vtkSmartPointer<vtkPointGaussianMapper>::New();
mapper->SetInputConnection(pPLYReader->GetOutputPort());
mapper->SetScaleFactor(0);

vtkSmartPointer<vtkActor> actor =
	vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetOpacity(1.0);

vtkSmartPointer<vtkRenderer> renderer =
	vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);
renderer->SetBackground(.1, .2, .3);
renderer->ResetCamera();

m_vtkRenderWindow->AddRenderer(renderer);
m_vtkRenderWindow->Render();

renderer->ResetCamera();
m_vtkRenderWindow->Render();

So… If you have any spare time, could you please check my code?
Actually, I don’t know that my code is correctly used.

Thank you :slight_smile:

Hi all.

I found to disable the shiny option.

If the ‘SetEmissive’ function is set to ‘false’, the shiny effect disappears.

...
vtkNew<vtkPointGaussianMapper> mapper;
mapper->SetEmissive(false);
...

automation technology 3D camera calibration target?