This question was difficult to word. Please edit if it can be worded better.
I've seen many murals and ancient drawing as far back as 3,000BC (Kemetian, Sumerian) of society wearing atleast some clothing to cover their genitals (and/or breasts of women). I've also seen primitive tribes of modern day, some who cover, some who are topless, and some who are totally naked.
What exactly was the origin and reasoning behind societies/civilizations adopting such clothing (i.e. covering a precise part of the body)?
I'm thinking before most common religions came into practice, that make covering obligatory.