Select Page

Parallax Procrastination


With all of these new foreground terrain sections ready to go the scraggly background mountains were looking a bit too out of place for me to leave them alone. Getting a clean, believable background parallax effect was something very important to me. Classic games like Thunder Force 4, Sonic the Hedgehog, Ranger X, Shinobi III and Last Battle all had this amazing sense of depth with their parallax effect and it made everything feel so much more real. Some great recent examples that have inspired me are Vanillaware games such as Muramasa: The Demon Blade and Do My Best Game’s The Final Station.

There are a number of important ingredients to cooking up some good parallax:

  • A suitable amount of layers for your graphics style.
  • Textures that don’t feel like they repeat every millisecond.
  • Texture brightness and saturation variation between layers to give a feeling of distance
  • Getting the right speed for each layer in correlation to the player’s speed
  • Getting the right speed variation between each layer.
  • Spacing out the layers at the correct heights to create an illusion of depth.
  • Bonus points for additional background elements scattered across the layers.

All of these elements can be played with for eternity to get the right balance.

In a similar fashion to the foreground, I kept all of the background graphics in a flat white so they could be recolored in Unity to fit different level themes.

Taking these assets I then brought them in to the game and started looking at options for how to create the actual parallax effect. There were two main methods for achieving this that I was familiar with:

  • Scrolling Textures Using an orthographic camera, a sprite is setup to fill the screen horizontally with a scrolling texture on it. The texture wraps to achieve a fluid continuous background.
  • Z Axis Perspective Using a perspective camera, background elements are placed further back from the foreground along the Z axis to give them their depth. Backgrounds are made of multiple items that loop back around once they scroll past the screen.

I’d had experience with both methods from online courses and decided to go with the perspective camera as it was much more flexible for vertical movement and naturally responding to the player’s speed. This might be something I revisit in the future as aspects of the game change. Thankfully this is a fairly stand alone aspect of the game and could be changed later without impacting the level generation or other areas.

As I mentioned in another post, this flat colored style of background came very close to being the final style for the game along with a potentially fully silhouetted rover and enemies (although it would’ve been with a lot more polish than seen above). Taking inspiration from games like Patapon or Loco Roco with their striking, clean visuals.

Recon Auth Signing Out