Invasion affects all wireline logs, especially the logs of shallow reading tools. Although tool responses can be predicted with tool models, even sophisticated log analysis programs usually apply oversimplified step invasion profiles to correct for invasion effects. We have developed forward modeling and inversion routines that use porosity and shallow resistivity logs as input, and produce "sloping invasion profiles" constrained by saturations of the flushed and uninvaded zones. Forward models were either provided by logging companies or derived from published data. A 1D radial formation model with saturation changing away from the borehole wall was used together with tool response models to calculate log readings. Finally, we used the differences between calculated logs and recorded logs to update both the formation properties and the shape of the invasion profile. Results from synthetic data show that the new algorithms predict porosity with an absolute error of 3%, compared with 7% for the step-function. The "sloping invasion profile" also reproduced the responses of the recorded logs better than the "step function profile." Results obtained with real log data showed that the new algorithms are sensitive to gas density and the excavation effect. The variation in the shape of invasion profiles corresponded with changes in rock and fluid parameters. Steep profiles were found for high porosity rocks, more gentle profiles for low porosity rocks, and very shallow profiles in shales. Sloping invasion models not only improve the accuracy of porosity and saturation calculations, but in combination with a fluid flow model, are expected to give more accurate permeability estimates.