Despite having all the relevant data in the BufferGeometry object, I am facing an issue where the last bunch of points are not being rendered in the THREE.js viewer. This problem arises when using version 85 of the THREE.js library, as some points go missing. However, if I revert back to using version 67, all points display correctly.
In version 67, I utilized THREE.Float32Attribute and THREE.ParticleSystem, resulting in all points loading seamlessly.
On the other hand, in version 85, I switched to using THREE.Float32BufferAttribute and THREE.Points due to the deprecation of older functions. While there are no errors reported, a noticeable absence of points (specifically, a whole patch or area) is observed. Oddly enough, these missing points happen to be the last ones read from the LiDAR file, a discovery I made through LAStools lasview.exe, which loads points in sequential order.
I meticulously debugged the code to ensure correct value passing into the THREE.Float32BufferAttribute constructor and proper assignment to the array. Even while creating the THREE.Points constructor, all seemed well with the values passed. Given that THREE.ParticleSystem is now obsolete, I see no choice but to stick with THREE.Points.
var geometry = new THREE.BufferGeometry();
var data = [an array of data];
geometry.addAttribute('position', new THREE.Float32BufferAttribute((pointCount), 3));
geometry.getAttribute('position').array = new Float32Array(data);
geometry.computeBoundingSphere();
var shaderMaterial = new THREE.ShaderMaterial(...);
var particles = new THREE.Points(geometry, shaderMaterial);
particles.name = geometry.name;
this.scene.add(particles);
this.scene.needsUpdate = true;
No discernible errors were encountered. Works perfectly on version 67 but exhibits missing points on version 85.
The following is the functioning code snippet for version 67:
var geometry = new THREE.BufferGeometry();
var data = [an array of data];
geometry.addAttribute('position', new THREE.Float32Attribute((pointCount), 3)); // Using Float32Attribute instead of Float32BufferAttribute
geometry.getAttribute('position').array = new Float32Array(data);
geometry.computeBoundingSphere();
var shaderMaterial = new THREE.ShaderMaterial(...);
var particles = new THREE.ParticleSystem(geometry, shaderMaterial); // Using ParticleSystem instead of Points
particles.name = geometry.name;
this.scene.add(particles);
this.scene.needsUpdate = true;
I have provided screenshots: The first image demonstrates the issue using version 85 and the aforementioned code. The second image shows the same data successfully loaded in version 67 (disregard any differences in intensity color; focus lies on the missing patch on the right side, representing the final section of data in the BufferGeometry array)