Jump to content

FbxExporter and materials


Visam
 Share

Recommended Posts

Hi

I have many FBX files. Each FBX file has unique material names.

FbxExporter.exe converts these files to babylon files. The FBX material names go to babylon materials.name

But many babylon files contain materials with id value "45" ("id": "45"). It seems that FbxExporter.exe generates these id somehow by itself.

This is the reason why loading many babylon files to one (same) scene shows incorrecet colors.

Are there any ways to fix it?

Link to comment
Share on other sites

I don't know if there is a parameter you need to pass or something further up the chain you can do, but I think theoretically you could loop through your materials in the BABYLON.SceneLoader.Append/ImportMesh/Load callback and  assign them new ids based on the loop's current index or something. Another thing you can do is edit the Babylon JSON directly, but the major disadvantage to that is you have to do that all over again next time you re-export from your FBX. But, if you are confident you have the final versions then it is better to have the data correct in the JSON.

Anyway, those are a couple hacky ideas....stay tuned for someone who knows the real answer you are looking for.

Link to comment
Share on other sites

21 hours ago, jeremybyington said:

I don't know if there is a parameter you need to pass or something further up the chain you can do, but I think theoretically you could loop through your materials in the BABYLON.SceneLoader.Append/ImportMesh/Load callback and  assign them new ids based on the loop's current index or something. Another thing you can do is edit the Babylon JSON directly, but the major disadvantage to that is you have to do that all over again next time you re-export from your FBX. But, if you are confident you have the final versions then it is better to have the data correct in the JSON.

Anyway, those are a couple hacky ideas....stay tuned for someone who knows the real answer you are looking for.

Hi

thank you. I fixed the problem by loading babylon file from a server (XMLHttpRequest) / JSON.parse / change material ids / JSON.stringify / ImportMesh.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...