Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

I have a parallax effect in MonoGame consisting of multiple semi-transparent layers of textures. The effect is simple, but rendering multiple transparent layers on top of each other is rather slow. This effect doesn't need to be "accurate". How can I optimize this effect or fake it with shaders to make it more efficient?

The main premise is multiple full screen size semi-transparent layers drawn on top of each other from back to front. There are currently 3 layers + the actual game layer that also has some transparency.

I used a stencil buffer to render the game layer, already eliminating some of the parallax layers' pixels from rendering, but it's still inefficient.

share|improve this question

It really depends on what you're trying to render. For example, if you're rendering layers of clouds that are transparent to the background but not necessarily to each other, one useful trick is to draw the background, then non-transparent cloud layers, then draw the background again at 50% transparency over the other layers.

share|improve this answer

I'm not familiar with MonoGame.

Have you thought about drawing your parallax background at a reduced resolution to a render texture? Scale the finished render texture up to the original size and render it to the screen. If you create the render texture at half the width and height of the original, you need to overdraw and blend only 25% of the fragments in the semi-transparent layers.

This approach may blur the parallax layers depending on the size of the render texture. Depending on what you want to achieve, this may not be acceptable...

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.