[vtkusers] vtkOBJReader not reading the whole mesh

Sebastien Jourdain sebastien.jourdain at kitware.com
Wed Dec 13 15:13:20 EST 2017


That script [1] should work with ParaView to generate the various datasets.
Once they are converted, you can load them in your VTK application. Also,
if you need you can merge the various polydata into a single file using
ParaView.

[1]
https://github.com/Kitware/vtk-js/blob/master/Utilities/ParaView/obj-mtl-importer.py

On Wed, Dec 13, 2017 at 12:07 PM, Tony Yuan <tonyuanac at gmail.com> wrote:

> Hi Sebastien,
>
> The js loader works fine, but I couldn’t get the same behavior in C++. I
> tried to see if the reader has multiple outputs, but objReader.getNumberOfOutputPorts()
> returns 1.
>
> I am interested in getting the mesh as a vtkPolyData, is there a way I can
> do that with OBJImporter? There seems to be no GetOutput function like
> OBJReader.
>
> Tony
>
> On Dec 13, 2017, at 12:25 PM, Sebastien Jourdain <
> sebastien.jourdain at kitware.com> wrote:
>
> The file you sent have several materials and I think that the vtkOBJReader
> just read the first one as it is focusing on the mesh only.
>
> Your file is correct and I've tried it with vtk.js with success here:
> https://kitware.github.io/vtk-js/examples/OBJViewer.html
>
> But you may have more luck with the importer which could also process the
> mtl file that should come along. That way all the pieces that compose that
> object will be loaded.
>
> Seb
>
> On Wed, Dec 13, 2017 at 9:40 AM, Tony Yuan <tonyuanac at gmail.com> wrote:
>
>> Hi,
>>
>> I have a problem reading Blender OBJ files using VTK. The vtkOBJReader
>> seems to only read part of the mesh. When I render the data being read it
>> looks like this:
>>
>>
>>
>> However, when I import the OBJ file in Meshlab it looks fine. Mac’s
>> Preview is also able to open the complete mesh.
>>
>>
>>
>> I attached the OBJ file and my code below. I am not very familiar with
>> the OBJ format and how vtkOBJReader is implemented. If someone could point
>> me to the problem and possible fixes, that would be great.
>>
>>
>>
>> Thanks,
>> Tony
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171213/0289048f/attachment.html>


More information about the vtkusers mailing list