VR optimization for dummies

Hey Everyone,

I’ve got a pretty cool VR experience going! Way pumped!

I uploaded an obj scan/mesh of a tree. I threw it in a for loop and created a forest.

But! It runs really slow on the quest.

I know ~nothing~ about optimization.

Do y’all have advice about where to start to learn?

also, if specifics are helpful, I did this:

      function(scene) {
        //var firstTree = meshes[0];
        var test = new BABYLON.StandardMaterial("texture", scene);
        test.diffuseColor = new BABYLON.Color3(1, 0, 0); //Red
        test.alpha = 0.3;
        scene.meshes[6].material = test;
        //from tree to forest
        for (var i = 0; i < 100; i++) {
          const flips = [-1, 1];
          function randomFlip(flips) {
            return flips[Math.floor(Math.random() * flips.length)];
          var randomX = Math.random() * 500 * randomFlip(flips);
          var randomZ = Math.random() * 500 * randomFlip(flips);
          var newTree = scene.meshes[6].clone();
          newTree.material = test;
          newTree.translate(BABYLON.Axis.X, randomX, BABYLON.Space.WORLD);
          newTree.translate(BABYLON.Axis.Z, randomZ, BABYLON.Space.WORLD);

done some tests and what I’m seeing is
-runs smoother in non vr
-runs most smoothly when I don’t change the camera position in non vr

reading this WebXR performance guide - Web APIs | MDN

my field of view is infinite, so… gotta be chiller on that front

everything regarding perf here still apply for VR: Optimize your scene - Babylon.js Documentation


awesome; didn’t see that before, thank you!

1 Like