[vtkusers] vtkQuadricDecimation and colors
Olli
gammelnerd at gmail.com
Wed Feb 17 04:48:41 EST 2010
Hi,
I'm rendering elevation data. Originally data is a structured grid and very
dense. But looks fine. When I try to reduce number of polygons using
vtkQuadricDecimation I loose all colors and get a gray scale image. I wonder
why? What does decimation do to the data so that mapper cannot color it any
more?
Btw. Using vtkDecimatePro solves the coloring problem. But the question
remains: why colors disappear when I use vtkQuadricDecimation? Why?
The pipeline I use is below. (No smart pointers, I know. It's a sample and
easier to read, when not using smart pointers). It works just fine if I skip
quadric decimation.
Thanks,
Olli
vtkImageImport* reader = vtkImageImport::New();
// import settings
// ...
reader->Update();
vtkDataSetSurfaceFilter* filter = vtkDataSetSurfaceFilter::New();
filter->SetInputConnection(reader->GetOutputPort());
reader->Delete();
filter->ReleaseDataFlagOn();
filter->Update();
vtkWarpScalar* warp = vtkWarpScalar::New();
warp->SetInputConnection(filter->GetOutputPort());
filter->Delete();
warp->SetScaleFactor(3);
warp->Update();
vtkQuadricClustering* cluster = vtkQuadricClustering::New();
cluster->SetInputConnection(warp->GetOutputPort());
warp->Delete();
cluster->AutoAdjustNumberOfDivisionsOff();
cluster->SetNumberOfDivisions(240, 240, 10);
cluster->PreventDuplicateCellsOn();
cluster->UseInputPointsOn();
cluster->Update();
vtkQuadricDecimation *dec=vtkQuadricDecimation ::New();
dec->SetInputConnection(cluster->GetOutputPort());
cluster->Delete();
dec->SetTargetReduction(.80);
dec->Update();
// color map for terrain
vtkColorTransferFunction* lut = vtkColorTransferFunction::New();
lut->AddHSVSegment(1, 0.3, 0.7, 0.7, 2000, 0.1, 0.7, 0.7); // terrain
lut->AddHSVPoint(0, 0.667, 0.7, 1); // sea level
vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
mapper->SetInputConnection(dec->GetOutputPort());
dec->Delete();
mapper->ScalarVisibilityOn();
mapper->SetScalarRange(0, 1000);
mapper->SetLookupTable(lut);
lut->Delete();
mapper->Update();
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100217/ad4ab578/attachment.htm>
More information about the vtkusers
mailing list