Try running vtkCleanPolyData before the normals calculation. The data may duplicate the points for each triangle. clean polydata will remove duplicate points.<br><br><div class="gmail_quote">On Fri, Jul 6, 2012 at 5:21 AM, Mika Fischer <span dir="ltr">&lt;<a href="mailto:mika.fischer@zoopnet.de" target="_blank">mika.fischer@zoopnet.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
first of all I have to say that is the first time that I use vtk and I<br>
don&#39;t have much experience with 3D graphics.<br>
<br>
I have a 3d triangle mesh of a face in wrl format. I also managed to<br>
display it. However the shading of the triangles seems to be flat.<br>
Calling SetInterpolationToGouraud() or SetInterpolationToFlat() seems<br>
to make no difference.<br>
<br>
The code used to load the data and display it is below. Am I missing<br>
an important step here?<br>
<br>
Also, if I load the file in ParaView, it has the same issue and<br>
switching from Flat to Gouraud makes no visible difference. However if<br>
I use a CylinderSource, the shading is smooth as I would expect it<br>
(and switching to flat makes a huge difference).<br>
<br>
Here&#39;s a screenshot of the data in paraview: <a href="http://zoopnet.de/vrml.png" target="_blank">http://zoopnet.de/vrml.png</a><br>
<br>
Any tips would be very much appreciated!<br>
<br>
Best,<br>
 Mika<br>
<br>
-------------------------------------<br>
vtkSmartPointer&lt;vtkVRMLImporter&gt; importer =<br>
vtkSmartPointer&lt;vtkVRMLImporter&gt;::New();<br>
importer-&gt;SetFileName(fileWrl.c_str());<br>
importer-&gt;Read();<br>
importer-&gt;Update();<br>
<br>
vtkActorCollection* actors = importer-&gt;GetRenderer()-&gt;GetActors();<br>
actors-&gt;InitTraversal();<br>
vtkDataSet* pDataset = actors-&gt;GetNextActor()-&gt;GetMapper()-&gt;GetInput();<br>
<br>
vtkPolyData* polyData = vtkPolyData::SafeDownCast(pDataset);<br>
polyData-&gt;Update();<br>
<br>
vtkSmartPointer&lt;vtkPolyDataNormals&gt; skinNormals =<br>
vtkSmartPointer&lt;vtkPolyDataNormals&gt;::New();<br>
skinNormals-&gt;SetFeatureAngle(90.0);<br>
skinNormals-&gt;SetInput(polyData);<br>
skinNormals-&gt;Update();<br>
<br>
vtkSmartPointer&lt;vtkPolyDataMapper&gt; solidMapper =<br>
vtkSmartPointer&lt;vtkPolyDataMapper&gt;::New();<br>
solidMapper-&gt;SetInputConnection(skinNormals-&gt;GetOutputPort());<br>
solidMapper-&gt;ScalarVisibilityOff();<br>
<br>
vtkSmartPointer&lt;vtkActor&gt; solidActor = vtkSmartPointer&lt;vtkActor&gt;::New();<br>
solidActor-&gt;SetMapper(solidMapper);<br>
solidActor-&gt;GetProperty()-&gt;SetInterpolationToGouraud();<br>
<br>
-------------------------------------<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>