AlexB Posted August 7, 2014 Share Posted August 7, 2014 I have a complex model with lots of submeshes and each submesh has a different texture file attached to it. When I clone the model, the materials seem to be set on the clone, but none of them show up. The new model just looks pink all over. Is there a way to force Babylon to simply re-apply the textures? Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 7, 2014 Share Posted August 7, 2014 Hello Alex, Do you have a demo hosted somewhere that I can use to debug ? I tried to clone a simple mesh with a multi material with texture here : http://www.babylonjs.com/playground/#12GUNF and everythink is fine. Thanks Cheers, Quote Link to comment Share on other sites More sharing options...
AlexB Posted August 7, 2014 Author Share Posted August 7, 2014 Is it possible to discuss offline? The model is under an NDA. Quote Link to comment Share on other sites More sharing options...
AlexB Posted August 7, 2014 Author Share Posted August 7, 2014 Also, I've broken out the part of the model I want to update with new textures and I'm loading only that mesh. Once the mesh is loaded, I'm cloning it and no texture shows up. I'm attempting to set the texture explicitly on the clone using: (<BABYLON.StandardMaterial>obj.material).diffuseTexture=new BABYLON.Texture("models/car/body_texture.jpg", this.options.scene); //This project is using TypeScript And the cloned model will never display any textures. Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 7, 2014 Share Posted August 7, 2014 It is indeed possible to discuss it offline, send me a PM with your test scene and I will try to help you. Your scene should work, it is exactly what I'm doing in one of my tutorial (import a mesh and cloning him).Maybe your texture is not found ? Do you have any error message in the browser console ? Anyway, send me a pm with your test scene, it will be quicker Cheers, Quote Link to comment Share on other sites More sharing options...
AlexB Posted August 7, 2014 Author Share Posted August 7, 2014 Thanks to Temechon, I was able to get the model working. For future reference, the code looks like this:BABYLON.SceneLoader.ImportMesh("car", "assets/", "car.babylon", scene, function(newmeshes) {var car = scene.getMeshByName("car");var car1 = scene.getMeshByName("car1");car1.dispose();// car.isVisible = false;var newCar = car.clone();newCar.position.y = 5;newCar.isVisible = true;});What seems to have been causing me problems is taking a mesh in Blender and grouping together into a single object. This creates a multi-material in Babylon, as well as a strange orphan "car1" object and was also causing normals to be reversed in strange ways. In general, it was causing all sorts of problems. We backed out of that setup and now the model is importing correctly. 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.