I have a problem with sprite rendering order when using a perspective camera.
I want to use a perspective camera for a 2d side view platformer in order to have parallax for free. I know I may implement parallax also with an orthographic camera and some scripts shifting the sprites to simulate the distance from the camera. This approach needs a script for any object with the parallax and, for importantly, in my setting there is a lag of 2 frames from go updates and rendering.
So I switched all my project to perspectve camera but I have a problem with rendering order of sprites. Let me describe it. I have a collection with various GO and each GO has various sprites. The sprites have different z values. When I draw the collection on screen the drawing order of the sprites is not respected.
If I understand correctly the sprites are ordered with respect to the z-value of the position of the center of the sprite (no pivot) as seen from the camera. This can result in incorrect order, yes, I understand this. But, when the collection is draw in front of the camera (i.e. the vector from the camera to the GO is perpendicular to the near/far clipping planes) then the sprites should be in the correct order. But, this is not the case and I don’t understand why!
I have read the other posts about the same problem, however it seems to me that they don’t solve my issue. I am using: no depth mask and no depth test. I cannot use depth test since my sprite have a lot of transparency.
My apologizes for the long post and thanks!
Ciao!