A computer-generated moiré profilometry based on flat image demodulation is proposed. A sinusoidal fringe pattern and its background light are modulated by two-frequency carrier fringes, respectively, to combine a composite grating. While this composite grating is projected onto the measured object, the composite deformed pattern can be captured by CCD camera. So the sinusoidal deformed pattern and its corresponding flat image can be demodulated from the composite deformed pattern. And the AC component of sinusoidal deformed pattern is calculated by the subtraction between the demodulated sinusoidal deformed pattern and the flat image. Compared with normal computer-generated moiré profilometry, a more intact AC component can be obtained directly no matter how severe the frequency aliasing condition is. Meanwhile, the three-dimensional (3D) shape of object can be reconstructed only using this composite deformed pattern which shows the application in real-time measurement. Experimental results show the feasibility and validity of the proposed method.