# VTK import of OBJ files

**URL:** https://discourse.vtk.org/t/vtk-import-of-obj-files/16444
**Category:** Support
**Created:** [June 7, 2026, 10:13pm UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444 "2026-06-07T22:13:05Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![scruffy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@scruffy](https://discourse.vtk.org/u/scruffy)
#### Post date: [June 7, 2026, 10:13pm UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/1 "2026-06-07T22:13:05Z")

</div>

VTK is ignoring the “o” specifier in Wavefront OBJ files.

Blender is one of the few programs that handles this correctly. To see the issue, create 2 cylinders in Blender and export as OBJ, then read into VTK. You only get one object, not two.

The named object capability is vital for many things. In cell biology we need the ability to distinguish organelles from the plasma membrane.

Is there a workaround for this, or could we get VTK to return an array of objects or something?

---

<div class="post-metadata">

### Author: ![scruffy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@scruffy](https://discourse.vtk.org/u/scruffy)
#### Post date: [June 9, 2026, 4:34am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/2 "2026-06-09T04:34:18Z")

</div>

I’ve confirmed this in detail. Neither the OBJReader nor OBJImporter work correctly. The importer documentation explicitly states it doesn’t support the scene heirarchy API, even though it advertises that it does.

The named object capability is one of the big reasons people use OBJ instead of STL or other formats. In VTK you can SetObjectName(), which should save into the OBJ as an “o” specifier. On the way back in, each “o” needs up become a separate mesh.

VTK should be returning an array of meshes on import, not just one gigantic mesh. In HDF5 they handle this with registration metadata, but mere mortals have to use OBJ if a non-proprietary format is needed.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 9, 2026, 12:34pm UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/3 "2026-06-09T12:34:32Z")

</div>

> [@scruffy](#):
>
> To see the issue, create 2 cylinders in Blender and export as OBJ, then read into VTK. You only get one object, not two.

Could you share such a .obj file please ?

---

<div class="post-metadata">

### Author: ![scruffy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@scruffy](https://discourse.vtk.org/u/scruffy)
#### Post date: [June 10, 2026, 4:05am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/4 "2026-06-10T04:05:00Z")

</div>

Yes. I create each object in the usual way in Blender, using Add =\> Mesh =\> x, where x could be a sphere or cube or any shape. In the OBJ file there is a line saying “o object\_name” ahead of every set of vertices. In the attached file there are two objects, a cylinder and a sphere. The OBJ was created straight from Blender with File =\> Export =\> Wavefront OBJ.

Well… I tried to upload the file, it says “new users can not upload attachments”. Let me see if I can copy in the first few lines of the file. What comes after the “o” is the object name, in this case it’s just “Cylinder” because I didn’t name it anything special. The next one would be Cylinder\_002 and so on.

# Blender v2.93.1 OBJ File: ‘’

# 

> **[Blender - The Free and Open Source 3D Creation Software — blender.org](https://www.blender.org/)**
>
> The Freedom to Create

mtllib blender\_output.mtl  
**o Cylinder**  
v -2.228397 0.264313 1.566652  
v -2.228397 2.264313 1.566652  
v -2.033306 0.264313 1.585867

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [June 10, 2026, 5:09am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/5 "2026-06-10T05:09:37Z")

</div>

Since “o” tags can’t be nested, it seems this type of output could only apply to a root list of string/object pairs or a map.

---

<div class="post-metadata">

### Author: ![scruffy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@scruffy](https://discourse.vtk.org/u/scruffy)
#### Post date: [June 10, 2026, 6:01am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/6 "2026-06-10T06:01:00Z")

</div>

The primary need is to keep the objects separable. In Blender you can look at the object list on the top right, there you can click on any object and highlight its components. It doesn’t matter if an object is inside another object, that’s a different concept. There’s also a “g” option for group. Yes you’re right it’s a primitive form of scene definition. As far as I know there is no open/public standard that lets biologists build cells. It would be like a “sub-assembly” concept in manufacturing. However the basic need is just to keep the objects separated, so we know this membrane belongs to the nucleus and that one belongs to an organelle. When I click on the organelle in Blender, I don’t want to select the whole cell!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 10, 2026, 6:50am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/7 "2026-06-10T06:50:16Z")

</div>

Fixed, you can upload now @scruffy

---

<div class="post-metadata">

### Author: ![scruffy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@scruffy](https://discourse.vtk.org/u/scruffy)
#### Post date: [June 12, 2026, 12:56am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/8 "2026-06-12T00:56:06Z")

</div>

Thank you! Here are three files, in increasing order of complexity. The first one blender\_output.obj is simple, it just has two objects, a sphere and a cylinder. It was created by Blender, using File =\> Export =\> Wavefront OBJ. The second one blender\_output\_test1.obj has 5 objects, all cylinders, they overlap spatially (this is like reconstructing a branch of a neuron from a skeleton tracing). The third one is the most complicated, it has objects within objects (geometrically), it would be much like organelles within a cell (in this case it’s a portion of a neural network). In this last one, to see the internal objects in Blender, you have to change the outer cube to a wire frame display. Also attaching an mtl file, which you can copy and rename as needed for Blender.

[blender\_output.obj](https://discourse.vtk.org/uploads/short-url/lcpQTvNEz9L0HSh3eGnmv709HIZ.obj) (69.6 KB)

[blender\_output\_test\_1.obj](https://discourse.vtk.org/uploads/short-url/gQFywy8iXsE13og2PHtcft1d7R0.obj) (59.7 KB)

[untitled.obj](https://discourse.vtk.org/uploads/short-url/jCv3ZtBY0rPpGnoSEceB9ejHLxh.obj) (7.7 KB)

[untitled.mtl](https://discourse.vtk.org/uploads/short-url/u48StVMfvMlk5sy5I14DnBDufms.mtl) (225 Bytes)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 12, 2026, 7:23am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/9 "2026-06-12T07:23:41Z")

</div>

both blender\_output.obj and blender\_output\_test\_1.obj opens fine with both obj reader and importer:

 ![blenderoutput1](https://discourse.vtk.org/uploads/default/original/2X/f/fb43c40305175bbac53ad660522d5b53b8fd88df.png)  
 ![blenderoutputtest11](https://discourse.vtk.org/uploads/default/original/2X/7/73b54a6da9fb78c8a647f332a01071bfb2fe83c7.jpeg)

Untitled opens like this:

 ![untitled1](https://discourse.vtk.org/uploads/default/original/2X/d/de71ad5c36816106b023918a9c4b88b009180f2e.png)

Not sure what to make of it, can you share visual of expected output ?

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [June 12, 2026, 7:57am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/10 "2026-06-12T07:57:17Z")

</div>

In the case of _blender\_output_ I suppose @scruffy expects to see two sub-nodes in the tree view; one for the cylinder and one for the sphere.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 12, 2026, 8:07am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/11 "2026-06-12T08:07:49Z")

</div>

> [@toddy](#):
>
> in the tree view;

What tree view ?

If you mean that the importer should provide different actors, it does.

 ![blenderoutputtest12](https://discourse.vtk.org/uploads/default/original/2X/7/744e2a187c7cfe236e5ada93730ddbe40424f874.jpeg)

If you mean the the reader should provide a composite structure, it indeed does not and I agree it should.

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [June 12, 2026, 8:13am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/12 "2026-06-12T08:13:13Z")

</div>

> [@mwestphal](#):
>
> What tree view ?

Sorry. I used Paraview. Duh!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 12, 2026, 8:20am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/13 "2026-06-12T08:20:07Z")

</div>

It looks to me the importer is doing the right thing, even for untilted.obj:

 ![untitled2](https://discourse.vtk.org/uploads/default/original/2X/6/67a36b38a8273a160e143b631142e4a91daa1e13.png)

 ![untitled3](https://discourse.vtk.org/uploads/default/original/2X/0/0d0287de321f1078747cd7f1d7362cafd1424818.png)

---

<div class="post-metadata">

### Author: ![scruffy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@scruffy](https://discourse.vtk.org/u/scruffy)
#### Post date: [June 13, 2026, 1:47am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/14 "2026-06-13T01:47:23Z")

</div>

Wait… what are we looking at here? To get the list on the left, you’re enumerating actors? I have to work backwards to the underlying data points? That would explain some things, i’ll go try it. (I was originally trying to get the intersections between the cylinders).

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 13, 2026, 5:39am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/15 "2026-06-13T05:39:37Z")

</div>

> [@scruffy](#):
>
> Wait… what are we looking at here?

F3D: [https://f3d.app/](https://f3d.app/), which uses the vtkOBJImporter

> To get the list on the left, you’re enumerating actors?

Not exactly, we are using this API: vtkImporter::GetSceneHierarchy and vtkImporter::GetImportedActors

> get the intersections between the cylinders

Thats not really related, to get the intersection you need some kind of boolean computation, which VTK is not really tooled for, but Vespa ([https://gitlab.kitware.com/vtk/meshing/vespa](https://gitlab.kitware.com/vtk/meshing/vespa)) can I think.

---

<div class="post-metadata">

### Author: ![scruffy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@scruffy](https://discourse.vtk.org/u/scruffy)
#### Post date: [June 16, 2026, 1:42am UTC](https://discourse.vtk.org/t/vtk-import-of-obj-files/16444/16 "2026-06-16T01:42:55Z")

</div>

Thank you!
