3D Sprites overlapping when moving

Godot Version

v4.2.stable

Question

I have two 3D sprites which are on a different z axis. When the camera moves to the top the sprite of the tree sitting behind the other one suddenly overlaps and gets drawn on top.

I can’t figure out how to prevent this. I’ve tried with and without billboarding, changing process priority and changing the Alpha Cut to “Opaque Pre-Pass”. Anything else I can try?

Video: Imgur: The magic of the Internet

I’m not sure how I would solve this for a 3d billboard, but a solution I like to use is create an area 2d with a polygon collider, use area entered and exit to change the sort layer on the player.

This solution will run into issues when the trees are close together though. But works great if the trees have a player sprite worth of space between them.

It should depend on the direction of the camera. If the camera is looking straight down, then the y axis should specify the order of drawing. If the camera is at an angle, then the z axis should be used.

If you are using a area 2d then you are no longer in 3d space and should use a y sort node.

Looking at your picture there is no perspective on the ground texture. This would seem you are ordering by distance from camera and not taking advantage of 3d space. If that is the case and you want to maintain that aesthetic you should transition to 2d nodes with y sorting nodes.

I looked at the video, I wonder if the sprite is falling out of some sort of render boundary for the camera. Try changing occlusion distances/options for the camera.