It's to do with photons being the right energy, or wavelength, to excite an electron enough to move up to the next energy shell in the atom. If it does, then the photon is absorbed. . In this case, the medium the photon encountered would be classed as optically opaque. If the photon energy is insuffucient i.e. wrong wavelength, the photon will be momentarily absorbed and then ejected onto the next electron it encounters, which will be repeated until it passes through the other side. If you shone a pure UVC wavelength - no other light around - at a piece of glass and you took a uv-sensitive photo on the other side, the photo will be black because all the UVC photons have been absorbed. So, to UVC, glass is opaque but transparent to visible light. It depends on the wavelength what is 'transparent' or not.