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:
//LOADING AN ENVIRONMENTAL TREE SITUATION
BABYLON.SceneLoader.Append(
"",
"https://cdn.glitch.com/6887aae9-a0f6-4d7c-95b5-6736d1ee7c6a%2Fmap_d9ec16cc-067f-4d8a-b9fe-0fc9f3f0d2b1_densified_mesh_textured.obj?v=1594250333408",
scene,
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
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
2 Likes
awesome; didn’t see that before, thank you!
1 Like