粒子 Particles
创建粒子的方式与网格Mesh是类似的,他需要:
- 几何体(BufferGeometry)
- 材质(PointsMaterial)
- 点Points实例(而不是网格Mesh)
创建第一个粒子
const particlesGeometry = new THREE.SphereBufferGeometry(1, 32, 32)
const particalesMaterial = new THREE.PointMaterial({
size: 0.02, // 粒子大小
sizeAttenuation: truetrue // 粒子衰减,远离相机变小,靠近相机放大
})
const particles = new THREE.Points(particlesGeometry, particlesMaterial)
scene.add(particles)