How to save point cloud data and view it

Hello,

Recently, I’ve been studying point cloud development. As a beginner in this field, I’m seeking some guidance on how to approach this. I want to obtain point cloud data and be able to display and view it as shown in the picture below. I used the "Displaying a Point Cloud Using Scene Depth" code as my starting point and then attempted to add a button to save the data in the Renderer private variable particlesBuffer: MetalBuffer<ParticleUniforms>. The particlesBuffer array contains data structured as follows:

struct ParticleUniforms {
    simd_float3 position;
    simd_float3 color;
    float confidence;
};

My understanding is that this data represents the point cloud. If I am wrong, please let me know. Next, I wrote my own code to display this data using SceneKit by creating small spheres based on the position and color values. However, in practice, this method only allows me to display about 30,000 spheres before it becomes very laggy. I believe my implementation might be incorrect because I noticed that using the 3D scanner App to display point clouds achieves a much better performance.

Could you please advise me on how to achieve an effect like the one shown in the image below? Thank you.

How to save point cloud data and view it
 
 
Q