[vtkusers] Problem with color after using vtkClipPolyData

ysa0829 ysa0829 at gmail.com
Fri Jan 30 01:20:22 EST 2015


hi guys,

I have the same problem.
My origin data is a vrml model that has own vertex color .
here is my code for displaying origin model,and it is displaying right.

///////////////code for displaying origin model///////////////
vtkActor *actor = vtkActor::New();
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetLookupTable(vrmlModel->lookupTable);
mapper->SetScalarRange(vrmlModel->lookupTable->GetTableRange());
mapper->SetInputData(vrmlModel->polyData);
renderer->AddActor(actor);
///////////////code for displaying origin model///////////////

<http://vtk.1045678.n5.nabble.com/file/n5730269/%E6%93%B7%E5%8F%96.jpg> 

I used a vtkTableBasedClipDataSet to clip the vrml model,and I found that
the polyData output color is not correct like this picture.

///////////////code for displaying clip model///////////////
	vtkPlane *plane = vtkPlane::New();
	plane->SetOrigin(0, 0, 10);
	plane->SetNormal(0, 0, 1);


	vtkSmartPointer<vtkClipPolyData> clipper =
		vtkSmartPointer<vtkClipPolyData>::New();
	clipper->SetInputData(vrmlModel->polyData);
	clipper->SetClipFunction(plane);
	clipper->SetGenerateClippedOutput(1);
	clipper->SetInsideOut(1);
	clipper->Update();

	vtkSmartPointer<vtkDataSetMapper> clipMapper =
		vtkSmartPointer<vtkDataSetMapper>::New();

	clipMapper->SetInputConnection(clipper->GetOutputPort());


	clipMapper->ScalarVisibilityOn();
	clipMapper->SetLookupTable(vrmlModel->lookupTable);
	clipMapper->SetScalarRange(vrmlModel->lookupTable->GetRange());

	vtkSmartPointer<vtkActor> clipActor =	vtkSmartPointer<vtkActor>::New();
	clipActor->SetMapper(clipMapper);

        renderer->AddActor(clipActor);
	
///////////////code for displaying clip model///////////////
<http://vtk.1045678.n5.nabble.com/file/n5730269/%E6%93%B7%E5%8F%963.jpg> 


How do I get the clip polydata that has right color? 

I will appreciate any suggestion very much!






--
View this message in context: http://vtk.1045678.n5.nabble.com/Problem-with-color-after-using-vtkClipPolyData-tp5717563p5730269.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list