  (Abridged) We investigate the evolution of the opacity of galaxies as a
function of redshift, using simple assumptions about the metal and dust
enrichment of the gas and the distribution of dust in galaxies. We use an
iterative procedure to reconstruct the intrinsic Star Formation Rate (SFR)
density of galaxies with redshift, by applying dust obscuration corrections to
the observed UV emission. The iterative procedure converges to multiple
solutions for the intrinsic SFR density, divided into two basic classes. The
first class of solutions predicts relatively large UV attenuation at high
redshift, with A(1500 A)=1.9 mag at z~3, and smaller attenuations at z<1, with
A(2800 A)=1.25 mag. The SFR density of this set of solutions is constant for
z>~1.2 and declines for z<1.2; it resembles in shape the ``monolithic
collapse'' scenario for star formation. The second class of solutions predicts
relatively low UV attenuations at high redshift, with A(1500 A)=0.75 mag at
z~3, and larger attenuations at z<1, with A(2800 A)=1.50 mag. The SFR density
in this case has a peak at z~1.2. The advantages and shortcomings of both
classes are analyzed in the light of available observational constraints,
including the opacity of galaxies at 0<z<1 and the intensity and spectral
energy distribution of the cosmic infrared background from the COBE DIRBE and
FIRAS data. We conclude that both classes of models are acceptable within the
current uncertainties, but the ``monolithic collapse'' class matches the
available observations better than the other one. We also investigate the
dependence of our solutions on the different model assumptions.
