The numerical study of the dynamics of shock compression pulses in polymethylmethacrylate (PMMA) and aluminum is performed in both viscoelastic and hydrodynamic approximations. The Maxwell relaxation model with two parameters, the relaxation time and the static yield strength, is used for both materials for a description of their viscoelastic properties. Constant values of the parameters suffice for a description of shock-wave profiles in the case of PMMA, while changes of these parameters in the course of deformation are needed to be taken into account in the case of aluminum. A method of accounting of such changes is proposed based on the kinetic equations for mobile and immobilized dislocations. The proposed approach lets us take into account the main features of the elastic precursor in aluminum, as well as its change with distance and target temperature. The approach by its complexity and accuracy lies between the simple relaxation models and the complete dislocation-based ones. Using the proposed models, we investigate the influence of stress deviators on the change of compression-pulse amplitude with the propagation distance inside the material. The shock pulse in the viscoelastic approximation has greater amplitude in comparison with the hydrodynamic one for low distances due to higher stiffness and conversely at larger distances due to the greater velocity of propagation of the unloading wave that overtakes the shock wave front. The maximum difference between two approximations in the value of the shock pulse amplitude is about 35% for PMMA and about 90% for aluminum.