Room-temperature visible photoluminescence (PL) was observed in silicon oxide (SiOx) silicon oxynitride (SiOxNy), and silicon nitride (SiNx) films grown by ion beam sputter deposition. The amounts of oxygen and nitrogen in the films were controlled by using in-situ X-ray photoelectron spectroscopy (XPS). In the SiOx and the SiNx thin films, the PL energies showed blue-shifts due to the quantum-confinement effect with the decreased excess Si and the PL intensities showed maximum values near x = 1.6 and x = 1.1, respectively. We found another large blue-shift of about 0.6 eV in the PL energy between the SiNx and the SiOx films with similar excess Si due to surface passivation of Si nanocrystals. The increase of PL energy from SiOx through SiOx N-y to SiNx can be a direct evidence for a surface passivation effect, which is in agreement with the theoretical prediction. These results indicate that control of the nc-Si size and the surface passivant material are key parameters for enhancing the visible luminescence for a Si-based photonic device.