Those are artifacts of having obstructions in the optics. Ideally, we think of the intensity being recorded as the (squared magnitude of the) Fourier transform of the wavefront passing through the aperture. That is, whenever a wavefront is brought into focus, it undergoes a Fourier transform (in the [Fraunhofer limit](http://en.wikipedia.org/wiki/Fraunhofer_diffraction)).

This transform is affected by the aperture, which excludes any part of the wavefront outside a certain range. Indeed for a circular aperture, the Fourier transform of a uniform light source is the familiar [Airy pattern](http://en.wikipedia.org/wiki/Airy_disc). Convolving an ideal image (made with an infinite aperture) with the Airy function results in the familiar [bloom](http://en.wikipedia.org/wiki/Light_bloom) seen in photographs of bright light sources.

Many camera apertures, however, use polygons for ease of manufacturing, and so bright sources are convolved with a more complicated function, which can result in your rays. You should take a look at [this paper](http://www.mpi-inf.mpg.de/resources/lensflareRendering/pdf/flare.pdf), which discusses simulating these effects and more, since the prevalence of film and photographs in the modern world makes these artifacts almost necessary to lend realism to an image, despite the fact that they are rarely seen with our own eyes. Figure 3 in particular shows a camera aperture, and Figure 5 shows the relation to the Fourier transform.

Other obstructions within the aperture can cause similar effects. For telescopes with a secondary mirror or other installment in the optical path (a very common design), the object and its support struts have their Fourier transforms affect the image. The thin struts in particular case noticeable artifacts, even in Hubble images, as can be seen in the wiki on [diffraction spikes](http://en.wikipedia.org/wiki/Diffraction_spike).