The concept you need is called "air mass" or "airmass". Air mass is a unitless parameter that indicates how many thicknesses of the Earth's atmosphere that sunlight has to pass through before hitting the surface. A value of zero (AM0) indicates the air mass for the top of the atmosphere, hence the zero. A value of one (AM1) indicates that sunlight has to pass through one Earth atmosphere when the Sun is directly overhead (zenith angle = 0). Higher values are indicative of the Sun being lower in the sky and hence sunlight having to pass through more than the equivalent of one thickness of the Earth's atmosphere.
The linked wikipedia page provides multiple approximate formulae for computing air mass as a function of zenith angle, and then provides another formula for computing intensity as a function of air mass. I have reproduced a couple of these below:
$$ \text{AM} = \frac{2r+1}{\sqrt{(r\cos z)^2 + 2r + 1}+r\cos z}$$
where
- $r$ is the ratio of the Earth's radius to the effective thickness of the Earth's atmosphere (most people use $r=908$),
- $z$ is the zenith angle of the Sun, and
- $\text{AM}$ is the air mass.
$$ I = 1.1\,I_0\,0.7^{(\text{AM}^{\,0.678})}$$
where
- $\text{AM}$ is the air mass, as calculated above, or by some other equation,
- $I_0$ is the solar constant, $1353 \text{W}/\text{m^2}$, and
- $I$ is the intensity at the surface, assuming no clouds, no humidity, and no pollution.