Numerical modeling of bright-field and dark-field imaging with spatially partially coherent light is considered. The illuminating field is expressed as a superposition of transversely shifted fully coherent elementary fields of identical form. Examples of imaging under variable coherence conditions demonstrate the computational feasibility of the model even when the coherence area of the illumination is in the wavelength scale.