Determine percentage of visible part of a mesh from viewer point

Hi,

i dont know if the title is clear.

For example i have an enemy covered behind a defense.

Your character look at him.

How can i determine how much of the enemy is visible for your character.

Recently you can find this mechanic in Fallout 4.

With this mechanic i could determine the hit chance when your character shoot at this enemy.

I wanna create a battle system toolkit and this mechanic would help me a lot to combine different mechanics.

Has anyone an idea how to do this.

Thanks and cheers

raidfire.net