We analyze the effect of thermal processes on the optical properties ͑refractive index, optical gap, Tauc coefficient, and Urbach energy͒ of SiN x :H films. Films with three different nitrogen to silicon ratios (xϭ0.97, xϭ1.43, and xϭ1.55, respectively͒ were deposited by a chemical vapor deposition technique assisted by an electron cyclotron resonance generated plasma. After deposition they were subjected to rapid thermal annealing at temperatures ranging from 300°C to 1050°C. We found that the percolation threshold for Si-Si bonds ͑at xϭ1.1) separates films with different response to thermal treatments. The changes of the Tauc coefficient and the Urbach energy at moderate annealing temperatures indicate a structural relaxation of the network for the films with x above the percolation threshold, while at higher temperatures the trends are inverted. In the case of x below the percolation limit the inversion point is not observed. These trends are well correlated with the width of the Si-N infrared stretching absorption band. Additionally the samples with as-grown x ϭ1.43 show a good correlation between the Urbach energy and the density of unpaired spins in silicon dangling bonds.