liveBook · Manning

Lighting direction vector

As explained in Geometry for Programmers

A lighting direction vector is a normalized vector directed from a shaded point toward a light source.

In scene shading, a lighting direction vector points from a surface point toward a light source and is normalized to represent direction alone. Pair it with the surface normal vector in a dot product to estimate how strongly that point is illuminated. section 9.2.3

The dot product gives a practical lighting coefficient:

  • Aligned vectors produce 1, representing maximum lighting. section 9.2.3
  • Perpendicular vectors produce 0, so the surface receives no light from that direction. section 9.2.3
  • Opposing vectors produce negative values, which are ignored for lighting because the light does not shine there. section 9.2.3

Shading a sphere

For each pixel, use the corresponding surface point, calculate the normalized vector from that point to the light, and take its dot product with the point’s normal. Applying the resulting coefficient to the object’s color creates shading that makes a projected sphere appear three-dimensional. section 9.2.3

Figure 9.9 Lighting in a point is determined by the dot product of the object’s normal vector and the lighting direction vector.
09-09

Use the figure to compare how the normal and lighting direction determine illumination at a point. section 9.2.3

How Geometry for Programmers covers it

How deep it goes
Explains normalization, normal-vector comparison, coefficient values, and directional-light representation, without developing a complete renderer.
Examples
Uses a projected sphere, surface quads, per-pixel positions, normals, and a light source to demonstrate shading.
What it assumes
Assumes vector algebra and introduces surface normals as vectors orthogonal to element planes.
What you can do after
Apply dot products to estimate lighting intensity for points on a rendered surface.
How it connects
Connects surface normals, dot products, shading, point lighting, and directional lighting.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.