on the normals filter try<div>->SplittingOff();</div><div><br><div class="gmail_quote">On Fri, Jul 6, 2012 at 9:22 AM, Mika Fischer <span dir="ltr"><<a href="mailto:mika.fischer@zoopnet.de" target="_blank">mika.fischer@zoopnet.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok, unfortunately now I get a problem when mapping the texture on the<br>
surface. There are strage "seams" in some places:<br>
<a href="http://zoopnet.de/vrml2.png" target="_blank">http://zoopnet.de/vrml2.png</a><br>
<br>
Without vtkCleanPolyData the texture mapping worked fine. I think the<br>
problem might be caused by the vertices of the polygons being changed<br>
by vtkCleanPolyData. Is there something I can do to transform the<br>
texture in the same way?<br>
<br>
The code used for texturing is below.<br>
<br>
Thanks a lot in advance!<br>
<br>
Best,<br>
Mika<br>
<br>
------------------------------------------------------------<br>
vtkSmartPointer<vtkBMPReader> bmpReader = vtkSmartPointer<vtkBMPReader>::New();<br>
bmpReader->SetFileName(fileBmp.c_str());<br>
bmpReader->Update();<br>
<br>
vtkImageData* image = bmpReader->GetOutput();<br>
vtkTexture *texture = vtkTexture::New();<br>
texture->SetInputConnection(bmpReader->GetOutputPort());<br>
texture->InterpolateOn();<br>
<br>
[...]<br>
<br>
solidActor->SetTexture(texture);<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Fri, Jul 6, 2012 at 3:06 PM, Mika Fischer <<a href="mailto:mika.fischer@zoopnet.de">mika.fischer@zoopnet.de</a>> wrote:<br>
> Yes, that fixed it! Thanks a lot!<br>
><br>
> Best,<br>
> Mika<br>
><br>
> On Fri, Jul 6, 2012 at 3:01 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>
>> Try running vtkCleanPolyData before the normals calculation. The data may<br>
>> duplicate the points for each triangle. clean polydata will remove duplicate<br>
>> points.<br>
>><br>
>> On Fri, Jul 6, 2012 at 5:21 AM, Mika Fischer <<a href="mailto:mika.fischer@zoopnet.de">mika.fischer@zoopnet.de</a>><br>
>> wrote:<br>
>>><br>
>>> Hi,<br>
>>><br>
>>> first of all I have to say that is the first time that I use vtk and I<br>
>>> don'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'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<vtkVRMLImporter> importer =<br>
>>> vtkSmartPointer<vtkVRMLImporter>::New();<br>
>>> importer->SetFileName(fileWrl.c_str());<br>
>>> importer->Read();<br>
>>> importer->Update();<br>
>>><br>
>>> vtkActorCollection* actors = importer->GetRenderer()->GetActors();<br>
>>> actors->InitTraversal();<br>
>>> vtkDataSet* pDataset = actors->GetNextActor()->GetMapper()->GetInput();<br>
>>><br>
>>> vtkPolyData* polyData = vtkPolyData::SafeDownCast(pDataset);<br>
>>> polyData->Update();<br>
>>><br>
>>> vtkSmartPointer<vtkPolyDataNormals> skinNormals =<br>
>>> vtkSmartPointer<vtkPolyDataNormals>::New();<br>
>>> skinNormals->SetFeatureAngle(90.0);<br>
>>> skinNormals->SetInput(polyData);<br>
>>> skinNormals->Update();<br>
>>><br>
>>> vtkSmartPointer<vtkPolyDataMapper> solidMapper =<br>
>>> vtkSmartPointer<vtkPolyDataMapper>::New();<br>
>>> solidMapper->SetInputConnection(skinNormals->GetOutputPort());<br>
>>> solidMapper->ScalarVisibilityOff();<br>
>>><br>
>>> vtkSmartPointer<vtkActor> solidActor = vtkSmartPointer<vtkActor>::New();<br>
>>> solidActor->SetMapper(solidMapper);<br>
>>> solidActor->GetProperty()->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<br>
>>> <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:<br>
>>> <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>
>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Unpaid intern in BillsBasement at noware dot com<br>
>><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>
</div>