Metal rich environment crucial for light giant planets, but not necessary for heavy giant ones