It’s mostly warmth on your torso that protects you from getting wet.
If you’re not carrying an umbrella, the protection from rain is 4/5 * torso warmth + 1/5 * head warmth.
Light rain (drizzle) results in up to 30 - protection “points” of saturation. Heavy rain (any other than drizzle) 60 - protection.
That means if you get a total of 60 rain protection, you’re immune to all rain.
Morale penalty is up to saturation/2
If you’re wearing a rainproof item, you resist rain with 99% chance, rolled per turn.
If all the body parts that would get wet are waterproof, you don’t get wet. Unless you’re in deep water - then nothing is waterproof.
Rain wets head, torso and arms, unless you’re carrying an umbrella - then it wets legs and only legs (note: without umbrella it doesn’t wet legs).
There are water friendly items. If ALL the bodyparts that would get wet are covered only in water friendly items, there will be no morale penalty and instead a morale bonus. This bonus depends on how many parts would get wet, on ambient temperature and on saturation.
If not all wet parts are water friendly, mutations are counted. Note: if even a single wet item isn’t water friendly, the entire morale penalty applies. 99% water friendliness isn’t enough.
If not all items are water friendly, you can still get morale bonus from mutations. If you get morale bonus from mutations, water friendly items do not help at all, however if you need items to reach water-friendliness (mutations aren’t enough), mutations still can give a boost.
Some mutations give bonus, other negate penalty and finally some negate both the morale bonus and penalty. Each of them can have separate values for different body parts.
Different body parts count more for morale bonus/penalty.
Some mutations make you retain water for shorter time (fur type, but only if you get a penalty from wetness), slimy mutation will make you retain it longer (but only if you are getting a bonus from it).
Regardless of whether you get a bonus or penalty, wetness decreases warmth provided by cotton and wool items.
There may be a possible bug: when carrying an umbrella, wearing light clothing (not warm) on torso and head and wearing warm clothing on legs, the rain may be drying rather than wetting. Though the part where not having an umbrella prevents legs from getting wet from rain is probably also a bug.
EDIT: Morale effect from wetness and actual wetness aren’t actually connected. Actual wetness only affects warmth provided by items, what I described above (except for the bug, which affects both) affects morale.