[vtkusers] vtkOBJReader not reading the whole mesh
Bill Lorensen
bill.lorensen at gmail.com
Wed Dec 13 16:44:42 EST 2017
I found the problem. The OBJImporter skips any polydata that
// If some vertices have tcoords and not others (likewise normals)
// then we must do something else VTK will complain. (crash
on render attempt)
// Easiest solution is to delete polys that don't have
complete tcoords (if there
// are any tcoords in the dataset) or normals (if there are
any normals in the dataset).
If does without warning. Only report the skipping if debug is on.
This is bad!!!
I'll try to fix the problem in a different way. At the very least I'll
warn out loud about the skipping.
I've attached a model.obj that removes the tcoords and normals.
Bill
On Wed, Dec 13, 2017 at 3:35 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> There must be a bug in the OBJImporter. It reports 4 actors, but only
> one has polygons. The others report 0 polygons.
>
> I'll take a look.
>
>
> On Wed, Dec 13, 2017 at 2: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
>>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
--
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: model.obj
Type: application/octet-stream
Size: 622245 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171213/8c62dbf6/attachment-0001.obj>
More information about the vtkusers
mailing list