Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Three.js Cookbook
  • Table Of Contents Toc
Three.js Cookbook

Three.js Cookbook

By : Jos Dirksen
4 (8)
close
close
Three.js Cookbook

Three.js Cookbook

4 (8)
By: Jos Dirksen

Overview of this book

This book is ideal for anyone who already knows JavaScript and would like to get a broad understanding of Three.js quickly, or for those of you who have a basic grasp of using Three.js but want to really make an impact with your 3D visualizations by learning its advanced features. To apply the recipes in this book you don’t need to know anything about WebGL; all you need is some general knowledge about JavaScript and HTML.
Table of Contents (9 chapters)
close
close
8
Index

Adding depth to a mesh with a normal map


With a bump map, we showed in the Add depth to a mesh with a bump map recipe, how to add depth and detail to a mesh using a specific texture. In this recipe, we provide another way to add even more depth and details without increasing the vertex count of the geometry. To do this, we will use a normal map. A normal map describes the normal vector for each pixel, which should be used to calculate how light affects the material used in the geometry.

Getting ready

To use normal maps, we first need to get a color map and a normal map. For this recipe, we've used two screenshots. The first is the color map:

The next screenshot is the normal map:

Now that we've got the two images, let's first look at how this would look in practice. To see a normal map in action, open the 04.02-add-depth-to-mesh-with-normal-map.html example:

In this example, you can see a standard rendered cube on the left-hand side and one where a normal map is added to on the right-hand side...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Three.js Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon