Check WorldAlignedTexture node. It changes the texture to work just like sphere mask, in world space.