# vtkGLTFReader unable to read data from .glb files

**URL:** <https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187>\
**Category:** Development\
**Tags:** python\
**Created:** [January 30, 2024, 9:36am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187 "2024-01-30T09:36:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sai\_Chaitanya\_Rodda](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sai_chaitanya_rodda/32/7139_2.png) [@Sai\_Chaitanya\_Rodda](https://discourse.vtk.org/u/Sai_Chaitanya_Rodda)\
**Post date:** [January 30, 2024, 9:36am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187/1 "2024-01-30T09:36:30Z")

</div>

Hello All,

I am using VTK 9.3.0 and have seen that vtkGLTFReader is unable to read “.glb” files. Altough it is able to read “.gltf” perfectly and this problem doesn’t occur in VTK 9.1.0. Please check my below code for the rendering pipeline and point me if any mistakes I have done.

```auto
import vtk

def render_gltf(input_filename):
    # Read PolyData
    reader = vtk.vtkGLTFReader()
    reader.SetFileName(input_filename)
    reader.Update()
    
    # Convert to polydata
    polydata = vtk.vtkCompositeDataGeometryFilter()
    polydata.SetInputConnection(reader.GetOutputPort())
    polydata.Update()
    
    # Create a mapper
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(polydata.GetOutputPort())
    
    # Create an actor
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    
    # Create a renderer
    renderer = vtk.vtkRenderer()
    renderer.SetBackground(0.1, 0.1, 0.1)
    
    # Create a render window
    render_window = vtk.vtkRenderWindow()
    render_window.SetWindowName("GLTF Example")
    render_window.SetSize(800, 600)
    render_window.AddRenderer(renderer)
    
    # Create a render window interactor
    render_window_interactor = vtk.vtkRenderWindowInteractor()
    render_window_interactor.SetRenderWindow(render_window)
    
    # Add the actor to the renderer
    renderer.AddActor(actor)
    
    # Set up camera and render
    renderer.ResetCamera()
    render_window.Render()
    
    # Start the rendering loop
    render_window_interactor.Start()

if __name__ == " __main__":
    input_file = r"path\to\glb" # Replace with the path to your input GLTF file

    render_gltf(input_file)

```

PS: This works with no problem if i read .gltf files in 9.3.0.

---

<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:** [January 30, 2024, 9:38am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187/2 "2024-01-30T09:38:01Z")

</div>

please share your .glb file

---

<div class="post-metadata">

**Author:** ![Sai\_Chaitanya\_Rodda](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sai_chaitanya_rodda/32/7139_2.png) [@Sai\_Chaitanya\_Rodda](https://discourse.vtk.org/u/Sai_Chaitanya_Rodda)\
**Post date:** [January 30, 2024, 10:14am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187/3 "2024-01-30T10:14:23Z")

</div>

[Archvis\_Empty.glb](https://discourse.vtk.org/uploads/short-url/s0cxXBJlTp5J7UkhghbFQ56PbOt.glb) (823.9 KB)  
Hi Mathieu,

Thanks for quick response! Here is the GLB file. and FYI this is produced using unreal engine by setting mesh quantization property to true. I suppose this mesh quantization property is the one that caused the issue?

---

<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:** [January 30, 2024, 10:17am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187/4 "2024-01-30T10:17:02Z")

</div>

I’m afraid you are using an extension that is not supported by VTK yet.

```auto
ERROR: In vtkGLTFDocumentLoaderInternals.cxx, line 1308
vtkGLTFDocumentLoader (0x5e9622fdff00): glTF extension KHR_mesh_quantization is required in this model, but not supported by this loader. Aborting

```

---

<div class="post-metadata">

**Author:** ![Sai\_Chaitanya\_Rodda](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sai_chaitanya_rodda/32/7139_2.png) [@Sai\_Chaitanya\_Rodda](https://discourse.vtk.org/u/Sai_Chaitanya_Rodda)\
**Post date:** [January 30, 2024, 10:25am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187/5 "2024-01-30T10:25:34Z")

</div>

I used to receive this as warning in 9.1.0 but I was able to render the glb file in the 9.1.0. Heres the pipeline I used in 9.1.0. It is same as the one above but it had vtkCleanPolyData too.

```mport

def render_gltf(input_filename):
    # Read PolyData
    reader = vtk.vtkGLTFReader()
    reader.SetFileName(input_filename)
    reader.Update()
    
    # Remove any duplicate points.
    cleanfilter = vtk.vtkCleanPolyData()
    cleanfilter.SetInputConnection(reader.GetOutputPort())
    cleanfilter.Update()
    
    # Convert to polydata
    polydata = vtk.vtkCompositeDataGeometryFilter()
    polydata.SetInputConnection(cleanfilter.GetOutputPort())
    polydata.Update()
    
    # Create a mapper
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(polydata.GetOutputPort())
    
    # Create an actor
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    
    # Create a renderer
    renderer = vtk.vtkRenderer()
    renderer.SetBackground(0.1, 0.1, 0.1)
    
    # Create a render window
    render_window = vtk.vtkRenderWindow()
    render_window.SetWindowName("GLTF Example")
    render_window.SetSize(800, 600)
    render_window.AddRenderer(renderer)
    
    # Create a render window interactor
    render_window_interactor = vtk.vtkRenderWindowInteractor()
    render_window_interactor.SetRenderWindow(render_window)
    
    # Add the actor to the renderer
    renderer.AddActor(actor)
    
    # Set up camera and render
    renderer.ResetCamera()
    render_window.Render()
    
    # Start the rendering loop
    render_window_interactor.Start()

if __name__ == " __main__":
    input_file = r"path\to\Archvis_Empty.glb"# Replace with the path to your input gltf file

    render_gltf(input_file)type or paste code here

```

---

<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:** [January 30, 2024, 10:27am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187/6 "2024-01-30T10:27:01Z")

</div>

> [@Sai\_Chaitanya\_Rodda](#):
>
> I used to receive this as warning in 9.1.0 but I was able to render the glb file in the 9.1.0. Heres the pipeline I used in 9.1.0.

That doesn’t make sense. This must have been with a different file.

---

<div class="post-metadata">

**Author:** ![Sai\_Chaitanya\_Rodda](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sai_chaitanya_rodda/32/7139_2.png) [@Sai\_Chaitanya\_Rodda](https://discourse.vtk.org/u/Sai_Chaitanya_Rodda)\
**Post date:** [January 30, 2024, 10:27am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187/7 "2024-01-30T10:27:38Z")

</div>

I can confirm that they are the same file. Can you try it once?

---

<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:** [January 30, 2024, 10:29am UTC](https://discourse.vtk.org/t/vtkgltfreader-unable-to-read-data-from-glb-files/13187/8 "2024-01-30T10:29:19Z")

</div>

I tried your file with VTK master and it fails as described above.

Maybe something changed in the error managements between 9.1.0 and 9.3.0 for gltf, but I doubt it.
