# setting color and textures in vtkGLTFExporter

**URL:** <https://discourse.vtk.org/t/setting-color-and-textures-in-vtkgltfexporter/13954>\
**Category:** Development\
**Created:** [May 28, 2024, 6:37pm UTC](https://discourse.vtk.org/t/setting-color-and-textures-in-vtkgltfexporter/13954 "2024-05-28T18:37:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Scatena](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rafael_scatena/32/7820_2.png) [@Rafael\_Scatena](https://discourse.vtk.org/u/Rafael_Scatena)\
**Post date:** [May 28, 2024, 6:37pm UTC](https://discourse.vtk.org/t/setting-color-and-textures-in-vtkgltfexporter/13954/1 "2024-05-28T18:37:22Z")

</div>

Hello,

I have a triangle mesh with 2 scalar fields for each triangle. I would like to export the mesh to a gltf file. I was thinking in put the 2 scalar fields in the color or texture coordinates and then export with vtkGLTFExporter.

My mesh is already set and the vtkGLTFExporter is already working but I don’t know how to set the colors and textures for each triangle.

Thank you,

Rafael Scatena

PS: This is when I open the saved gltf file in another program:

![image](https://discourse.vtk.org/uploads/default/original/2X/4/4a2fdbf76e70799159aca7bf1f72a7280e672c4f.png)

---

<div class="post-metadata">

**Author:** ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)\
**Post date:** [May 28, 2024, 6:40pm UTC](https://discourse.vtk.org/t/setting-color-and-textures-in-vtkgltfexporter/13954/2 "2024-05-28T18:40:37Z")

</div>

The GLTF exporter does not automatically export scalar coloring. Can you share a sample dataset? It maybe possible to achieve the desired output.

---

<div class="post-metadata">

**Author:** ![Rafael\_Scatena](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rafael_scatena/32/7820_2.png) [@Rafael\_Scatena](https://discourse.vtk.org/u/Rafael_Scatena)\
**Post date:** [June 4, 2024, 5:41pm UTC](https://discourse.vtk.org/t/setting-color-and-textures-in-vtkgltfexporter/13954/3 "2024-06-04T17:41:08Z")

</div>

> **[mesh.obj](https://drive.google.com/file/d/1O55TtHD6eZRhiaoS8bf-4AJSHJG6dwGm/view?usp=drive_link)**
>
> Google Drive file.
