How heavy is the cannonball? (*)

You have 9 cannon balls, numbered 1 to 9. They are all exactly the same weight, except for one. You don't know which one this is, and you don't know how much heavier it is than the others.

You also have a single balance bar. You can put any number of cannon balls on either side, and it will either tip left, right or stay level. Thus you can find out whether one set of cannon balls is the same weight, lighter or heavier than another set.

How many weighs do you need to identify the heavier cannon ball?

Variant 1 As in the original problem, but you have 13 cannon balls. 12 are the same weight and 1 is an unknown amount heavier than the others.

Variant 2 As in the original problem, but you do not know if the “odd one out” is lighter or heavier than the others.