-
Book Overview & Buying
-
Table Of Contents
Learn Three.js - Fourth Edition
By :
As you may recall, THREE.Points renders each point based on the vertices from the supplied THREE.BufferGeometry. This means that if we provide a complex geometry (for example, a torus knot or a tube), we can create THREE.Points based on the vertices from that specific geometry. In this final section of this chapter, we’ll create a torus knot, like the one we saw in Chapter 6, Exploring Advanced Geometries, and render it as a THREE.Points object.
We explained the torus knot in Chapter 6, so we won’t go into much detail here. The following screenshot shows the example (points-from-geom.html):
Figure 7.13 – Torus knot rendered as points with a small animation
As you can see from the preceding screenshot, every vertex used to generate the torus knot is used as a point. We can set this up like this:
const texture = new THREE.TextureLoader().load('/assets/textures/particles/glow.png...