Defects, optical absorption and electron mobility in indium and gallium nitrides