Hello all,
I have a strange behavior of vtkPointGaussianMapper using vtkPoints. It seems like the triangles are not transparent or are not correctly sorted.
I’m not sure if I correctly use vtkPointGaussianMapper or do I have to set additional flags in the mapper?
Furthermore, I would be glad if someone could help me to set the scales using an additional array.
Here is my code:
vtkNew<vtkUnsignedCharArray> colors;
colors->SetNumberOfComponents(3);
colors->SetName("Colors");
vtkNew<vtkPoints> points;
for (int i = 0; i < locs.size(); ++i) {
const auto &l = locs[i];
points->InsertNextPoint(l.x * 1E-3, l.y * 1E-3, l.z * 1E-3);
const double z0 = (l.z + 500.0) / 1000.0;
if (l.channel == 2) {
colors->InsertNextTuple3(255.0, std::clamp(z0, 0.0, 1.0)*255, 0.0);
} else {
colors->InsertNextTuple3(0.0, std::clamp(z0, 0.0, 1.0)*255, std::clamp(-0.5 * z0 + 1.0, 0.0, 1.0)*255);
}
}
vtkNew<vtkPolyData> pointsPolydata;
pointsPolydata->SetPoints(points);
pointsPolydata->GetPointData()->SetScalars(colors);
vtkNew<vtkPointGaussianMapper> mapper;
mapper->SetInputData(pointsPolydata);
mapper->SetScaleFactor(3E-2);
mapper->SetInterpolateScalarsBeforeMapping(0);
//mapper->SetColorModeToDirectScalars();
mapper->SetColorModeToDefault();
mapper->SelectColorArray("Colors");
//mapper->SetScalarModeToUsePointFieldData();
//mapper->SetScaleArray("PointVectors");
//mapper->SetScaleArrayComponent(3);
//mapper->SetScalarModeToUsePointFieldData();
mapper->EmissiveOff();
vtkNew<vtkActor> actor;
actor->SetMapper(mapper);
d->renderer->AddActor(actor);
Thanks in advance.