Jump to content

Speed optimisation and Octree


Tyrahell
 Share

Recommended Posts

  • 5 months later...

I know I came in a bit late into this post but I hope I can be read. I have the exact same issue happening to my game right now: it lags horribly! I tried everything you guys posted from octrees, determining the PC hardware and even checking out the latest version of babylon.js but to no avail. Is there something else that I can do where I might fix my performance issue? Many thanks in advance!

Link to comment
Share on other sites

  • 1 year later...

Hi all, 

 

I am relatively new to Babylon.js, and try to display a very large amount of spheres (around 100 000). I already use instances to create each sphere, and while the display actually works, interacting with the scene is close to impossible. 

For this test  the camera is an ArcRotate one, but the actual code will use an UniversalCamera with controls with arrows and the mouse. Currently the engine can handle the mouse wheel input, but no longer the mousedown.

"Handling of 'mousewheel' input event was delayed for 455 ms due to main thread beinmethod g busy. Consider marking event handler as 'passive' to make the page more responive."

I put simple colored material on meshes to distinguish some features, but except for that, I do nothing special. Are there some solutions to reach this very high number of meshes (maybe switch to sprites facing the camera ?) or am I asking too much of Babylon.js ?

 

My code is fairly dense, but if it helps for understanding, I could produce a simpler version of it in a playground.

 

Any tip or method is most welcome :)

 

Cheers,

Kevin

Link to comment
Share on other sites

There is a tutorial on Octree:

http://doc.babylonjs.com/tutorials/Optimizing_Your_Scene_with_Octrees

and the source code of the demo:

http://www.babylonjs.com/Demos/Octree/octree.js

You just need this to create an octree on scene.

var octree = scene.createOrUpdateSelectionOctree();

If you create of objects on the fly, you must call this line again. If your scene is created in advance, simply call after the scene has been created completely.

 

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