Systematics in band gaps and optical spectra of 3D transition metal compounds