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

Using Blender to create custom UV mapping


If you want to apply a texture (a 2D image) to a geometry, you need to tell Three.js which part of the texture should be used for a specific THREE.face object. The definition of how a texture maps to the individual faces of a geometry is called a UV mapping. A UV mapping, for example, tells Three.js how to map a 2D map of the earth to a 3D sphere geometry. When you're working with simple shapes, or the basic geometries provided with Three.js, the standard UV mapping that's provided is often enough. However, when shapes become more complex or you have some specific texture mapping requirements, you need to change how each face of a geometry is mapped to part of a texture. One option is to do this by hand, but for larger geometries, this is very difficult and time-consuming. In this recipe, we will show you how you can create a custom mapping with Blender.

Getting ready

For this recipe, you need to have Blender installed; if you haven't installed Blender...