Jump to content

Multiple Scenes Approach


freetoplay
 Share

Recommended Posts

Hi everyone, I have a question about the best approach to my problem. I am working on a project that requires multiple scenes on one HTML page. My current approach is to create a web component that contains a HTML canvas, an Babylon engine, and a reference to the current Babylon scene. Then I create a N number of those components on the web page. But I am not sure if this is the best approach, since each scene has their own engines and it seems fairly slow. So I am wondering what would be a better approach to my problem?

Link to comment
Share on other sites

11 hours ago, JohnK said:

A search on multiple scenes in the docs lead to http://doc.babylonjs.com/how_to/multi_scenes

Yep, I saw that, but do you know if there is an advantage of this approach of using one render loop over my current approach, where every scene has their own engine loop, would it speed up performance?

11 hours ago, dbawel said:

Do you use React/Redux? This makes life much easier - unless you have to learn the basics of these frameworks.

DB

Nope, I use Vue, but I can most likely translate React code to Vue code without too many changes.

Link to comment
Share on other sites

1 hour ago, freetoplay said:

Yep, I saw that, but do you know if there is an advantage of this approach of using one render loop over my current approach, where every scene has their own engine loop, would it speed up performance? 

Then there would be only one GL context.  Not sure about an effect to frame rate, but should be less resources. 

One other thing you might try is perhaps only actually render a scene, when the mouse is inside a canvas.  Kind of application specific, and would not work for scenes with animation.  There is only one mouse though, so could be a sneaky cheat for some.

Link to comment
Share on other sites

For scenes that have shared meshes another possibility is to have these in one scene, with (for want of a better term) multiple scenarios, on swapping scenarios from S1 to S2 use mesh.setEnabled(true) for meshes in S2 and mesh.setEnabled(false) for meshes in S1 but not in S2. Shared meshes will already be enabled.

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