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

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

This is the model showing from the glb file .
image

The code :

 

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?

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


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…

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

how can i do that??

I am not sure which part is “that” :slight_smile:

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) to create the scene you have pasted before

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…


and the textures are not there I think that’s why the model is not showing

Want to share the playground URL?

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

react code model output

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.

this is the react js code

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

here is the link

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

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/ it is loading as expected and all the material and textures are present

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

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?

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…

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…

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 :slight_smile: :+1:

1 Like

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 ?