Hide part of object base on camera position

Does anyone have idea to make it?
Customer shader for the sphere:

  • Hide all face behind the sphere
  • Hide the sphere too

Render it just to the depth buffer.

You can do this with:

ZWrite On
ColorMask 0

Also make sure you render your depth-only object in an earlier queue than whatever it is supposed to mask.