I'm generating 3 plane that around about 400x300 in dimensions, and now I need to subdivide them to do some vertex shader manipulation.
My planes generate almost instantaneously (thanks to buffered geometry), now the issue is that with the subdivision, it drops my frame rate really low. I'm guessing that this has to do my my raycaster, which is called in the render loop and raycasts along the mouse position.
My question is, are there some optimizations I can do to fix the performance drop?
Here is how I'm generating my meshs:
function GeneratePlaneLayer(y) {
var floorTexture = new THREE.ImageUtils.loadTexture('path/to/image');
floorTexture.magFilter = THREE.NearestFilter;
floorTexture.minFilter = THREE.NearestFilter;
floorTexture.wrapS = floorTexture.wrapT = THREE.ClampToEdgeWrapping;
floorTexture.repeat.set(1, 1);
var floorMaterial = new THREE.MeshBasicMaterial({
map: floorTexture,
side: THREE.DoubleSide,
transparent: true
});
var geometry = new THREE.PlaneBufferGeometry(400, 300, 400, 300);
var floor = new THREE.Mesh(geometry, floorMaterial);
floor.rotation.x = -(Math.PI / 2);
floor.position.x = maxs['ROW'] / 2;
floor.position.z = maxs['COL'] / 2;
floor.position.y = y;
return floor;
}
EDIT:
I'm trying to use an octree, but it says THREE.Octree doesn't exist. I also can't find it in the docs, is it only in a dev release?