We investigated the effect of rapid thermal annealing (RTA) on the optical properties of GaN and InxGa1-xN. It was found that some of the changes in the photoluminescence spectra of GaN upon annealing were associated with the properties of the surface layer. For example, a new low-temperature photoluminescence line associated with donor–acceptor pair (DAP) recombination appeared at around 3.40 eV upon annealing, but disappeared after etching off the surface layer. This indicates that the acceptors responsible for the DAP emission were created only near the surface. After the RTA process, the near-band-edge emission was blueshifted, and the relative intensity of yellow luminescence with respect to the near-band-edge emission was increased, which were also attributed to the influence of the surface layer. The thermal annealing effect of an InxGa1-xN multiple quantum well structure is also discussed.© 1998 American Institute of Physics.