The solid angle formed by a surface at the origin is the area of the projection of the surface onto onto a sphere of radius 1 centered at the origin.
In the diagram above the solid angle is
\[d \omega = \frac{\Omega}{r^2}\]
\[\mathbf{n}\]
is the outward normal at the surface then
\[cos \theta = \frac{\mathbf{n} \cdot \mathbf{r}}{r}\]
But also
\[d \Omega = cos \theta dS = \frac{\mathbf{n} \cdot \mathbf{r}}{r} dS \]
Then
\[d \omega = \frac{\mathbf{n} \cdot \mathbf{r}}{r^3} dS\]
If the origin is not inside
\[S\]
then
\[\omega = \int \int_S \frac{\mathbf{n} \cdot \mathbf{r}}{r^3} dS =0\]
and if the origin is inside
\[S\]
then
\[\omega = \int \int_S \frac{\mathbf{n} \cdot \mathbf{r}}{r^3} dS = 4 \pi\]
by
Gauss's Theorem.