For something to be sinful, the person must both know that it is sinful and freely will to do it.
Anything that diminishes free will in the commission of an act, diminishes guilt. For example, if a person is under duress of fear for his life, or the lives of persons he loves, he may say and do things which are wrong in themselves, but his personal guilt is mitigated if not totally extinguished.
A wrong act committed while half-conscious or under the influence of drugs or alcohol does not have the same level of sinfulness as an act committed while fully in command of oneself. For example, if a person robs a bank while he is drunk, or commits murder,he is not guilty to the same extent as he would be otherwise. Of course, if he knows that for him getting drunk will lead to robbery or violence, then of course in willing to get drunk or acquiesing in it, he is guilt of all that will follow from his choices.
There are many people who use artifical birth control, which is wrong in itself, but they do not know that it is wrong. Materially this is sinful, but formally not. In other words, there is sinful matter, but because of inadequate instruction or reflection the person committing these acts has no idea that he is offending God.
The Church limits herself to saying that this or that is wrong in principle, is a sin, but does not make judgements about anyone's personal culpability.