From Sonic Retro
Behavior in games
Sonic the Hedgehog 2
To earn a Perfect Bonus in Sonic 2, the player has to collect all the rings in a level. This does not include rings earned from Super Ring monitors. The player is awarded 50,000 points at the end of an act. However, some levels have rings placed in odd locations such as hidden within walls or far beyond the player's reach, therefore making a Perfect Bonus impossible to achieve. More information can be found here.
Sonic the Hedgehog 3 / Sonic & Knuckles
To earn a Perfect Bonus in Sonic 3 or in Sonic & Knuckles, the player must collect all the rings in a Special Stage. This not only includes free-floating rings in the Special Stage, but also rings that are generated when a rectangular perimeter of blue spheres is cleared. The player is awarded 50,000 points at the end of the Special Stage for collecting all rings, regardless of if the player earned the Chaos Emerald at the end of the Special Stage.
There is no Perfect Bonus in Blue Sphere, as there is no score in this game. However, collecting all rings in a stage allows the player to see the difficulty level of the stage just completed and allows them to skip ten stages.
To earn a Perfect Bonus in Sonic Generations, the player must simply complete a level without dying. The bonus raises their Rank for the level by one and is necessary to gain S-Ranks in this game. Perfect Bonuses are achieved in the HD versions of the game; they are not present in the Nintendo 3DS version.
The screen you see in Blue Sphere when you get a perfect.