mandim Posted January 24, 2018 Share Posted January 24, 2018 Hello, I'm having an issue when trying to import a blender model (i.e. .babylon). I have created a simple bottle in blender with multimaterials (3 colors) and export it to .babylon. Here is the snippet code: var bottleMeshTask = assetsManager.addMeshTask("BottleTask", "Bottle", "assets/Bottle/", "bottle.babylon"); bottleMeshTask.onSuccess = function (task) { console.log(task); bottle = BABYLON.Mesh.MergeMeshes(task.loadedMeshes, true, true, null); bottle.position.z = -150; bottle.position.y = 0; bottle.position.x = 10; bottle.rotation.z = Math.PI / 2.0; bottle.scaling = new BABYLON.Vector3(0.3, 0.3, 0.3); console.log(bottle); }; bottleMeshTask.onError = function (task, message, ex) { console.log(message, ex); } assetsManager.load(); The problem is that when I insert the asset using the addMeshTask(...) it only shows the top first material. Any ideas? bottle.babylon bottle.blend Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 24, 2018 Share Posted January 24, 2018 Seems like the multimaterial is defined ("multiMaterials":[{"name":"bottle.Multimaterial#0","id":"bottle.Multimaterial#0","materials":["bottle.White","bottle.Blue","bottle.Red"]}]) but it is missing a few parameters. What material is applied to the mesh? Quote Link to comment Share on other sites More sharing options...
mandim Posted January 24, 2018 Author Share Posted January 24, 2018 3 hours ago, RaananW said: Seems like the multimaterial is defined ("multiMaterials":[{"name":"bottle.Multimaterial#0","id":"bottle.Multimaterial#0","materials":["bottle.White","bottle.Blue","bottle.Red"]}]) but it is missing a few parameters. What material is applied to the mesh? Actually only the white material is being applied. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 24, 2018 Share Posted January 24, 2018 I checked the .babylon in the sandbox, and it loads fine from there. I see no problem in what Blender produces. Quote Link to comment Share on other sites More sharing options...
mandim Posted January 24, 2018 Author Share Posted January 24, 2018 3 hours ago, JCPalmer said: I checked the .babylon in the sandbox, and it loads fine from there. I see no problem in what Blender produces. I know that in sandbox its loading fine. That's why I created this topic. Is it possible to load the .babylon in the playground and how? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 24, 2018 Share Posted January 24, 2018 It is possible. You do have to post the .babylon on an addressable area of the web to get. You then use the code you have with the right url. Usually you have to make minor changes to fit within a createScene function. Quote Link to comment Share on other sites More sharing options...
babbleon Posted January 25, 2018 Share Posted January 25, 2018 This may be due to you merging the meshes. Try without merging the meshes and see if this solves your problem. brianzinn 1 Quote Link to comment Share on other sites More sharing options...
mandim Posted January 29, 2018 Author Share Posted January 29, 2018 On 25/1/2018 at 1:31 PM, babbleon said: This may be due to you merging the meshes. Try without merging the meshes and see if this solves your problem. Thanks for the notice. This resolved the issue. Many thanks... 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.