rpi must by z-indexed