Dilshad Roshan Posted July 6, 2018 Share Posted July 6, 2018 While importing meshes designed in software like Autocad and Blender, I noticed that the color of a previously imported mesh is getting applied to many meshes that are later imported. Then I realized that that this is due to conflicting material IDs. Is there a way to modify material ID of an imported mesh or is there any other solution to this problem? Quote Link to comment Share on other sites More sharing options...
RaananW Posted July 6, 2018 Share Posted July 6, 2018 I guess the best would be to change the material ID before exporting. Is it a possibility? Quote Link to comment Share on other sites More sharing options...
Dilshad Roshan Posted July 6, 2018 Author Share Posted July 6, 2018 How can it be done? Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted July 6, 2018 Share Posted July 6, 2018 Just by modifying its name I suppose. Quote Link to comment Share on other sites More sharing options...
RaananW Posted July 6, 2018 Share Posted July 6, 2018 WOuld be my guess as well. before exporting, make sure your material has a unique id in the software you are exporting from Quote Link to comment Share on other sites More sharing options...
Dilshad Roshan Posted July 6, 2018 Author Share Posted July 6, 2018 My app has feature for users to upload 3D models. So it is not always me who create and export meshes. So what I need to know is if there is any programmatic way to avoid this conflict. Quote Link to comment Share on other sites More sharing options...
SvenFrankson Posted July 6, 2018 Share Posted July 6, 2018 I need something like this too (removing textures from imported material), the way we do it is $.json( { url: "model.babylon", success: (rawData) => { data.id = "newId"; data.mesh.material.id = "newId"; BABYLON.SceneLoader.ImportMesh( "", "data://" + JSON.stringify(rawData); scene, (meshes, particles, skeletons) => { // success callback } ) } } ) (It's pseudocode, the success callback in the first $.json call is likely to be much more complicated...) The idea is you first load the .babylon file as a Javascript object, so you may edit it easily. Once all changes are made, you serialize and re-inject it. (It would be better to be able to load a mesh from a Javascript object, but it requires some changes in Babylon code...) 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.