In the talk we will present a cone beam inversion formula which applies to general x-ray source trajectories and depends on a fairly arbitrary weight function n. By construction, the formula is theoretically exact and is represented by a two-dimensional integral. At the outset it neither has the filtered backprojection (FBP) structure nor the filtering step is shift-invariant. We show that if the source trajectory is complete (and satisfies two other very mild assumptions), then the simplest uniform weight gives a convolution-based FBP algorithm. This choice is not always optimal from the practical point of view. Uniform weight works well for closed trajectories, but the resulting algorithm does not solve the long object problem if C is not closed. In the latter case one has to use the flexibility in choosing n and find the weight that gives an inversion formula with the desired properties. It turns out that two algorithms for spiral CT proposed earlier by the author are particular cases of the new formula. As a further application of the general inversion formula we present a 3PI algorithm for spiral CT, which is theoretically exact and of the FBP type with shift-invariant filtering.