Nuxt2 @babylonjs transpile problem


We are having problems with integrating @babylonjs package in our nuxt2 project. When using the ES6 package and inspectors and transpile them, we have performance issues (even 5 times slower).

Have any ideas on how to fix this?


First thing which I would check - to make sure that you don’t render the same scene twice, with Babylon and with your framework.

5 times slower - the render loop?
Could you reproduce that? show us a demo project?

And Yes - I would first check what @labris said. How many times does the render loop run?

Just 1 render loop, no multiple instances or scenes.
This is the project

What do I need to do to notice the performance degredation?

oh, and i’ll take the penthouse please :slight_smile:

1 Like

We have the old project where we don’t use the tree shaking benefits of ES6. But you can see that the performance there where much better. Absolute FPS on the old project is somewhere around 700, and on the nuxt version we are having around 100-120.
Here is the old project:

From quickly looking at the callstack, it seems like pointermove / pick is triggered twice per frame, which could explain the performance reduction. It could have been a bug that was fixed already. I notced you are using the 5.X branch, have you tried using the latest 5?
Babylon is also backwards-compatible, so technically you should be able to move to the latest 6 without an issue

CC @PolygonalSun for the input. This is a single frame (of the es6 version):

I’ve tried on my local setup to strip everything to the bones and latest versions of babylon including 6.5. I ended up with only the initialisation of the scene, camera and loading of the model, and the issue persisted. So there isn’t a problem from the raycasting or other weird calls from the application.

1 Like

So, something that stands out to me as odd is that _internalPick is being called multiple times within the timespan of a single pick call. AFAIK, _internalPick should only ever be called once during pick or pickWithRay so I wonder what could be going on. I might have to dig in and see what’s going on.