Heterochromatic extinction. 2. Dependence of atmospheric extinction on stellar temperature, surface gravity, and metallicity