<html><head></head><body><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div><div>I found a problem similar to this when using vtkPolyData->SetPoints(). If the point coordinates were not initialised, no polygons were produced. </div><div><br></div><div>I didn't search the code, but it seemed to me that the coordinate values (floats) should be explicitly set to zero when a vtkPoint object is created (or any other object with real values), because I presume the compiler will not do it automatically (unlike integers).</div><div><br></div><div>Todd.<br></div></div>
<div><br></div><div><br></div>
<div id="yahoo_quoted_3869319417" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Thursday, December 14, 2017, 10:45:17 AM GMT+13, Bill Lorensen <bill.lorensen@gmail.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr">I found the problem. The OBJImporter skips any polydata that<br clear="none"> // If some vertices have tcoords and not others (likewise normals)<br clear="none"> // then we must do something else VTK will complain. (crash<br clear="none">on render attempt)<br clear="none"> // Easiest solution is to delete polys that don't have<br clear="none">complete tcoords (if there<br clear="none"> // are any tcoords in the dataset) or normals (if there are<br clear="none">any normals in the dataset).<br clear="none"><br clear="none">If does without warning. Only report the skipping if debug is on.<br clear="none">This is bad!!!<br clear="none"><br clear="none">I'll try to fix the problem in a different way. At the very least I'll<br clear="none">warn out loud about the skipping.<br clear="none"><br clear="none">I've attached a model.obj that removes the tcoords and normals.<br clear="none"><br clear="none">Bill<br clear="none"><br clear="none"><div class="yqt3209121762" id="yqtfd51785"><br clear="none">On Wed, Dec 13, 2017 at 3:35 PM, Bill Lorensen <<a shape="rect" ymailto="mailto:bill.lorensen@gmail.com" href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br clear="none">> There must be a bug in the OBJImporter. It reports 4 actors, but only<br clear="none">> one has polygons. The others report 0 polygons.<br clear="none">><br clear="none">> I'll take a look.<br clear="none">><br clear="none">><br clear="none">> On Wed, Dec 13, 2017 at 2:07 PM, Tony Yuan <<a shape="rect" ymailto="mailto:tonyuanac@gmail.com" href="mailto:tonyuanac@gmail.com">tonyuanac@gmail.com</a>> wrote:<br clear="none">>> Hi Sebastien,<br clear="none">>><br clear="none">>> The js loader works fine, but I couldn’t get the same behavior in C++. I<br clear="none">>> tried to see if the reader has multiple outputs, but<br clear="none">>> objReader.getNumberOfOutputPorts() returns 1.<br clear="none">>><br clear="none">>> I am interested in getting the mesh as a vtkPolyData, is there a way I can<br clear="none">>> do that with OBJImporter? There seems to be no GetOutput function like<br clear="none">>> OBJReader.<br clear="none">>><br clear="none">>> Tony<br clear="none">>><br clear="none">>> On Dec 13, 2017, at 12:25 PM, Sebastien Jourdain<br clear="none">>> <<a shape="rect" ymailto="mailto:sebastien.jourdain@kitware.com" href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>> wrote:<br clear="none">>><br clear="none">>> The file you sent have several materials and I think that the vtkOBJReader<br clear="none">>> just read the first one as it is focusing on the mesh only.<br clear="none">>><br clear="none">>> Your file is correct and I've tried it with vtk.js with success here:<br clear="none">>> <a shape="rect" href="https://kitware.github.io/vtk-js/examples/OBJViewer.html" target="_blank">https://kitware.github.io/vtk-js/examples/OBJViewer.html</a><br clear="none">>><br clear="none">>> But you may have more luck with the importer which could also process the<br clear="none">>> mtl file that should come along. That way all the pieces that compose that<br clear="none">>> object will be loaded.<br clear="none">>><br clear="none">>> Seb<br clear="none">>><br clear="none">>> On Wed, Dec 13, 2017 at 9:40 AM, Tony Yuan <<a shape="rect" ymailto="mailto:tonyuanac@gmail.com" href="mailto:tonyuanac@gmail.com">tonyuanac@gmail.com</a>> wrote:<br clear="none">>>><br clear="none">>>> Hi,<br clear="none">>>><br clear="none">>>> I have a problem reading Blender OBJ files using VTK. The vtkOBJReader<br clear="none">>>> seems to only read part of the mesh. When I render the data being read it<br clear="none">>>> looks like this:<br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>> However, when I import the OBJ file in Meshlab it looks fine. Mac’s<br clear="none">>>> Preview is also able to open the complete mesh.<br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>> I attached the OBJ file and my code below. I am not very familiar with the<br clear="none">>>> OBJ format and how vtkOBJReader is implemented. If someone could point me to<br clear="none">>>> the problem and possible fixes, that would be great.<br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>> Thanks,<br clear="none">>>> Tony<br clear="none">>>><br clear="none">>>><br clear="none">>>> _______________________________________________<br clear="none">>>> Powered by www.kitware.com<br clear="none">>>><br clear="none">>>> Visit other Kitware open-source projects at<br clear="none">>>> <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br clear="none">>>><br clear="none">>>> Please keep messages on-topic and check the VTK FAQ at:<br clear="none">>>> <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br clear="none">>>><br clear="none">>>> Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br clear="none">>>><br clear="none">>>> Follow this link to subscribe/unsubscribe:<br clear="none">>>> <a shape="rect" href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br clear="none">>>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> _______________________________________________<br clear="none">>> Powered by www.kitware.com<br clear="none">>><br clear="none">>> Visit other Kitware open-source projects at<br clear="none">>> <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br clear="none">>><br clear="none">>> Please keep messages on-topic and check the VTK FAQ at:<br clear="none">>> <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br clear="none">>><br clear="none">>> Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br clear="none">>><br clear="none">>> Follow this link to subscribe/unsubscribe:<br clear="none">>> <a shape="rect" href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br clear="none">>><br clear="none">><br clear="none">><br clear="none">><br clear="none">> --<br clear="none">> Unpaid intern in BillsBasement at noware dot com<br clear="none"><br clear="none"><br clear="none"><br clear="none">-- <br clear="none">Unpaid intern in BillsBasement at noware dot com</div></div><div class="yqt3209121762" id="yqtfd10548">_______________________________________________<br clear="none">Powered by www.kitware.com<br clear="none"><br clear="none">Visit other Kitware open-source projects at <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br clear="none"><br clear="none">Please keep messages on-topic and check the VTK FAQ at: <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br clear="none"><br clear="none">Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br clear="none"><br clear="none">Follow this link to subscribe/unsubscribe:<br clear="none"><a shape="rect" href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br clear="none"></div></div>
</div>
</div></div></body></html>