public DeferredShader(GraphicsDevice device, ContentManager content, SpriteBatch batch)
{
Device = device;
SpriteBatch = batch;
ClearShader = content.Load<Effect>("deferred_clear");
RenderToShader = content.Load<Effect>("deferred_to");
FinalShader = content.Load<Effect>("deferred_final");
int width = device.PresentationParameters.BackBufferWidth;
int height = device.PresentationParameters.BackBufferHeight;
color_target = new RenderTarget2D(device, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
normal_target = new RenderTarget2D(device, width, height, false, SurfaceFormat.Color, DepthFormat.None);
depth_target = new RenderTarget2D(device, width, height, false, SurfaceFormat.Single, DepthFormat.None);
FinalShader.Parameters["half_pixel"].SetValue(new Vector2(0.5f / (float)width, 0.5f / (float)height));
FinalShader.Parameters["noise_map"].SetValue(content.Load<Texture2D>("noise_norm"));
quad = new Quad(device);
r_state = new RasterizerState();
r_state.CullMode = CullMode.None;
}