I am in need of creating terrain using a single cube with dimensions of 1x1x1. The coordinates for this terrain are stored in a .txt file and consist of approximately 11 million triplets.
My current code is facing limitations as it can only render around 60k of these triplets before causing the browser tab to reset and prompting me to stop an unresponsive script. This issue is due to the excessive memory and time required to generate all the data points.
Below is a snippet of the code responsible for rendering the cubes:
function generateCubes(data) {
var cubeGeometry = new THREE.CubeGeometry(cubeSize, cubeSize, cubeSize);
var material = new THREE.MeshLambertMaterial({color: 0x587058});
var mesh = new THREE.Mesh(cubeGeometry, material);
var mergedGeo = new THREE.Geometry();
var instance;
var line = data[0].split(';');
var translateX = line[0], translateY = line[1], translateZ = line[2];
//var group = new THREE.Object3d();
for(var i = 0; i < 100000; i++) { // should go to data.length
line = data[i].split(';');
//instance = mesh.clone();
//instance.position.set(line[0] - translateX, line[2] - translateZ, line[1] - translateY);
//group.add(instance);
mesh.position.x = Number(line[0]) - translateX;
mesh.position.y = Math.round(Number(line[2]) - translateZ);
mesh.position.z = Number(line[1]) - translateY;
mesh.updateMatrix();
mergedGeo.merge(instance.geometry, instance.matrix);
}
group = new THREE.Mesh(mergedGeo, material);
scene.add(group);
}
This function is invoked upon successful completion of an $.ajax call.
The commented sections in the code suggest that without using merged geometry, I am able to render approximately 100k data points.
Any assistance on resolving this issue would be greatly appreciated.
UPDATE: I came across this question, but it did not provide much help in my case.