Use depth buffer to terminate ray