
CHAPTER 6 ■ ADDING LIGHT TO YOUR SCENE IN XNA 3.0
533
■Note This example uses a texture with just one solid color in it (blue), so you can be sure all color gradi-
ents in the final result are caused by lighting.
6-3. Add Higher Detail to Your Lighting:
Per-Pixel Lighting
The Problem
Intheprevious two recipes, the amount of shading was calculated in each vertex, and this
shading value was interpolated over all the pixels of the triangle. Therefore, it is called per-
vertex lighting (or Gouraud shading).
Insomecases,thisdoesnotgivethebestresult.Especiallywhenusinglargetriangles
and/or sharp edges, this can give some undesired results. ...