Book Image

Learning Three.js - the JavaScript 3D Library for WebGL

By : Jos Dirksen
Book Image

Learning Three.js - the JavaScript 3D Library for WebGL

By: Jos Dirksen

Overview of this book

Table of Contents (20 chapters)
Learning Three.js – the JavaScript 3D Library for WebGL Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
8
Creating and Loading Advanced Meshes and Geometries
Index

Particles, THREE.PointCloud, and THREE.PointCloudMaterial


At the end of the previous section, we quickly introduced THREE.PointCloud. The constructor of THREE.PointCloud takes two properties: a geometry and a material. The material is used to color and texture the particles (as we'll see later on), and the geometry defines where the individual particles are positioned. Each vertex and each point used to define the geometry is shown as a particle. When we create THREE.PointCloud based on THREE.BoxGeometry, we get 8 particles, one for each corner of the cube. Normally, though, you won't create THREE.PointCloud from one of the standard Three.js geometries, but add the vertices manually to a geometry created from scratch (or use an externally loaded model) just like we did at the end of the previous section. In this section, we'll dive a bit deeper into this approach and look at how you can use THREE.PointCloudMaterial to style the particles. We'll explore this using the 03-basic-point-cloud...