[vtkusers] Point data averaging !!! How to stop it?

David Gobbi david.gobbi at gmail.com
Tue Apr 1 18:00:36 EDT 2014


I can't be sure about either of these, but here are a couple possibilities:

1) If you are only seeing averaging right at the very edge, it might be
due to hardware antialiasing, which you can turn off by calling
renderWindow->SetMultiSamples(0).

2) The vtkDataSetMapper might be doing unexpected things to your
data.  The vtkDataSetMapper is just a convenience class that calls
vtkDataSetSurfaceFilter to "skin" the data before passing it to the
vtkPolyDataMapper.  So you can try calling vtkDataSetSurfaceFilter
directly and check its output to see if it has merged any points.

  David


On Tue, Apr 1, 2014 at 3:40 PM, Davood Ansari <david.ansari at gmail.com> wrote:
> Hi all
> I am reseeding this email in the hope that some one knows some thing.
>
> I am visualizing some surface integral equation solution in VTK using
> unstructured grid.
> The color/scalars are associated with points but since I  do not want
> to have any averaging between adjacent polygons I assign duplicate points (
> and scalars )
> in my unstructured grid. Despite that, I see clear averaging between the
> scalars near the
> common edges. How can I stop that ???
> Attached is the simplified code
>
> Thanks in advance
>
>
>
> void arrayIEFFT::arrayIEFFT::visFaces(vtkUnstructuredGrid* faceGrid,
> vtkPoints* facePoints)
> {
>   pointMap myPointMap;
>   myPointMap.clear();
>
>   std::vector<myReal> visScalarsTmp;
>   std::vector<char> visScalarsTmpCounter;
>   VTK_CREATE(vtkDoubleArray, visScalars) ;// This shall contain the scalar
> data
>   visScalars->SetName("_visScalars") ;
>   visScalars->SetNumberOfComponents(1);
>
>
>   VTK_CREATE(vtkDoubleArray, visVector) ;// This shall contain the vector
> field plot data
>   visVector->SetNumberOfComponents(3) ;
>   visVector->SetName("_visVector");
>
>
>   int faceGridPointCounter = 0;
>   VTK_CREATE(vtkIdList, facePointIds);
>   facePointIds->Allocate(9);
>   facePointIds->SetNumberOfIds(9);
>   .
>   .
>   .
>   .
>
>   faceGrid->SetPoints(facePoints);
>   faceGrid->GetPointData()->SetScalars(visScalars);
>   faceGrid->GetPointData()->AddArray(visVector) ;
>
>   std::cout << "\nTotal number of visulization nodess: " <<
> faceGrid->GetNumberOfPoints();
>   std::cout << "\nTotal number of visulized cells: " <<  cellCount;
>   std::cout.flush();
> }
>
> void arrayIEFFT::arrayIEFFT::visualize()
> {
>     VTK_CREATE(vtkUnstructuredGrid, faceGrid);
>     VTK_CREATE(vtkPoints, facePoints);
>
>     visFaces(vtkUnstructuredGrid* faceGrid, vtkPoints* facePoints)
>
>     VTK_CREATE(vtkDataSetMapper,faceMapper);
>     faceMapper->SetInput(faceGrid);
>     faceMapper->SetScalarVisibility(1);
>
>
>     vtkActor *faceActor = vtkActor::New();
>     faceActor->SetMapper( faceMapper );
>     faceActor->GetProperty()->SetOpacity(1.);
>
>     vtkRenderer *rederer= vtkRenderer::New();
>     rederer->AddActor( faceActor );
>
>     vtkCamera* cam = rederer->GetActiveCamera();
>     cam->SetPosition(myConf.cameraPosition[0], myConf.cameraPosition[1],
> myConf.cameraPosition[2]);
>     cam->SetFocalPoint(myConf.camFocalX,myConf.camFocalY,myConf.camFocalZ);
>
>     vtkRenderWindow *renWin = vtkRenderWindow::New();
>     renWin->AddRenderer( rederer );
>     renWin->SetSize( myConf.winX, myConf.winY );
>     //renWin->SetOffScreenRendering(1.);
>     renWin->SetWindowName(strm.c_str());
>     vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>     renWin->Start();
>     renWin->Render();
> }


More information about the vtkusers mailing list