[vtkusers] Smooth shading
Yoshinori KONISHI
ykoni at ari.ncl.omron.co.jp
Thu May 15 05:10:30 EDT 2014
Hello all,
Though I am trying to get a smooth shaded CAD object (.stl),
the rendered image looks like that of flat shading (not smooth).
Could anyone tell me how to correct my code ?
--------------------------- (VTK 6.1.0 on Win7 64bit)
vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();
reader->SetFileName(inputFilename.c_str());
reader->Update();
vtkSmartPointer<vtkPolyDataMapper> cadMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
cadMapper->SetInputConnection(reader->GetOutputPort());
vtkSmartPointer<vtkActor> cadActor = vtkSmartPointer<vtkActor>::New();
cadActor->SetMapper(cadMapper);
cadActor->GetProperty()->SetInterpolation(VTK_GOURAUD);
vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();
ren1->AddActor(cadActor);
ren1->SetBackground(0.1, 0.2, 0.4);
vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow>::New();
renWin->AddRenderer(ren1);
renWin->SetSize(640, 480);
--------------------------------------
Thank you.
More information about the vtkusers
mailing list