Points
Quick answer
Points renders each vertex of a BufferGeometry as a screen-facing square or textured sprite, making it the direct way to display LiDAR point clouds, particles, and scatter data. It needs only a position attribute, with color optional, and a PointsMaterial to control size, map, and attenuation.
new THREE.Points ( geometry , material )
Key points
- Build a BufferGeometry with setAttribute('position', ...) and optionally a color attribute.
- sizeAttenuation true makes points shrink with distance; false keeps fixed pixel size.
- raycast() uses Raycaster.params.Points.threshold for hit detection.
Example
const positions = new Float32Array(points.length * 3);
const colors = new Float32Array(points.length * 3);
const color = new THREE.Color();
points.forEach(function (p, i) {
positions[i * 3] = p.x;
positions[i * 3 + 1] = p.y;
positions[i * 3 + 2] = p.z;
color.setHSL(0.6 - p.height * 0.002, 0.55, 0.55);
colors[i * 3] = color.r;
colors[i * 3 + 1] = color.g;
colors[i * 3 + 2] = color.b;
});
const geometry = new THREE.BufferGeometry();
geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const material = new THREE.PointsMaterial({
size: 2,
sizeAttenuation: false,
vertexColors: true,
transparent: true,
opacity: 0.85,
depthWrite: false
});
const cloud = new THREE.Points(geometry, material);
cloud.frustumCulled = false; // 包围盒尚未计算时避免整体被剔除
scene.add(cloud);
Notes
- Points cannot rotate or scale individually; use Sprite or instanced quads for oriented icons.
- Dense point clouds often need depthWrite false and alphaTest to sort correctly.
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Atlaslog (2026). Points. https://www.jingweizhi.com/en/three/api/points.html (accessed 2026-11-03).