Jump to content

Can you merge instances?


chicagobob123
 Share

Recommended Posts

I read this  thread

and looked at this example. 

https://www.babylonjs-playground.com/#2EGQ6C#1

I am getting what styxxx explained. The browser is blowing up. 

What I am doing is looks like this 

                 l1, l2 and l3 are arrays of instanced meshes. 

                var newsidenumbers;

                var sidenumberarray =[];

                   ml1=BABYLON.Mesh.MergeMeshes(l1);       
                   ml2=BABYLON.Mesh.MergeMeshes(l2);
                   ml3=BABYLON.Mesh.MergeMeshes(l3);
                   newsidenumbers=BABYLON.Mesh.MergeMeshes([ml1,ml2,ml3]);
                   newsidenumbers.makeGeometryUnique();
                   sidenumberarray.push(newsidenumbers); // column and numbers 1,2,3
                   l1 = l2 = l3 = ml1 = ml2 = ml3 = null;

Later I want to do this. newsidenumbers=BABYLON.Mesh.MergeMeshes(sidenumberarray);

and instance it. Basically make one and repurpose for performance. 

 

 

Link to comment
Share on other sites

Hi CB!  http://www.html5gamedevs.com/search/?&q=merge instances&type=forums_topic&nodes=16,28,29,30,31

According to the 4th post (Dad72) and 6th post (Deltakosh)... instances cannot be merged.  Sorry.

I'm not real knowledgeable as-to WHY... but... I believe it is because instances carry no geometry data of their own.  They must reference their master's geometry.

Instances are lightweight because of this feature.  Party on. 

Link to comment
Share on other sites

Always love an answer.  While I waited I determined to do more optimizations. I cloned some base objects made them unique and then instanced that which worked very well. The performance was great and load time improvement was about 500%.  Went from 40 some seconds down to ~7 seconds. So it was worth the redo. 

What I work on is so dry and uninteresting but it does push the boundaries of things. :D 

And here for me its Friday/Payday and Saint Pats weekend. So the Party is ON 

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