One of my techniques is to use a inverted sphere mesh part to aid lighting. To merge it with the skybox I make it slightly transparent.
However, this then messes up the z-index of everything that is transparent in the map, including, decals, parts and particles. It thinks that the mesh is infront of the lantern at certain angles in the GIF above.
I thought what causes this is the fact that the mesh part size and scale are two different values. Because when I moved the part closer to the lantern it fixed the issue. But when I have lanterns all across the map half of them will still have the issue.
I made the mesh part size .2,.2,.2 (with scale at 2k,-2k,2k) and put it in the center of the map, It might mess up the z-indexing because it thinks that the mesh part is in front of the lantern. However when I thought this was the case I resized the mesh part.Size to cover the whole map and it didn’t fix the issue.
Why does it change the z-index at certain angles and positions of the mesh but the issue is still there when the mesh part size covers the whole map?
As you said this does happen if the position of the sky part is closer to the camera than the lights, and I don’t think changing the size of the sky part has anything affect on this behavior.
One somewhat hacky solution could be to position the sky part with an offset relative to the camera each render step, as it would then always be further away from then camera than the lights.
I threw together a quick test which appears to be working as expected in Play Solo, but I’m not sure how well it will work for your purposes.
Second, you have two transparent parts at the same position, while the depth sorting required to correctly render transparent objects is only performed on parts, not individual polygons or fragments. That’s why you’re seeing parts being rendered in different order when you rotate your camera.
Shader-based pixel-correct OIT does exist, but it is very expensive in terms of performance and requires DX10+ hardware.
I believe zeuxcg had explained this on multiple occasions.
I referred to it as z-index because it was easier to explain.
The parts aren’t in the same position though? Unless I misunderstand.
I checked through previous threads but didn’t find anyone that was experiencing the same problem unless it’s the issue is similar with surfaceGui objects too?
The problem is fixed with Gloin’s method though the skybox loses its two tone colour due to the edges of the mesh always being at the same distance from the camera