Point Occlusion in 3D Scatter Makie

Sorry for resurrecting this old(ish) thread, but I was trying to apply the solution to a plot consisting of multiple line, where each line is associated with some value that I want to sort the lines according to. The attached image shows what this looks like.
The color of each line indicates the sorting, and I would like the dark blue lines to be in front, and the yellow lines at the back. However, the order appears to be jumbled up.
I know I can achieve this in GLMakie, but the CairoMakie figure looks so much nicer.

I guess my question is what part of each line is used for determining the drawing order? I tried drawing the lines in the order dictated by the color, but that didn’t seem to help; the order was still scrambled. I also tried applying the z-order transform in the solution to OPs original question, but it wasn’t clear to me what point to use for each line.