Skip to content

PointCloud3DRenderer

Massively parallel renderer for high-density 3D points.

Constructor

typescript
const renderer = new PointCloud3DRenderer(options: PointCloud3DRendererOptions);

Options

PropertyTypeDefaultDescription
canvasHTMLCanvasElementRequiredThe target canvas element.
globalPointSizenumber1.0Base size of all points in pixels.
circularbooleantrueIf true, renders points as smooth circles.
opacitynumber1.0Global transparency.

Methods

setData(data: PointCloudData): void

Uploads point coordinates and attributes to the GPU. Supports millions of points.

updatePointSize(size: number): void

Dynamically changes the particle size.

Interfaces

PointCloudData

typescript
interface PointCloudData {
  positions: Float32Array; // Flattened [x, y, z]
  colors?: Float32Array;    // Flattened [r, g, b] or [r, g, b, a]
  sizes?: Float32Array;     // Per-point scaling factor
}

Performance Note

Optimized for Zero Latency interaction. It includes a custom shader that performs depth attenuation (points appear smaller when farther away) to enhance the sense of perspective.

Released under the MIT License.