Wyvyn S. answered 11/07/24
Ad Astra Per Aspera
This is a really interesting question!
First, the few constants we know to help answer this is the brightness of the sun, the brightness of astronomical twilight, and how much the brightness of the moon varies.
First, we'll cut out most calculations by considering the formula in terms of solar luminosities.
So, to make a formula for the sun first, we can reason through proportionality.
We know that if the sun were brighter, the angle below the horizon would have to be greater, so the object Luminosity is directly proportional to X degrees. We also know that the brightness for astronomical twilight is constant. So, in a very simplified model, we can say a ratio between L and X is equal to that brightness.
X/L = A. Something interesting here is the units which pop out are luminosity/degree. This makes intuitive sense; The brightness of an object per each degree it is obscured by the horizon affecting percieved brightness is reasonable. Now, we can rearrange to get terms of degrees.
X = L*A, where X is degrees of obfuscation, L is the luminosity of an object, and A is a constant luminosity per degree of obfuscation, all in terms of solar luminosity.
To suit this better for the moon, we can consider it with respect to time, and a sin wave roughly corresponding to its total brightness, and so we get a term (Sin(M*2*Pi) + 1) / 2 * L = Moon phase brightness, where L is the maximum brightness and M is months.
The sin function says that every 90 degrees of rotation (or 1/2 pi radians) of rotation around a circle we go from 0, to 1, to 0 again, to -1, and back to zero again, on repeat. First and foremost, because the moon's brightness can't be negative, we'll add one to remove all those cases. Then, we can turn this into a ratio by dividing by 2. This ratio basically turns our sine function into how much the moon is full as the month goes on, rather than it's total brightness. Then, we multiply this ratio by the luminosity of the full moon to get its brightness at a given time of the month.
Disclaimer - this assumes a month begins at a quarter or half-full moon because of the way we've constructed our sin function, but this is arbitrary anyways. Also, This is incredibly simplified, as it doesn't take into account how much the moon changes distance throughout the year, or how long the moon stays at a particular brightness relative to others, etc. But, it's good enough!
So, when taking the moon's phases into account, we have a final formula of X = (Sin(2Pi*M)/2 * L) / A
Where X is degrees of obfuscation, M is time in months, L is the maximum luminosity of the moon in apparant solar luminosity, and A is the apparant solar brightness per degrees of obfuscation of the sun during astronomical twilight.
To avoid overcomplicating this, I'll leave out the numbers, but perhaps anybody reading this can try out the formula and see how well it works! Again, this formula gives you a simplified approximation, and only of what you should expect.