Chapter 1. Forward Lighting

In this chapter we will cover:

  • Hemispheric ambient light
  • Directional light
  • Point light
  • Spot light
  • Capsule light
  • Projected texture – point light
  • Projected texture – spot light
  • Multiple lights in a single pass

Introduction

Forward lighting is a very common method to calculate the interaction between the various light sources and the other elements in the scene, such as meshes and particle systems. Forward lighting method has been around from the fixed pipeline days (when programmable shaders were just an insightful dream) till today, where it gets implemented using programmable shaders.

From a high-level view, this method works by drawing every mesh once for each light source in the scene. Each one of these draw calls adds the color ...

Get HLSL Development 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.