Book Image

Three.js Cookbook

By : Jos Dirksen
Book Image

Three.js Cookbook

By: Jos Dirksen

Overview of this book

Table of Contents (15 chapters)
Three.js Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a point cloud based on a geometry


An interesting feature of Three.js is that it also allows you to create point clouds. A point cloud isn't rendered as a solid geometry, but all the individual vertices are rendered as single points. In this recipe, we'll show you how to create such a point cloud based on an already existing geometry.

Getting ready

There are no additional steps required to start with this recipe. For the example we use in this recipe, however, we use an external model as the basis for our point cloud. We also use a camera control object, THREE.OrbitControls, to make navigation around the example easier. If you want to use the camera control object yourself, you need to add the following JavaScript libraries to the scene (besides the standard Three.js one):

  <script src="../libs/OrbitControls.js"></script>
  <script src="../libs/OBJLoader.js"></script>

The external model we use is also provided with the sources in this book and can be found in...