which shows colors based on cells data. i want to have some sort of interpolation to make it smoother and have color transition, so i set points color of my structured grid using vtkCellDataToPointData class like this:
vtkNew<vtkStructuredGrid> grid;
// initialize grid with desired properties
vtkSmartPointer<vtkCellDataToPointData> cellDataToPointData =
vtkSmartPointer<vtkCellDataToPointData>::New();
cellDataToPointData->SetInputData(grid);
cellDataToPointData->PassCellDataOn(); // Specify that cell data should be passed to points
cellDataToPointData->Update();
vtkPointData* interpolatedPointData = cellDataToPointData->GetOutput()->GetPointData();
// Get the output grid with interpolated point data
grid->GetPointData()->ShallowCopy(interpolatedPointData);
comparing the results with my previous cell based coloring we can see it is correct but i think the colros is somehow vague and i feel it is not the way it should be. becasue when i use paraview i see something like this:
what is wrong with my solution. do i miss some settings or i am using wrong way to reach my expectation. also i want to know if there is a way to set the interpolation scheme when i interpolate cell colors to points in VTK?
I’m curious as to why the coloring between the VTK C++ example, and the ParaView result are different. is this a function of the lookup table used, or something else? What does your PV pipeline look like (to make sure that the data averaging is the same).
In your vtkDataSetMapper, you probably need to call InterpolateScalarsBeforeMappingOn(). That is on by default in ParaView, off by default in VTK. I suspect that is the difference.
Looking at the image again, the scalar values look nearly random, and the resolution is poor. Averaging this sort of data (which is what cell data to point data does) is going to produce muddy results. The graphics rendering process is also going to shade across the resulting polygons, again mushing the colors.
When i compare my two images, one for cell and one for point, i see that the point based image is actually doing right based on coloring. if i am not wrong, there is no issue from averaging point of view. the issue seems to be related to rendering.
also i was searching and i encountered vtkPointInterpolator.h. do you think this can be solution? it also have kernel concept which is also what i wanted at the first place. but couldn’t find usage examples for it actually to use it in my case.