AFAIK .50 cal rounds back than (could) have an incendiary element. Probably zirconium powder in the base of the projo. That'll cause a flash on impact.
Rounds like the 30mm API are pyrophoric, meaning that when the DU gets super heated on impact it acts like an incendiary element (basically what Sobek said). A more standard AP round, like those that would have been belted on the P-51 in WWII would be a hardened steel(?) penetrator with a milid jacket. They probably wouldn't spark without an incendiary element unless they hit hardened armor
Edit: Incendiary rounds of p-51 vintage probably didn't use zirconium, and whatever incendiary element was used wouldn't have been in the base of the projo but rather the tip