Local structural origins of the distinct electronic properties of Nb-substituted SrTiO3 and BaTiO3.