Conversion between specular exponent, specular roughness, and specular glossiness

Ever need to convert between specular exponent, roughness, and glossiness? for the Blinn-Phong BRDF, these three values represent the same concept. Specular Exponent is the actual value used to compute the BRDF. Let’s call that variable $e$. The roughness $m$ and glossiness $g$ values are numbers between 0 and 1 and they are additive inverses of each other. In other words

$$g = 1 – m \, ,$$

$$m = 1 – g \, .$$

The exponent is given by

$$e = \frac{2}{m^2} – 2$$

or

$$e = \frac{2}{{(1 – g)}^2} – 2 \, .$$

The BRDF $f_r(\omega_i, \omega_g)$ is

$$f_r(\omega_i, \omega_o) = \pi \frac{F(\omega_i \cdot \omega_h) D(\omega_i) G_2(\omega_i \cdot \omega_g, \omega_o \cdot \omega_g)}{4 (\omega_i \cdot \omega_g) (\omega_o \cdot \omega_g)}$$

where Blinn-Phong $D(\omega_i)$ is given by

$$D_{\mathrm{Blinn-Phong}}(\omega_i, \omega_h, e) = \frac{e+2}{2\pi} (\omega_i \cdot \omega_h)^e$$

and the resulting specular illumination is given by
$$\mathbf{L}_o = f_r(\omega_i, \omega_o) \mathbf{L}_i (\omega_i) \mathbf{V}_i (\omega_i) (\omega_g \cdot \omega_i) \, .$$