# Is it possible to export a mesh with mixmaterial using the GTLF exporter?

**URL:** <https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795>\
**Category:** Questions\
**Created:** [March 15, 2024, 6:03am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795 "2024-03-15T06:03:22Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [March 15, 2024, 6:03am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/1 "2024-03-15T06:03:22Z")

</div>

Hi all  
Is there a way to export meshes with mix material textures using gltf exporter? I see that my exported meshes lose the materials  
If it is not supported, isn’t there any workaround like convert mixmaterial to standard or multimaterial?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 15, 2024, 4:05pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/2 "2024-03-15T16:05:50Z")

</div>

Unfortunately no. The mixmaterial is not a material supported by glTF (so far the format only supports PBR but there are discussions to integrate something more flexible in the future)

The only workaround I could think of would be to manually mix the textures into a merged texture and use that texture in a std mat

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [March 16, 2024, 1:47am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/3 "2024-03-16T01:47:46Z")

</div>

Could you help me to transform mix material to std material during export and turn it back to mixmaterial after export  
Here is the pg: [https://playground.babylonjs.com/#2C2E5W#6](https://playground.babylonjs.com/#2C2E5W#6)  
What is the way to save the texture and use it as diffuse texture of the standard material?

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [March 19, 2024, 9:14am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/4 "2024-03-19T09:14:05Z")

</div>

I guess that I came close to a solution, but I still need to find out what I am missing: [https://playground.babylonjs.com/#2C2E5W#13](https://playground.babylonjs.com/#2C2E5W#13)

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [March 21, 2024, 4:34am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/5 "2024-03-21T04:34:40Z")

</div>

Or maybe there might be a simpler way. Isn’t in there a function in Babylonjs that grabs all the textures and combine it into one considering the transparency generated by the rgb colors of the mixtexture?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 21, 2024, 2:58pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/6 "2024-03-21T14:58:44Z")

</div>

You can use NME to generate a procedural texture based of the merge of your textures:  
[Node Material Procedural Textures | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/features/featuresDeepDive/materials/node_material/NMEProceduralTexture)

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [March 22, 2024, 2:56am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/7 "2024-03-22T02:56:47Z")

</div>

Thank you so much for your help. Now I have a better way to achieve this. I am getting acquainted with the babylonjs node material through your videos. I am trying to find a block that filters and combine textures based on the rgb of the texture5. Would you mind if you help with the creation of this node?

> **[Babylon.js Node Material Editor](https://nodematerial-editor.babylonjs.com/#8S31PS%232)**
>
> Babylon.js Node material editor - shader-based materials editor for Babylon.js

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [March 22, 2024, 6:07am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/8 "2024-03-22T06:07:45Z")

</div>

I could make it with this node: [https://nme.babylonjs.com/#12YPTW#79](https://nme.babylonjs.com/#12YPTW#79)  
But I’m not able to convert it to procedural texture in this pg: [https://playground.babylonjs.com/#8S19ZC#62](https://playground.babylonjs.com/#8S19ZC#62)  
Do you know the cause?

---

<div class="post-metadata">

**Author:** ![yamaciller](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yamaciller/32/21810_2.png) [@yamaciller](https://forum.babylonjs.com/u/yamaciller)\
**Post date:** [March 22, 2024, 1:34pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/9 "2024-03-22T13:34:11Z")

</div>

shouldnt that be Procedural?  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/1/a170f8778bce9fd782fc605667bec22fd67b43e7.png)

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [March 22, 2024, 2:42pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/10 "2024-03-22T14:42:27Z")

</div>

Thank you  
I think that is the problem but when I changed to procedural, I realize some parameters are changed. How to achieve the same results in the material mode?

---

<div class="post-metadata">

**Author:** ![yamaciller](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yamaciller/32/21810_2.png) [@yamaciller](https://forum.babylonjs.com/u/yamaciller)\
**Post date:** [March 22, 2024, 2:47pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/11 "2024-03-22T14:47:04Z")

</div>

tbh. I dont know, I never used that, but I saw that in the video 😉

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 22, 2024, 4:06pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/12 "2024-03-22T16:06:31Z")

</div>

You have to switch to procedural first and THEN you can build exactly the same fragment shader.

Should be exactly the same (but yes you need to start from a procedural setup)

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [March 23, 2024, 4:58am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/13 "2024-03-23T04:58:33Z")

</div>

Thank you all for the support: Here are the PGs that can be helpful to others.

Material node: [https://nme.babylonjs.com/#12YPTW#82](https://nme.babylonjs.com/#12YPTW#82)

Procedural node: [https://nme.babylonjs.com/#A7A3UB#17](https://nme.babylonjs.com/#A7A3UB#17)

> **[Babylon.js Playground](https://playground.babylonjs.com/#8S19ZC%2363)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [March 23, 2024, 9:17am UTC](https://forum.babylonjs.com/t/is-it-possible-to-export-a-mesh-with-mixmaterial-using-the-gtlf-exporter/48795/14 "2024-03-23T09:17:28Z")

</div>

Thanks for sharing 🙂

Here is an addon if you want to bake the ProceduralTexture (-1 draw call): [https://playground.babylonjs.com/#8S19ZC#64](https://playground.babylonjs.com/#8S19ZC#64)
