# vtkGLTFImporter does not load textures

**URL:** <https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815>\
**Category:** Development\
**Created:** [November 2, 2024, 3:09pm UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815 "2024-11-02T15:09:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![gongwaner](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gongwaner/32/6996_2.png) [@gongwaner](https://discourse.vtk.org/u/gongwaner)\
**Post date:** [November 2, 2024, 3:09pm UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/1 "2024-11-02T15:09:38Z")

</div>

Hi,  
I’m trying to render GLTF models using VTK, and I followed [this example](https://examples.vtk.org/site/Cxx/IO/GLTFImporter/).  
I first tried with [the flight helmet model](https://sketchfab.com/3d-models/flighthelmet-f7f13357977944a98458cc67ec8c52c1) downloaded from sketchfab, and everything worked fine.  
Then I downloaded another model and read it using the same example code(only changed file name). The model was rendered, but not the textures.  
Below is the screenshot. Left is the model opened in CAD Assistant. Right is the model rendered using example code.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/d/ddee147b14e5553d49ea67ed2c65de8ae0eddf59.jpeg)

What caused the texture not being loaded?  
The model files are below(I tried to zip them into a single zip file, but that would exceed the attachment size limit). Originally downloaded from [sketchfab](https://sketchfab.com/3d-models/cephalopod-engonoceras-pierdenale-pri-76761-99278217b9d1405c8eca403b5ddbd8f6).  
[scene.bin](https://discourse.vtk.org/uploads/short-url/oDlYdVFb7bLv347bCFeDIeCDAIH.bin) (3.3 MB)  
[scene.gltf](https://discourse.vtk.org/uploads/short-url/adcSwBi8rInIv9LvJjGLybbY7YJ.gltf) (3.7 KB)  
[textures.zip](https://discourse.vtk.org/uploads/short-url/2LuvZRJR6RQcjQoU1etouwe1CxY.zip) (3.2 MB)  
the textures.zip should be unzipped and the structure of the files are  
|scene.bin  
|scene.gltf  
|textures  
&nbsp;&nbsp;&nbsp;&nbsp;|\*.jpeg

Regards

---

<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:** [November 4, 2024, 9:12am UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/2 "2024-11-04T09:12:13Z")

</div>

I confirm that the texture are not correctly read here, but that may be an issue in the dataset your downloaded.

---

<div class="post-metadata">

**Author:** ![gongwaner](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gongwaner/32/6996_2.png) [@gongwaner](https://discourse.vtk.org/u/gongwaner)\
**Post date:** [November 4, 2024, 10:53pm UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/3 "2024-11-04T22:53:47Z")

</div>

Hi thank you for the verification. I can open the model with cad assist, and I checked the .gltf file, the texture directory seems to be correct.  
I can think of two ways to solve this problem.  
1.I tried loading the models only with vtkGLTFReader, maybe I can then apply textures to this model to achieve the same result.  
2.verify if the models are downloaded correctly using another library. I’ll try F3D and see if it loads textures.

---

<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:** [November 5, 2024, 5:53am UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/4 "2024-11-05T05:53:27Z")

</div>

> [@gongwaner](#):
>
> I tried loading the models only with vtkGLTFReader, maybe I can then apply textures to this model to achieve the same result.

That should work

> I’ll try F3D and see if it loads textures.

F3D is using vtkGLTFImporter to load the file, it fails the same way.

---

<div class="post-metadata">

**Author:** ![gongwaner](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gongwaner/32/6996_2.png) [@gongwaner](https://discourse.vtk.org/u/gongwaner)\
**Post date:** [November 13, 2024, 4:03pm UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/5 "2024-11-13T16:03:22Z")

</div>

hi sorry for late reply.  
I checked F3D and as you said it has the same behavior as VTK.  
I tried the first method and it loads the texture but not the way I want the textures to be loaded. I think it’s because the texture coords need to be consistent with what’s specified in .gltf file.  
I think the workaround is to get the model using other formats(.obj for example). Or I need to dive into how .gltf is handled behind the scene and see if there’s a fix.  
Thanks for your time and help anyway.

---

<div class="post-metadata">

**Author:** ![berglte](https://discourse.vtk.org/user_avatar/discourse.vtk.org/berglte/32/9946_2.png) [@berglte](https://discourse.vtk.org/u/berglte)\
**Post date:** [April 28, 2025, 10:45am UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/6 "2025-04-28T10:45:03Z")

</div>

Hi, did you find a fix for this? I’m facing the same issue where my .glb file textures won’t load in my script or with F3D. Works fine in MeshLab, Blender, and several other software programs I’ve tried.

I’m on a tight deadline to get something working, so I’m interested in whether there is an easy fix or if I should change my approach and work around the issue for the time being.

---

<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:** [April 28, 2025, 11:41am UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/7 "2025-04-28T11:41:33Z")

</div>

Hi @berglte

Please share your data.

> I’m on a tight deadline to get something working

You may want to reach out to Kitware for professional support.

> **[Get Support - Kitware Europe](https://www.kitware.eu/get-support/)**
>
> \[et\_pb\_section fb\_built=”1″ fullwidth=”on” custom\_padding\_last\_edited=”off|tablet” \_builder\_version=”3.22″ background\_color=”#ffffff” custom\_margin=”-21px|||||” custom\_padding\_tablet=”50px|0|50px|0″ global\_colors\_info=”{}”\]\[et\_pb\_fullwidth\_header...

---

<div class="post-metadata">

**Author:** ![berglte](https://discourse.vtk.org/user_avatar/discourse.vtk.org/berglte/32/9946_2.png) [@berglte](https://discourse.vtk.org/u/berglte)\
**Post date:** [April 28, 2025, 2:41pm UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/8 "2025-04-28T14:41:53Z")

</div>

Here’s a sample file

> **[sample.glb](https://drive.google.com/file/d/1ou7rSH1jmBk-_GyCZ293hbvxyW_mtJmb/view?usp=sharing)**
>
> Google Drive file.

I might reach out later. For now, I have a workaround, but I do need to get this working at some point.

---

<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:** [April 28, 2025, 2:48pm UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/9 "2025-04-28T14:48:41Z")

</div>

I confirm that textures is not working with this dataset.

F3D actually has an issue for this: [GLB texture from PNG only shown with --raytracing · Issue #242 · f3d-app/f3d · GitHub](https://github.com/f3d-app/f3d/issues/242)

We noticed that texture work in raytracing, so the problem must be in the rendering stack, not the IO stack.

---

<div class="post-metadata">

**Author:** ![gongwaner](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gongwaner/32/6996_2.png) [@gongwaner](https://discourse.vtk.org/u/gongwaner)\
**Post date:** [April 28, 2025, 2:57pm UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/10 "2025-04-28T14:57:24Z")

</div>

Hi,  
Unfortunately no. My workaround is to try different dataset and there are some data sets whose textures do load successfully.

---

<div class="post-metadata">

**Author:** ![berglte](https://discourse.vtk.org/user_avatar/discourse.vtk.org/berglte/32/9946_2.png) [@berglte](https://discourse.vtk.org/u/berglte)\
**Post date:** [April 29, 2025, 6:08am UTC](https://discourse.vtk.org/t/vtkgltfimporter-does-not-load-textures/14815/11 "2025-04-29T06:08:14Z")

</div>

Thank you both for confirming the issue and sharing it in the relevant F3D issue. I’ll keep an eye on the discussion to see if this gets resolved.
