Coloring the individual points in a point cloud
When you create a point cloud, every point has the same color and style, as every point uses the same THREE.PointCloudMaterial
object. There is, however, a way to add color to the individual points.
Getting ready
There is no need for any additional steps to run this recipe. We'll create a custom geometry, just like we did in the Creating a point cloud from scratch recipe, and this time, we color each individual point. The result of this recipe can be seen by opening 06.03-color-individual-points-in-point-system.html
in your browser. You will see something similar to the following screenshot:
As you can see, we've colored the individual points in various shades of red.
How to do it...
To accomplish individual colored points, we need to set one additional property when we create THREE.Geometry
. The following steps show you how to do this:
We start by creating the geometry. When we create the individual vertices, we can also inform Three.js about the...