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

Adding depth to a mesh with a bump map


For detailed models, you require geometries with a large number of vertices and faces. If a geometry contains a very large number of vertices, loading the geometry and rendering it will take more time than it would take for a simple model. If you've got a scene with a large number of models, it is a good idea to try and minimize the number of vertices for better performance. There are a number of different techniques that you can use for this. In this recipe, we'll show you how you can use a bump map texture to add the illusion of depth to your model.

Getting ready

To get ready for this recipe, we need to get the textures that we want to use on our geometries. For this recipe, we require two textures: a color map, which is a standard texture, and a bump map, which describes the depth associated with the standard texture. The following screenshot shows you the color map that we will use (you can find these textures in the assets/textures folder in the...