Hitting an enemy directly will always allow maximum damage for two reasons:
- The closer the target is to the center of the explosion the more splash damage they'll take
- Some explosive weapons (shotguns, pistols, spiniguns) deal "bullet damage" in addition to splash damage, nearly doubling the listed damage output from the item card. A direct hit is the only way to deal the bullet damage, so hitting the shield/terrain will never add the bullet damage. Bullet damage is usually higher than the highest possible splash damage, and as a bonus it can deal critical damage (splash damage only weapons like Rocket Launchers can't deal crits)
Failing that I think shooting the terrain near the target usually does more damage than hitting the shield itself, but I've never watched the difference between those two options that closely. What I personally do is attempt to shoot the feet/hands/head of a target as they peek out from under the shield, in that order of preference. Feet are usually best since if you hit, you hit, but if you miss you'll probably hit the ground/shield close enough to deal some splash damage. While headshots do the most damage on hit, they're pretty unreliable unless you have a very accurate weapon; explosive weapons are rarely super accurate in BL2.