Download

Lack of Parallax Backgrounds Info for 2D game

Hey all, I have been searching the web and forums for any information on how to make a parallax background for a 2D Running Game with UE and I have been literally running into a dead end. I wondering if anyone knows of a code or blueprint or even some simple way to make a parallax background that would be helpful. I am also really new to UE and only know the basics so I’ll try my best. Thanks again for your aid.

Ah parallax background consists of several layers moving at a different speed to put things easy.

Depending on the number of layers and parallax effect you want it’s simply a question of size and speed.

The speed is in theory based on distance. Further away, slower, closer, faster.

Let’s say you have your gameplay depth, a few truks from trees in the background, and beyond the trunks you see the night sky.

The easy calculation would be, the sky will move 1/3 your speed, and the trees 2/3. if you don’t scroll up/down. you just need to keep track of your characters movement in X, since it’s a runner i guess the forwards speed is a value you can easily access.

Since these planes move at 1/3 and 2/3 of your speed, that is also the relative size the need to have to you level, but then again it’s better to be safe then sorry.

Then just ADD a translation to trees and sky accordingly.
Or if you know the players exact position or distance travelled, use this to derive the position for sky and trees and SET it.^

If you where using a 3d camera, You could just have put the different planes at the right depth, but then again you could have gone with a full 3d background and get depth effect for free.

Simple. Create a variable in each parallax layer or make your parallax a blueprint that allows you to change the desired texture through the construction script. Make the variable a division of your camera’s position. Divide by low numbers will move the layer faster. Divide by higher numbers will make the layer slower.

Yeah. Thats even better/easier.