In some cases, and depending on the camera angle, SurfaceGuis can be rendered in the incorrect order - that is, A can be in front of B, but B occludes A:
In this example (same as in the repro), the red part is actually in front of the black screen. Importantly, AlwaysOnTop is turned off on both SurfaceGuis.
This bug does not occur when the part in front has Transparency <= 0.01. Naturally this is not a reasonable workaround if the developer desires to have the part in front be transparent.
Thank you for bringing up this issue with SurfaceGui rendering. We understand that this can be confusing and we’re here to clarify how it works. When it comes to transparent parts, we implement a sorting mechanism based on their relationship to the camera. The sorting distance is determined by both the camera’s position and the pivot point of the part. This is why when you adjust the camera angle, the rendering order appears to change, especially if the second part becomes closer to the camera. We hope this explanation helps you understand the behavior you’re observing.
That’s an interesting idea.
You could try. Unfortunately I don’t have an answer from top of my head.
Keep in mind that as a “hack” solution it might cause other unexpected behavior.