CHAPTER 6 ■ ADDING LIGHT TO YOUR SCENE IN XNA 3.0
558
effect.Begin();
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Begin();
device.VertexDeclaration = myVertexDeclaration;
device.DrawUserPrimitives<VertexPositionNormalTexture>
➥
(PrimitiveType.TriangleStrip, vertices, 0, 6);
pass.End();
}
effect.End();
6-10. Add Multiple Lights to Your Scene Using
Deferred Shading
The Problem
You want to light your 3D scene from multiple lights simultaneously.
One approach would be to render your 3D world for each light and to blend in the influ-
ence of each light. This would, however, require your scene to be completely re-rendered for
each light you wanted to add. This approach is not scalable, because your frame rate would be
divided by ...