Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Basically, what I'm trying to do is apply a shader to my background image and only the background image. The problem is: the background is actually made up of tiles that are picked out of a list of images. The background code loads and draws the tiles according to a map (an int[,].) I've been reading up on using RenderTarget2d, but I haven't found anything that suggests I'd be able to use specific images (let alone images set up according to a map.) So here's my question: is there a way to render my backgrounds to a texture so I can apply a shader or is there another way for me to apply a shader that I might want to try?

share|improve this question
up vote 0 down vote accepted

You seem to have already figured out how to do this. Here's the process:

spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, myShaderEffect);
spriteBatch.Draw(myRenderTarget, Vector2.Zero, Color.White);

You may want to have a look at the Bloom Postprocess sample. There's no reason you have to apply a post-process effect to your entire scene. You can apply it to just your background and then draw the rest of your scene over the top.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.