Performance compared to for example unity native (not unity webgl)

Hi guys.

I have a project which I really want to do. It is NOT commercial at all :slight_smile:
I want to build a scene made out of lego-like bricks and then in VR (on oculus quest 2) I want to stand inside that scene.
Lego buildings tend to have a lot of bricks and things like the studs (the round knobs on top of them) also use a lot of geometry compared to simple boxes.
But… people can be clever and hide any geometry that is not visible. Or… instead of hide it, just don’t generate it at all.

In unity this is doable and gives really nice performance. But… babylon is on the web(gl) and using javascript. My scene can easily have a couple of million vertices, but the object will not be using a huge number of drawcalls since I will generate a lot of bricks in 1 and the same mesh (to reduce drawcalls, which you actually have to do in unity as well).

Are there tricks I could use to display a lof of polygons on for example a quest2 hardware ? Maybe there are ways to have less intensive shaders ? Things to avoid to optimise speed? All my blocks are static in the scene, so maybe there are tricks to be sure all this geometry is staying on the GPU?

Kind regards,
Bart

PS. Since this is a non-commercial project (and hey I’ll be using lego brick models, so there is NO way anything commercial could be done with these) I will probably be the only one to run these demo’s.

In unity you can also choose to run the app on your PC/GPU and then send them over via cable. I guess that that performance will be unbeatable when I would run babylonJS on the oculus quest 2 hardware ?

One thing that should help you when you have many objects with the same shape are instances. There’s a demo here showing thin instances of a cube. By changing the numPerSide you can ramp up the numer of objects easily. My machine can handle a million cubes without a problem.

You already had a good idea by reducing the draw calls. a couple of millions of vertices is not a big deal for Oculus Quest 2 as long as the number of drawcalls is minimal

Overall documentation about perf: Optimizing Your Scene | Babylon.js Documentation

@educa, I know this is super-late, but PirateJC made an amazing series on basically the same thing: Fun with Legos Part 1: Thin Instances - YouTube. You can take what you need from that code and simply enable WebXR for your project.

I’ll leave this here if you’re still interested in pursuing your project, or if someone else is searching for the same.

1 Like

Also intresting to see some benchmark with comparison of vr performance between babylon js and another native engine like unity our unreal.
Where is that point when I should switch from js frame work?

1 Like