Visam Posted April 21, 2017 Share Posted April 21, 2017 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? Quote Link to comment Share on other sites More sharing options...
jeremybyington Posted April 22, 2017 Share Posted April 22, 2017 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. Quote Link to comment Share on other sites More sharing options...
Visam Posted April 22, 2017 Author Share Posted April 22, 2017 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.