weighted shortest path in 3D