Why do light sources appear as stars sometimes?
See for example this photo:
From my experience, the longer the exposure the stronger can this effect be observed. Is this correct? Are there any other factors that influence the creation of these stars (is there a better word for it, by the way?) And what exactly does technically happen?
This appears to be a beautiful example of Fraunhofer diffraction. It is due to the wave nature of light. The effect depends on the wavelength (that is, the color). It is most pronounced when bright light from a practically infinite distance passes through narrow slits, causing the light to spread perpendicular to the slits. This spreads a point-like beam of light into a pair of streaks.
Using a small aperture creates slit-like situations at the corners formed by adjacent blades. Thus, when you have a combination of relatively intense, pointlike, monochromatic light sources in the image and a narrow aperture, you should see a streak (of the same color) emanating from the points in two directions perpendicular to the blades. When your diaphragm is formed by straight blades, this will cause there to be twice as many streaks as blades. However, the streaks for parallel blades will coincide. Thus, for a diaphragm with an odd number of blades (where no two blades are parallel) there will be twice as many radial streaks as blades but for a diaphragm with an even number of blades (where opposite blades are parallel) the streaks overlap in pairs, giving the same number of streaks as blades (but each streak is twice as bright).
A classic example is shown in the first image in the Wikipedia article on diffraction, for Fraunhofer diffraction through a square aperture. You see four well-defined streaks.
We should expect a certain amount of diffraction always to be present. It is usually slight and averaged out in most pictures: it just contributes a tiny amount to the blurriness that is present in any image when looked at closely enough. Only in images that bring together several factors--points of intense monochromatic light, small apertures, straight diaphragm blades--will it become prominent. This information shows how you can make the stars more prominent or how you can suppress them, by altering these factors for your exposure (to the extent you can).
Finally, length of exposure is related to the occurrence of this effect, as you have observed, but only because exposures with bright points of light are almost always made much longer than needed to record the lights: you're trying to see the rest of the scene, which is much darker. The brightness of the diffraction streaks decreases so rapidly away from their sources that if you used a sufficiently short exposure to properly expose the lights themselves, the streaks would be practically invisible. For instance, there are dimmer but still prominent light sources in your background: they look like windows in the far distance. They, too, must have their own streaks, but those streaks are too dim to see. (Appropriate software filtering might be able to bring them out.)
This isn't due to fraunhofer diffraction, but merely diffraction. The diffraction integrals are very difficult to solve, so there are two cases that make them simpler; the fresnel diffraction integral for moderate distances, and the fraunhofer diffraction integral for far distances. In this case, the fraunhofer diffraction integral will give an incorrect solution, because the detector is very near to the source of diffraction (the aperture). The fresnel calculations would have to be done, or possibly the complete calculation depending on the elements behind the aperture stop.
@Brandon Your clarification is most welcome, but I'm having trouble squaring it with popular descriptions of Fraunhofer diffraction, such as the one on Wikipedia: "In optics, the Fraunhofer diffraction equation is used to model the diffraction of waves when the diffraction pattern is viewed at a long distance from the diffracting object, and also when it is viewed at the focal plane of an imaging lens." That latter qualification would seem to apply explicitly to an image captured by a camera.
@whuber see my answer. Whether you use the fraunhofer or fresnel integral here is not actually all that important to the starburst effect, but will matter for how bright the center intensity peak is, and the distribution of energy in the streaks.
@Brandon Right. So why are you making a big deal about it? Is your objection solely to the use of the word "Fraunhofer"? Or does it have some substance related to an aspect of my explanation? If so, what aspect(s) do you think ought to be modified to make the explanation clearer or more correct?
@whuber If I wanted to make your answer more correct I would delete most of it.
@Brandon Thank you; that makes it clear where you stand. No point in attempting a constructive dialog then.
@BrandonDube sorry, you are incorrect. This effect is *much* more accurately modeled by Fraunhofer diffraction. The confusion here is that although the observation distance is *techincally* short (i.e., apparently in the Fresnel regime), because the lens is focusing the plane waves to a common point (the focal plane), the viewing distance is effectively the same as viewing at infinity. See the ["Focal plane of a positive lens"]https://en.wikipedia.org/wiki/Fraunhofer_diffraction#Focal_plane_of_a_positive_lens section of the WP article on Fraunhofer diffraction.
@scottbb the fresnel integral will never be 'less accurate' than the fraunhofer integral. The addition of the quadratic phase term when x and y are very very small is appreciably zero. If you include them when x and y are very very small, the result appears the same as the fraunhofer integral.
@BrandonDube You're right, I chose my words poorly. Saying the effect is "*much* more accurately modeled by Fraunhofer diffraction" was wrong: the Fresnel integral is always more precise than the Fraunhofer integral. I should have said that in photography, diffraction spikes such as in the OP (or in Matt Grum's answer) are always in the far-field (i.e., Fraunhofer) regime, for the reason that the observation (image) plane is *effectively* the same as viewing at infinity (i.e., having a small Fresnel number).