THE EVOLUTION OF THE MAGNITUDE SYSTEM FROM HIPPARCHUS TO POGSON
A scale of magnitude (bright stars are first magnitude, and dim ones are sixth magnitude) was developed by the Greek astronomer Hipparchus, popularised by Ptolemy in his Almagest and refined in Victorian times by Pogson.
Wikipedia says of the Greek system:
6th magnitude stars were at "the limit of human visual perception (without the aid of a telescope). Each grade of magnitude was considered to be twice the brightness of the following grade (a logarithmic scale). This somewhat crude method of indicating the brightness of stars was popularized by Ptolemy in his Almagest, and is generally believed to have originated with Hipparchus.
This original system did not measure the magnitude of the Sun. (The Sun, according to Prolemy's model of the universe was a planet rotating around the earth, and not a star at all).
In 1856, Pogson formalized the system by defining a typical first magnitude star as a star that is 100 times as bright as a typical sixth magnitude star; thus, a first magnitude star is about 2.512 times as bright as a second magnitude star. The fifth root of 100, an irrational number (about 2.512) is known as Pogson's Ratio.
Pogson's scale was originally fixed by assigning Polaris a magnitude of 2. Astronomers later discovered that Polaris is slightly variable, so they first switched to Vega as the standard reference star,
The modern system is no longer limited to 6 magnitudes or only to visible light. Very bright objects have negative magnitudes. For example, Sirius, the brightest star of the celestial sphere, has an apparent magnitude of −1.46. The modern scale includes the Moon and the Sun; the full Moon has an apparent magnitude of −12.6 and the Sun has an apparent magnitude of −26.73. The Hubble Space Telescope has located stars with magnitudes of 30 at visible wavelengths and the Keck telescopes have located similarly faint stars in the infrared."
APPARENT MAGNITUDES AND ABSOLUTE MAGNITUDES
An apparent magnitude is how bright a star looks to an observer from earth. The Sun looks as bright as it does, because it is only 8 light minutes away from us. Whereas the nearest star is over 4 light years away. Astronomers decided to develop a scale of absolute magnitudes, that expressed how bright a star would look if it were 10 parsecs away (about 32.6 light years away), so that they could compare like wlth like.
As your question implies, as between two stars one quite bright but a long way away and one not so bright but very near, which is really the brighter of the two if we can ignore the distances involved? i.e. which has the greater luminosity? The scale of Absolute Magnitudes is the way that that comparison can be made.
For objects within our Galaxy with a given absolute magnitude, 5 is added to the apparent magnitude for every tenfold increase in the distance to the object i.e. it is one hundredth as bright if it is ten times the distance away (an inverse square law applies). This relationship does not apply for objects at very great distances (far beyond our galaxy), since a correction for General Relativity must then be taken into account due to the non-Euclidean nature of space.
The lower an object's absolute magnitude, the higher its luminosity.
Many stars visible to the naked eye have an absolute magnitude which is capable of casting shadows from a distance of 10 parsecs; Rigel (-7.0), Deneb (-7.2), and Betelgeuse (-5.6).
For comparison, Sirius has an absolute magnitude of 1.4 and the Sun has an absolute visual magnitude of 4.83, i.e. if the Sun were 10 parsecs away it would be barely visible to the naked eye on all but the clearest nights. Some people find this surprising as they are so used to the Sun as a very bright and important object in our lives. But on a cosmic scale it is really quite ordinary. 4.83 is dimmer than Ganymede's apparent magnitude.
Absolute magnitudes for stars generally range from -10 to +17. The absolute magnitude for galaxies can be much lower (brighter). For example, the giant elliptical galaxy M87 has an absolute magnitude of -22.
THE BIG PICTURE
Apparent Magnitude. Celestial Object
−26.73 Sun
−12.6 full Moon
−4.7 Maximum brightness of Venus
−2.9 Maximum brightness of Mars
−2.8 Maximum brightness of Jupiter
−1.9 Maximum brightness of Mercury
−1.5 Brightest star (except for the sun) at visible wavelengths: Sirius
−0.7 Second brightest star: Canopus
0.7 Maximum brightness of Saturn
3 Faintest stars visible in an urban neighbourhood with naked eye
4.6 Maximum brightness of Ganymede
5.5 Maximum brightness of Uranus
6 Faintest stars observable with naked eye
7.7 Maximum brightness of Neptune
12.6 Brightest quasar
13 Maximum brightness of Pluto
27 Faintest objects observable in visible light with 8m ground-based telescopes
30 Faintest objects observable in visible light with Hubble Space Telescope