# My model is not exporting every or whole material into the glb file

**URL:** <https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186>\
**Category:** Questions\
**Tags:** material, glb, babylon, react-babylonjs\
**Created:** [June 10, 2024, 7:37am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186 "2024-06-10T07:37:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 7:37am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/1 "2024-06-10T07:37:06Z")

</div>

I am working on a react project with babylon for 3D models I have a model that I have to store in a glb file but when the file is downloading and I am opening the file in the babylon playground the it is not containing all parts of the model .

This is the model that I want to store in glb file

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/1/c10298c88b811697256ef758c9ea2fae70454eb8.png)

This is the model showing from the glb file .  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/7/77d17c218397e5a931ca1b012da211796975c5f9.png)

The code :

```javascript
 

```

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 9:18am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/2 "2024-06-10T09:18:11Z")

</div>

CC @bghgary (might take a little time, please be patient).

Are you sure all materials are available when you export the GLB? would you be able to reproduce that in the playground?

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 9:21am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/3 "2024-06-10T09:21:58Z")

</div>

yes i think all materials are available before export .And I will not be able to do that in the playground because the data is coming from the outside …  
But I did some settings change in the babylon playground the model is showing but the texture and colors are not showing

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/f/3f5bdd07096b6ce8b12e1660a2d789b17475a087.jpeg)  
I changes the active materials to default of the nodes so after that this is showing

I am new in this so can’t figure out what is the problem…

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 9:25am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/4 "2024-06-10T09:25:16Z")

</div>

You can use external assets in the playground, they just need to be available publicly and served somewhere. That will be a great help.

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 9:26am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/5 "2024-06-10T09:26:06Z")

</div>

how can i do that??

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 9:27am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/6 "2024-06-10T09:27:24Z")

</div>

I am not sure which part is “that” 🙂

You have a model. You can host it somewhere, making sure this server allows CORS so that you can access it from a frontend/js environment. Then you just need to use the playground ([playground.babylonjs.com](http://playground.babylonjs.com)) to create the scene you have pasted before

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 10:26am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/7 "2024-06-10T10:26:14Z")

</div>

i created the playground the  
this is the code

this is creating the file and the model is showing fine in the playground but when i try the same in react js the same problem is happening…

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/a/0ae50ae8ef85f2ea879b089a59322960d2df4999.jpeg)  
and the textures are not there I think that’s why the model is not showing

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 10:36am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/8 "2024-06-10T10:36:14Z")

</div>

Want to share the playground URL?

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 10:50am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/9 "2024-06-10T10:50:31Z")

</div>

sorry will not be able to share the url because can’t share the model url but the code is working in the playground I have checked it all the textures are storing in the file .

But with the react js code the textures is not there in glb file…

PlayGround

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/a/da2118aaaa0b4ec13585cf151f2e8b3043fe17ef.jpeg)

react code model output

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/b/3bff2bc5df8b2b4b1a0d6c32e01a76ddfd382c0f.jpeg)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 10:52am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/10 "2024-06-10T10:52:03Z")

</div>

Then it is somewhere in your code, and I assume the materials or textures are not available. But it is impossible to know without seeing the code.

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 10:53am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/11 "2024-06-10T10:53:24Z")

</div>

this is the react js code

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 11:09am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/12 "2024-06-10T11:09:13Z")

</div>

My dear friend, pasting code again will not really help us here. We need a reproduction.

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 11:31am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/13 "2024-06-10T11:31:50Z")

</div>

here is the link

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

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 11:34am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/14 "2024-06-10T11:34:44Z")

</div>

I thought you said the playground is working? Or is it not working as expected?

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 11:39am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/15 "2024-06-10T11:39:44Z")

</div>

No I said that the code in the playground is working and the glb file is downloading as expected and when i try to load the glb file in this [https://sandbox.babylonjs.com/](https://sandbox.babylonjs.com/) it is loading as expected and all the material and textures are present

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/f/9f5f9759d8b48f8caa9fcc60773ebf41ace20fd9.jpeg)

But when I am downloading the file from my react js code the textures are not present when I open the glb file in sandbox

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/f/dfa05067b6ee19c79ee84c9b10651f2b072d9fef.jpeg)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 11:41am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/16 "2024-06-10T11:41:17Z")

</div>

> [@ansh21222](#):
>
> No I said that the code in the playground is working and the glb file is downloading as expected and when i try to load the glb file in this [https://sandbox.babylonjs.com/](https://sandbox.babylonjs.com/) it is loading as expected and all the material and textures are present

So the playground is working…

Put yourself in my position please - you say that if you download the model from the link you have sent me it is working, but if you do it with your local code it isn’t. How can i possibly help?

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 10, 2024, 11:44am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/17 "2024-06-10T11:44:33Z")

</div>

because the code that is have is in react js and the logic and structure of the code is different (I have provided the react js code above) but for the playground i have used a different structure because the code that i have in react will not work in the playGround so that’s why i have to change it to support the playground environment…

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 10, 2024, 1:39pm UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/18 "2024-06-10T13:39:33Z")

</div>

I totally get that, really. And believe me, all we want here is to help. But how can we help?.. You provide a code snippet without too much context. That’s not the best way to get us the information. I can read the code, I can assume what is wrong with it (as I have already), and that’s about it…

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 11, 2024, 5:16am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/19 "2024-06-11T05:16:49Z")

</div>

Yes I understand your point , I know my explanation is not clear and is little bit vague that’s why I am not able to relay my problem correctly .But thank you for your patience and help…  
From this conversation and from your suggestions I have figured out little bit what is the bug in my code is and will work on it …

Once again thank you for your help 🙂 👍

---

<div class="post-metadata">

**Author:** ![ansh21222](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ansh21222/32/33789_2.png) [@ansh21222](https://forum.babylonjs.com/u/ansh21222)\
**Post date:** [June 11, 2024, 10:31am UTC](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186/20 "2024-06-11T10:31:12Z")

</div>

hey I just figured out the bug there is a function loadtexture

when i am commenting this then the glb is exporting correctly with all the texture but when this function is calling then the glb is not having textures

So , if you can tell me what could be the issue ?

[Next page](https://forum.babylonjs.com/t/my-model-is-not-exporting-every-or-whole-material-into-the-glb-file/51186.md?page=2)
