Dad72 Posted September 16, 2018 Share Posted September 16, 2018 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. Quote Link to comment Share on other sites More sharing options...
MarianG Posted September 16, 2018 Share Posted September 16, 2018 Hi Dad72. I think you have to set a materialIndex foreach merged mesh. line41. Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 16, 2018 Author Share Posted September 16, 2018 Ok, I did not know that we had to use that. Thank you MarianG. I wonder if this can not be automated directly into the engine when the merge? Quote Link to comment Share on other sites More sharing options...
Guest Posted September 17, 2018 Share Posted September 17, 2018 Nope as this could be a unwanted option Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 17, 2018 Author Share Posted September 17, 2018 @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 : 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. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 17, 2018 Author Share Posted September 17, 2018 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. Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 18, 2018 Share Posted September 18, 2018 Would it be possible to repro what you are seeing a playground I can take a look at? Why is the merge required as apposed to creating a new mesh with the objects as children? Or is this for performance reasons? Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 18, 2018 Author Share Posted September 18, 2018 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. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 18, 2018 Author Share Posted September 18, 2018 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 Quote Link to comment Share on other sites More sharing options...
Guest Posted September 18, 2018 Share Posted September 18, 2018 "I have galérer to load the model" ==> I struggled to load the model Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 18, 2018 Author Share Posted September 18, 2018 Oops Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 19, 2018 Author Share Posted September 19, 2018 @trevordev, Hello, I do not know if you saw the PG that you asked me. I have the impression that the subMaterials are erased by mergers. Because each submeshes to create one took into account the first subMaterial, but not the second one. Can be a bug here ? http://playground.babylonjs.com/#1I4KHI#4 Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 19, 2018 Share Posted September 19, 2018 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? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 19, 2018 Author Share Posted September 19, 2018 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 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.