Jump to content

Merge mesh and multimaterial


Recommended Posts

I found run bug when we merge two objects that are a multimaterial.

The object is well merged. Once I serialize it to record it and reload my scene. Some of the textures are missing.

On the first image, these are my two objects that I want to merge. There is a metal ring around.


But once merge, and serialize the object merge, the metal has disappeared.


Link to comment
Share on other sites


No, it did not work. this solution took the iron texture on the first model and texture 2 on the second model.

Why does not this merge correctly?

Compare with the first image of the barrel :


In your PG example, each model has its textures or colors.

In my case the barrel each model has 2 textures, but the gold of the fusion I lose the second textures.

Link to comment
Share on other sites

It's not necessary. It is to offer this possibility to the users of my editor.

My editor is for creating MMORPGs. Performance is therefore important for future users. I would like him to be able to merge objects if he wishes, just like the possibilities to create instances of objects, of group (parent/children) and many other useful things.

It's not for my own needs, but I'm sure it will be useful to my editor.

I will try to make a PG. Thanks for your help.

Link to comment
Share on other sites

I made you a PG here.  I struggled to load the model, the playground does not want more external file. So I used 'data:' and same thing I could not load the textures remotely. So I took texture from the playground.

Before, I could load remote models with http instead of https, but now it will be difficult to make PGs with our own model if it works more. :(


Link to comment
Share on other sites

Thanks for the PG,

from the implementation of mergeMeshes it doesnt look like merging meshes the way you expect is supported right now.

Created github issue to track this: https://github.com/BabylonJS/Babylon.js/issues/5197

In your playground you are merging 2 barrels that have the same material on both of them, is merging 2 different objects with different materials also a scenario to you?

Link to comment
Share on other sites

When I test with two different objects, I have the same problem, it is the first sub-material that is taken into account on all the merge objects.

This only works if the object has only one texture, but not several sub-material.

Thank you Trevor

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...