Using the density functional theory (DFT) of the first principle and Generalized gradient approximation method, the electronic structures and optical properties of the InxGa1-xN crystals with different x (x = 0.25, 0.5, 0.75, 1) have been calculated in this paper. The influence of the electronic structure on the properties has been analyzed. Then the influence of doping quantity on the characteristics has been summarized, which also indicates the trend of complex dielectric function, absorption spectrum and transitivity. With the increase of x, the computational result shows that the optical band gap (i.e.Eg) of the InxGa1-xN crystal tends to be narrow, then the absorption spectrum shifts to the low-energy direction. And the Fermi energy slightly moves to the bottom of conduction band which would cause the growth of conductivity by increasing x. In a word, the InxGa1-xN compound can be achieved theoretically the adjustable Eg and photoelectric performance with x, which will be used in making various optoelectronic devices including solar cell and sensors.