Chapter 5. Lights and Custom Shaders

In this chapter, we'll cover the following recipes:

  • Creating shadows with THREE.SpotLight
  • Creating shadows with THREE.DirectionalLight
  • Softening lights by adding ambient lighting
  • Using THREE.HemisphereLight for natural lighting
  • Adding a moving all-directional light
  • Moving a light source along a path
  • Making a light source follow an object
  • Creating a custom vertex shader
  • Creating a custom fragment shader

Introduction

Three.js provides a large number of light sources out of the box. In this chapter, we'll show you a number of recipes that work on lights and also show you how to get the most out of the lighting options provided by Three.js. We'll also show you two advanced recipes that explain how you can access the raw features ...

Get Three.js Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.