# GLFTImporter example added to VTKExamples

**URL:** https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356
**Category:** Development
**Created:** [July 16, 2019, 7:38pm UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356 "2019-07-16T19:38:53Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [July 16, 2019, 7:38pm UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356/1 "2019-07-16T19:38:53Z")

</div>

Folks,

I’ve added a new example, [GLFTImporter](https://lorensen.github.io/VTKExamples/site/Cxx/IO/GLTFImporter/) to the [VTK Examples Project](https://lorensen.github.io/VTKExamples/site/). [glTF](https://en.wikipedia.org/wiki/GlTF) (derivative short form of GL Transmission Format) is a file format for 3D scenes and models using the JSON standard.

There are a few issues with this importer.

1. Images are dark. There is no light extension loaded
2. If run from the command line, the gltf filename must be a full path. Otherwise the .bin file is not found. I’m working on an MR for this.
3. Some error and warning messages do not include the bad filename.

I’ve attached a few results.

 ![FlightHelmet](https://discourse.vtk.org/uploads/default/original/1X/f4c8efd3ddbe0ba34817ceecabf02fb30f77f237.jpeg)  
 ![Corset](https://discourse.vtk.org/uploads/default/original/1X/41550c710e0552f82019ad1b14c0f453046e2c84.jpeg)  
 ![LittlestTokyo](https://discourse.vtk.org/uploads/default/original/1X/5b805516e74b6c715ef4e12a0d940c64b3e71886.jpeg)

---

<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: [July 17, 2019, 8:03am UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356/2 "2019-07-17T08:03:10Z")

</div>

Thanks @lorensen !

Can you share your MR ?

@Adrien_Boucaud @Michael

---

<div class="post-metadata">

### Author: ![Adrien\_Boucaud](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adrien_boucaud/32/413_2.png) [@Adrien\_Boucaud](https://discourse.vtk.org/u/Adrien_Boucaud)
#### Post date: [July 17, 2019, 8:20am UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356/3 "2019-07-17T08:20:16Z")

</div>

@lorensen thank you for doing this !

However, I do not seem to have any issues using relative file paths. Could you provide more information on how to reproduce this bug ?

---

<div class="post-metadata">

### Author: ![Michael](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michael/32/16_2.png) [@Michael](https://discourse.vtk.org/u/Michael)
#### Post date: [July 17, 2019, 8:30am UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356/4 "2019-07-17T08:30:01Z")

</div>

Thank you @lorensen !  
Indeed the images are dark but you can improve this using an environment lighting.  
You can make any skybox contribute to lighting and this brings awesome reflections with glossy materials.  
Have a look at [this test](https://gitlab.kitware.com/vtk/vtk/blob/master/Rendering/OpenGL2/Testing/Cxx/TestPBRMaterials.cxx).  
You can also use projected texture for the environment (that you can download [here](https://hdrihaven.com) for example). See [here](https://gitlab.kitware.com/vtk/vtk/blob/master/Rendering/OpenGL2/Testing/Cxx/TestEquirectangularToCubemap.cxx) for the test.

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [July 17, 2019, 2:31pm UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356/5 "2019-07-17T14:31:18Z")

</div>

This problem exists for .gltf files that reference .bin file. .glb files are fine. The tests use .glb files or .gltf file that do not reference .bin files.

Can you share a command line that works for you and verify that you are using .gltf files that reference a .bin file?

Bill

---

<div class="post-metadata">

### Author: ![Adrien\_Boucaud](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adrien_boucaud/32/413_2.png) [@Adrien\_Boucaud](https://discourse.vtk.org/u/Adrien_Boucaud)
#### Post date: [July 17, 2019, 2:36pm UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356/6 "2019-07-17T14:36:55Z")

</div>

Well, using the example code and the FlightHelmet model:

```
./import FlighHelmet.gltf

```

Works perfectly.

Are you building with VTK master ?

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [July 17, 2019, 3:58pm UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356/7 "2019-07-17T15:58:34Z")

</div>

That is not a relative path. Move away from the directory that contans FlightHelmet and use … relative path.

Yes, I use the master.

Here is what fails for me using the GLTFImporter example:

> cd VTKExampes/build  
> ./bin/GLTFImporter …/src/Testing/Data/glTF/FlightHelmet/gltf/FlightHelmet.gltf

fails to find the _.bin_ file, while

> cd VTKExamples  
> ./build/bin/GLTFImporter src/Testing/Data/glTF/FlightHelmet/glTF/FlightHelmet.gltf

works.

Try a similar experiment with your example.

Bill

---

<div class="post-metadata">

### Author: ![Adrien\_Boucaud](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adrien_boucaud/32/413_2.png) [@Adrien\_Boucaud](https://discourse.vtk.org/u/Adrien_Boucaud)
#### Post date: [July 18, 2019, 8:29am UTC](https://discourse.vtk.org/t/glftimporter-example-added-to-vtkexamples/1356/8 "2019-07-18T08:29:34Z")

</div>

After trying your example, there is definitely an issue. I misunderstood what you meant.

I pushed a fix for it at [https://gitlab.kitware.com/vtk/vtk/merge\_requests/5761](https://gitlab.kitware.com/vtk/vtk/merge_requests/5761)

Thank you for spotting this !
