Abstract A numerical method providing the optimal laser intensity profiles for a direct-drive inertial confinement fusion scheme has been developed. The method provides an alternative approach to phase-space optimization studies, which can prove computationally expensive. The method applies to a generic irradiation configuration characterized by an arbitrary number $N_{B}$ of laser beams provided that they irradiate the whole target surface, and thus goes beyond previous analyses limited to symmetric configurations. The calculated laser intensity profiles optimize the illumination of a spherical target. This paper focuses on description of the method, which uses two steps: first, the target irradiation is calculated for initial trial laser intensities, and then in a second step the optimal laser intensities are obtained by correcting the trial intensities using the calculated illumination. A limited number of example applications to direct drive on the Laser MegaJoule (LMJ) are described.