Sign in to follow this  
Dad72

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.

232053358_2018-09-1616_08_00-Greenshot.png.6eccbcb3f5be4b69a40176df334e872c.png

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

1739472021_2018-09-1616_08_39-Greenshot.png.ca55224e3d5ff9eadfa1bf561006cead.png

Share this post


Link to post
Share on other sites

@MarianG,

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 :

195972157_2018-09-1721_42_51-Greenshot.png.4e5c67abcb12db2d8370c85cb13986c2.png

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.

Share this post


Link to post
Share on other sites

In fact the fusion does not seem to take into account when there are several textures. Or I do not know how to do it.

When I merge an object having only one texture is perfect, but with two, it's not right.

Share this post


Link to post
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.

Share this post


Link to post
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. :(

http://playground.babylonjs.com/#1I4KHI#4

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.