When implementing explicit light sampling, I am separating the monte-carlo approximation to two parts
$$\frac{1}{N+M}(\sum^N \text{direct} + \sum^M \text{indirect})$$
$$\text{direct} = \frac{\text{bsdf} \times C \times cos(\theta)}{p}$$
I am confused as how to obtain $p$ for direct lightning. My light source is an arbitrary triangularized mesh and I am sampling random points from it's surface.
A solution was presented here: Path weight for direct light sampling
$$\frac{A}{r^2} (N_\text{light} \cdot -L)$$
Where does this come from? I'm asking for a reference or a derivation. Thanks!