I am experimenting with parallax scrolling in a retro ship scroller way. In this example the camera is not moving, rather each background layer is moving at different speeds to simulate the parallax scrolling of these types of games.
What I have found with this is is that even though a layer is logically in front of the other, it does not always work out. Any ideas why not? Kind of like a Z order situation or something.
Hey there @usa423! When looking at the video it seems the parallax effect is functioning as expected from the setup. Is there some miss-ordering occurring? It seems the green hills are up front and mountains second. The orthographic camera does have some known ordering and lighting issues usually, but I think I may be missing it.
You are correct, in this instance, in this video, it worked. However I can’t reproduce the results when I want to, sometimes the layer that should be first is not, for reasons I do not understand the orthagraphic camera might place it equal or second to the second layer, even though the first layer is physically closer to the camera. Just trying to figure out the mechanisms of how it does it.
Ah understood! The original orthographic camera implementation has had issues with lighting for quite some time. I believe some of the issues were addressed in UE5, but most users that run into those lighting issues (or in your case the ordering issues) by swapping to a perspective camera, with a low field of view and long distance to emulate an orthographic camera as a workaround. This introduces other issues for “True” orthographic games, but the visual artifacting should stop.
I made a video for you and did a few flyovers of the map so you can see what it is doing. Turns out this effect is happening in either perspective mode or orhographic mode for the camera.
It seems to be a sprite issue, as here even the preview the problem can be seen. It is kind of like in 3D graphics when the normals are not turned the right way. I have attempted rotating the sprite to no effect. On my side I used a different paint program to export the sprite, also no effect.
It would be tedious, but one could create a really thin cube in something like Blender, and then have a texture for just one side. But then you would lose the transparent properties of a .png wouldn’t you?
Oh I see what’s going on, those are sprites. I believe you can get around this issue with adjusting the translucency sorting policy. Head over to Project Settings -> Engine -> Rendering -> Translucency then change the Translucent Sort Policy to Sort Along Axis then adjust that axis to your needs. This should remove the issue altogether in your case.