Scrolling background
Sometimes you want a parallax background but you don’t want to actually move the Camera.
Import all of your background images with the Repeat flag “Enabled” if it already loops seamlessly and “Mirrored” if you want it to flip horizontally every other loop. You can make a parallax effect if you alter the scroll speed. Note that for every different scroll speed you’ll need to make another ShaderMaterial since changing the param on one will change it on all sprites that share the same resource.
The image used for the thumbnail is Glacial Mountains: Parallax Background by vnitti.
Shader code
shader_type canvas_item;
uniform float speed;
void fragment () {
COLOR = texture(TEXTURE, vec2(UV.x + TIME * speed, UV.y));
}
You can have same effect if you manually update offset on Parallax Background
great shader, ty
Thank you so much for this. It is perfect for my use case which doesn’t work with the parralax background node.