I just wanted to point out the true parallax can be achieved with the parallaxBackground and ParallaxLayer nodes, which make more sense in this context than a canvas layer
Hey, I passed this video a good few days ago now and have moved on to about half way through the second series of videos (Alien Attack). With this in mind did you do anything specific to the node in order to allow the parallax effect? What makes this method different than using the CanvasLayer method? I thought it was a clever work around as previously I had seen people coding out about ten or twelve lines in order to get a parallax effect on a start up screen, when it could instead be done by adjusting a z-index value and node structure changing.
I am genuinely curious though as to what this changes/ how it achieves a 'true parallax background effect?
I do agree that it would make more sense since they’re already built in nodes.
Yeah! So, all you have to do is make sure the nodes are nested as follows:
Then, in the ParallaxLayer node, set a scale. If it is set to 1, it’ll stay in the same place the way the TextureRect does without the Canvas. At 0, it remains stationary relative to the camera, like it does with a Canvas.
If you set it somewhere in between, like say 0.25, it gives a sense of depth. It moves around, but slower than the foreground would, making it look like it’s deep in the background. At a scale greater than 1, it moves faster like it’s closer to the camera.
I say “true parallax” because true parallax has some movement. Parallax is defined by the position or direction of an object appearing different from different viewing points. Like if you close one eye and then the other, things look slightly different. With the Canvas node, the object looks the same at all positions and directions, so there is no parallax effect.
I like this solution more than the canvas one because it’s almost identical in terms of process but also reveals some of the purpose-built functionality that Godot has. The advantage of Godot over other engines is partly that very common functionality like Parallax is natively supported due to demand from the Open-Source userbase. An example like this should help train you to look for support for various feature in-engine before seeking workarounds or programming your own bespoke solution
I forgot about this until just now, but I’ll be doing this after dinner! I appreciate your response and this makes perfect sense in my mind. I would love to add to the godot community one day in such a positive manner. Thanks for the input, I appreciate the guidance and understand why it would be a preferred method now.