I have a data viz app that renders point clouds:
I am using PointsMaterial - which is flat shaded - and I use a texture to shape each point into a circular dot:
const materialConfig =
{
size: pointSize,
vertexColors: true,
map: new THREE.TextureLoader().load( "texture/dot.png" ),
sizeAttenuation: true,
alphaTest: 0.5,
transparent: true,
depthTest: true
};
this.material = new THREE.PointsMaterial( materialConfig )
this.material.side = THREE.DoubleSide
The geometry is a list of meshes. Each mesh - each cluster of points with a single color - is a vertex list and a color list:
this.meshList = trace
.map(({ xyz, rgb, color, drawUsage }) => {
const geometry = new THREE.BufferGeometry()
const positionAttribute = new THREE.Float32BufferAttribute(xyz, 3 )
geometry.setAttribute('position', positionAttribute)
const colorAttribute = new THREE.Float32BufferAttribute(rgb, 3)
// drawUsage = THREE.DynamicDrawUsage
colorAttribute.setUsage(drawUsage)
geometry.setAttribute('color', colorAttribute )
geometry.userData.color = color
const mesh = new THREE.Points( geometry, this.material )
return mesh
})
This is reasonable performant - I can render 500,000 points and still have decent frame rates.
Question: I now want to use an illumination model - phong, physically-based, etc. I am unclear on how to do this? Can it be done and still have the app be performant?
Thanks.