Example #1
0
        private void BlurLightMaps(Light light)
        {
            graphics.GraphicsDevice.SetRenderTarget(horizontalBlurTarget);
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

            //Set some params
            horizontalBlur.Parameters["LightPos"].SetValue(light.Position);
            horizontalBlur.Parameters["Radius"].SetValue(light.Radius);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, null, null, null, horizontalBlur);
            spriteBatch.Draw(postProcessTarget, fullScreen, Color.White);
            spriteBatch.End();

            graphics.GraphicsDevice.SetRenderTarget(verticalBlurTarget);
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

            //Set some more params
            verticalBlur.Parameters["LightPos"].SetValue(light.Position);
            verticalBlur.Parameters["Radius"].SetValue(light.Radius);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, null, null, null, verticalBlur);
            spriteBatch.Draw(horizontalBlurTarget, fullScreen, Color.White);
            spriteBatch.End();
        }
Example #2
0
        private void AccumulateLightMaps(Light light)
        {
            graphics.GraphicsDevice.SetRenderTarget(lightMap);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null);
            spriteBatch.Draw(verticalBlurTarget, fullScreen, light.Color);
            spriteBatch.End();
        }