# Texture issue with GLTF importer

**URL:** https://discourse.vtk.org/t/texture-issue-with-gltf-importer/2101
**Category:** Support
**Created:** [November 18, 2019, 10:50am UTC](https://discourse.vtk.org/t/texture-issue-with-gltf-importer/2101 "2019-11-18T10:50:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pbrousson](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/ac91a4/32.png) [@pbrousson](https://discourse.vtk.org/u/pbrousson)
#### Post date: [November 18, 2019, 10:50am UTC](https://discourse.vtk.org/t/texture-issue-with-gltf-importer/2101/1 "2019-11-18T10:50:36Z")

</div>

Hello,

I need to import some 3D textured models made with Blender and duplicate them several times. I use the GLTF format. The vtkGLTFImporter works fine with one object (I can duplicate the imported actor) but I encounter strange behaviour as soon as I import 2 different objetcs. The textures are applied randomly (the 2 original imported actors are correct, but the duplicated ones get all the same texture, and this may change if the original actor get out of the cam view… - All geometry is correct).  
To duplicate an actor I use :  
NewActor = vtkActor::New();  
NewActor-\>SetMapper(ImportedActor-\>GetMapper());  
NewActor-\>SetTexture(ImportedActor-\>GetTexture());  
NewActor-\>SetPosition(somewhere…);  
renderer-\>AddActor(NewActor);

I’ve made a test doing the same with 2 cubes textured manually with 2 different textures. All works fine with the duplicated ones.

One difference i noticed is that “ImportedActor-\>GetTexture()” returns a NULL, but returns a valid pointer with the cube test.

What is the difference between the GLTF importer texturing method and a simple manual texturing?  
What is the proper way to duplicate a GLTF imported actor with his texture ?

Thanks.

---

<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 18, 2019, 12:10pm UTC](https://discourse.vtk.org/t/texture-issue-with-gltf-importer/2101/2 "2019-11-18T12:10:45Z")

</div>

@Adrien_Boucaud

---

<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: [November 18, 2019, 1:23pm UTC](https://discourse.vtk.org/t/texture-issue-with-gltf-importer/2101/3 "2019-11-18T13:23:06Z")

</div>

Hello @pbrousson,

As the glTF importer uses VTK’s physically-based rendering functionality, textures are set via the actor’s `vtkProperty` member (`SetBaseColorTexture()`, `SetORMTexture()`, etc…).  
Adding:  
`NewActor->SetProperty(ImportedActor->GetProperty());`  
To your code might fix the issue.

If you only need to use Phong interpolation with the base color texture, `ImportedActor->GetProperty()->GetTexture("BaseColor");` should return the correct texture.

To clarify, are you importing multiple meshes from a single glTF file, or two models from two separate glTF files ?

---

<div class="post-metadata">

### Author: ![pbrousson](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/ac91a4/32.png) [@pbrousson](https://discourse.vtk.org/u/pbrousson)
#### Post date: [November 18, 2019, 1:54pm UTC](https://discourse.vtk.org/t/texture-issue-with-gltf-importer/2101/4 "2019-11-18T13:54:18Z")

</div>

Hello Adrien,

It works now fine with the " `NewActor->SetProperty(ImportedActor->GetProperty());`"

Initially all meshes were in the same file. I tried to split it in 2 files with no success.

Thanks for your help.
