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


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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.