Jump to content

Question about instances


joli1400
 Share

Recommended Posts

Hi there babylon community, 

me and my fellow project members are working on a project for school and could use some help getting some answer for a couple of questions. We have tried researching and testing our way forward but frankly, we've hit a bit of a stop.

A little backstory: we are working together with a big company and their internal web application to show system hierarchy and dependencies. Our mission is to take this web application, currently running in 2D, and bring it into 3D. We are all computer scientist with little to no previous knowledge of 3D so it has been quite the learning experience but babylon has been a wonderful tool to work with to make this happend.

First of all, we are representing the different systems using meshes(spheres). This works well, however this is a big company with ALOT of different systems and the searches can return up to 10 000 different systems in one view. This means we have to draw 10 000 spheres connected with a couple of thousand lines. This causes lag! We started looking into performance optimization and stumbled across making instances of the spheres instead of creating new ones. In our test we could see a significant increase in FPS when doing so but we ran into another problem. The application we are developing has to be able to click and select the different spheres to display information about them and to interact with them. When we applied the instances on our application clicking one of the meshes selected all meshes of the same instance. The question here being is this the intended and expected behaviour or can we work around it somehow?

We tried cloning the meshes but the FPS increase was nowhere near the same as with instances.

Any other help on how to improve performance with something like this is much appriciated, sorry we can't provide you with a playground or something but hopefully the question makes sense!

Br,

Johan

Link to comment
Share on other sites

Maybe instead spheres (what look spheric wherever you look them from), you could use discs, particles or sprites, well 2D shapes. You should also investigate instances or SPS, what may render everyhting in one draw call instead of thousands

For the lines, you could use the LineSystem

The global idea here is to reduce the draw call number and managed vertex number.

Link to comment
Share on other sites

9 minutes ago, jerome said:

Maybe instead spheres (what look spheric wherever you look them from), you could use discs, particles or sprites, well 2D shapes. You should also investigate instances or SPS, what may render everyhting in one draw call instead of thousands

For the lines, you could use the LineSystem

The global idea here is to reduce the draw call number and managed vertex number.

Thanks for the reply!

We are definitely going to look into using LineSystem for the lines. We have already looked at instances but ran into the problem of the instanced meshes all acting like one and the same mesh. Maybe this isn't a thing in SPS? Gonna give SPS a go aswell!

Link to comment
Share on other sites

I'd like to bump this.

What I want to know is, if we instance all of the spheres, are they all concidered one and the same sphere when it comes to selecting them in the scene?

And if so, is there a way to work around it?

I've read somewhere that you can instance them all and then when you click, replace the one you hit with a "real sphere".

Link to comment
Share on other sites

Yes, that could work.

I'm assuming you're trying to modify the material of the selected sphere to highlight it. Another way is to make the selection highlighter a different mesh (an arrow or slightly larger sphere) and move that mesh to the selected sphere.

PS. if the spheres are not moving, use sphere.freezeWorldMatrix() on all of them for free performance increase :) edit: since it's up to 10k, SPS might give even better performance. But then you'll need imposters for selection I believe.

Link to comment
Share on other sites

easiest thing what you can to is to make a user interaction where not everything is visible. lower camara.maxZ>fps.. click next->to show more data etc.

http://playground.babylonjs.com/#M8580#5

(this is an old playground i make, i want to safe it, becorse the images for the tv where hosted on host://google drive, and has quite service, and at the same time i had answered a question proud of myself) 

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