  The origin of rings around giant planets remains elusive. Saturn's rings are
massive and made of 90-95% of water ice. In contrast, the much less massive
rings of Uranus and Neptune are dark and likely to have higher rock fraction.
Here we investigate, for the first time, the tidal disruption of a passing
object, including the subsequent formation of planetary rings. First, we
perform SPH simulations of the tidal destruction of big differentiated objects
($M_{\rm body}=10^{21-23}$) that experience close encounters with Saturn or
Uranus. We find that about $0.1-10$% of the mass of the passing body is
gravitationally captured around the planet. However, these fragments are
initially big chunks and have highly eccentric orbits around the planet. Then,
we perform N-body simulations including the planet's oblateness, starting with
data obtained from the SPH simulations. Our N-body simulations show that the
chunks are tidally destroyed during their next several orbits. Their individual
orbits then start to precess incoherently around the planet's equator, which
enhances their encounter velocities on longer-term evolution, resulting in more
destructive impacts. These collisions would damp their eccentricities resulting
in a progressive collapse of the debris cloud into a thin equatorial and
low-eccentricity ring. These high energy impacts are expected to be
catastrophic enough to produce small particles. Our numerical results also show
that the mass of formed rings is large enough to explain current rings
including inner regular satellites around Saturn and Uranus. In the case of
Uranus, a body can go deeper inside the planet's Roche limit resulting in a
more efficient capture of rocky material compared to Saturn's case in which
mostly ice is captured. Thus, our results can naturally explain the
compositional difference between the rings of Saturn, Uranus and Neptune.
