Decent View Camera System

I’m trying to implement a trackball camera system. Does the sphere change with object/scene? Does the scene have to be enclosed inside the bounding (virtual) sphere?

Any good implementation?

Thanks.