The 3D direct pulse width modulation (PWM) for three-leg centre-split voltage source inverters (VSIs) and four-leg VSIs is proposed in this paper. It can be applied to these VSIs from two-level to multi-level systems. The generalized 3D direct PWM implements the voltage synthesis in per-leg mode and it is based on the voltage second approximation as the conventional space vector modulation (SVM). As a result, it also has the merits of conventional SVM, such as a constant switching frequency, low output ripples, etc. However, the computational cost of the proposed 3D direct PWM is much lower than the SVM. The proposed 3D direct PWM is applied to control a four- leg inverter in an active power filter and a three-leg centre- split inverter in a hybrid filter in three-phase four-wire systems. Simulation results are provided to show the validities of the proposed 3D direct PWM.