The article presents a new approach to the analysis of light propagation in photorefractive materials. The discussed numerical method can be used for an analysis of the dynamics of nonlinear effects taking place in those media in which an analytical approach requires the use of approximations or is impossible. As an example of how the method works, the results of simulation are shown, illustrating the process of spatial solitary wave formation in two materials: a photorefractive semiconductor and a ferroelectric crystal.