Jump to content

Cloned model has no textures


AlexB
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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, 

Link to comment
Share on other sites

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.

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...