[vtkusers] vtkObjReader doesn't support obj. files

Tim Hutton tim.hutton at gmail.com
Thu Jan 31 04:53:33 EST 2008


Hi Iryna,

I rewrote the OBJ reader, so I'm probably to blame. Take a look at
vtkOBJReader.cxx to see the parts of the OBJ format it supports.

One thing I notice is that your file doesn't have any vn lines (unless
you've skipped them), so referencing them in the faces will cause a
problem. If each line was as e.g.
f 9 10 198
then it would be a valid OBJ file.

The fact that other readers support this file is not so surprising -
the OBJ format is remarkably complicated and often abused. (And often
cannot be read straight into VTK since it supports per-face normals
and tcoords and VTK doesn't - vtkOBJReader duplicates vertices as
necessary for this.)

Tim

On 30/01/2008, Iryna Pavlyshak <iryna at andrew.cmu.edu> wrote:
> Hello all,
>
> I use vtkObjReader for opening and rendering the .obj file, which represents set of Vertices and Polygons. My code can open without problems 3DMax  obj.,  Poser obj. and so on. But when opening wanted obj. file, which is represented as:
> # File Generated By Veridian write_wave v 1.1
> # 145711 Vertices, 283595 Polygons
>
> mtllib csr0125a.mtl
>
> g csr0125a.obj vertices
> v 626.4 -62.8 -1000.0 1 1 3
> v 627.0 -59.0 -1000.0 1 1 3
> ........
> v 72.6 41.9 626.0 12 5 1
> g csr0125a.obj faces
> usemtl m1
> f 9//9 10//10 198//198
> f 199//199 198//198 10//10
> ....................
> f 145703//145703 145704//145704 145708//145708
>
> the following massage appears:
> Unhanded exception at ..:Access violation reading location...
> So the problem is with the pointer...and as it follows with normals.
>
> The file is not impossible for opening. I tried others software and they open this obj. file.
>
> Maybe somebody has already been faced with similar problem..
> There is a possibility that somebody rewritten vtkObjReader. It would be great.
>
> waiting for any tips,
> Iryna
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>


-- 
Tim Hutton - http://www.sq3.org.uk

Take the Organic Builder challenge -
http://www.sq3.org.uk/Evolution/Squirm3/OrganicBuilder/



More information about the vtkusers mailing list