Using the finished product from the tutorial here.

Is it possible to apply the grayscale effect from here:

Making entire scene fade to grayscale

Or would you basically have to rewrite everything?

EDIT: It's doing something now, but the whole grayscale seems extremely blue. It's like I'm looking at it through dark blue sunglasses. Here's my draw function:

protected override void Draw(GameTime gameTime)

   //Drawing models, bullets, etc.

   spriteBatch.Begin(0, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, grayScale);
   Texture2D temp = (Texture2D)renderTarget;
   grayScale.CurrentTechnique = grayScale.Techniques["Grayscale"];
   foreach (EffectPass pass in grayScale.CurrentTechnique.Passes)
   new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth/2, GraphicsDevice.PresentationParameters.BackBufferHeight/2),
   null, Color.White, 0f, new Vector2(renderTarget.Width/2, renderTarget.Height/2), 1.0f,
   SpriteEffects.None, 0f);



Another edit: figured out what I was doing wrong. I have Blendstate.Additive in the spriteBatch.Draw() call. It should be Blendstate.Opaque, or it literally tries to add the blank blue image to the grayscale image.


1 Answer 1


Since grayscale is a post-process effect it is very easy to integrate. You just have to make sure that before drawing the scene you set a rendertarget. This means that everything is being drawn to someplace in the videocard memory and not directly to the screen. After that you save the texture you get from the rendertarget and draw that as a full screen quad with the gray-scale effect applied.

So the steps:

- Set rendertarget
- Draw scene 
- Unset rendertarget 
- Get texture from rendertarget 
- Set grayscale effect 
- Draw texture as full screen quad

This pdf should help you on your way: http://users.ece.gatech.edu/~lanterma/mpg/ece4893lec_postprocessing.pdf .

  • \$\begingroup\$ I've managed to get it doing something, but now it's a grayscale that seems to have a dark blue translucent overlay. See my edit for the code I'm using in the Draw() function - I probably biffed it somewhere. \$\endgroup\$
    – Fibericon
    Mar 23, 2012 at 3:01
  • \$\begingroup\$ Scratch that, fixed it in the second edit. Works great now! \$\endgroup\$
    – Fibericon
    Mar 23, 2012 at 4:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .