CHAPTER 6 ■ ADDING LIGHT TO YOUR SCENE IN XNA 3.0
563
different for each object of your scene). Render your scene using the MultipleTargets tech-
nique by passing this to the RenderScene method.
Once the RenderScene method has completed, the three render targets will contain the
color, normal, and depth value for each pixel of your screen. Before you can save their con-
tents into a texture, you need to deactivate them (see recipe 3-8).
HLSL Code
You still have to define the MultipleTargets technique, which should render the scene to three
targets at once. Start by defining the XNA-to-HLSL variables:
float4x4 xWorld;
float4x4 xView;
float4x4 xProjection;
Texture xTexture;
sampler TextureSampler = sampler_state { texture = <xTexture> ;
➥
magfilter = ...