Granularity and inhomogeneity are the joint generators of optical rogue waves