An essential step towards optimizing and automating radiation therapy treatment planning is to develop an effective algorithm to find the optimal beam weights and wedge filters for a given set of beam directions and modalities. This problem is solved by introducing a variable transformation based on the universal and omni wedge principles. Instead of directly optimizing an objective function with respect to wedge angles and orientations, each field is first decomposed into a superposition of an open field and two orthogonal wedged fields. This transforms the problem of finding J beam weights, wedge angles, and orientations to that of optimizing a system with 3J beam weights (J open beams and 2J nominal wedged beams), where J is the total number of incident beam directions. An iterative algorithm based on a method originally developed for image reconstruction is used to find the 3J beam weights. The technique is applied to a few clinical cases. Treatment plans are improved compared to those obtained through the conventional manual trial and error planning process. In addition, planning time and effort are greatly reduced.