Sometimes direct sunlight or spotlight appears hexagonal on photos/videos. What is the origin of this artifact?
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It only takes a minute to sign up.Sign up to join this community
Out of focus points of light take on the shape of the lens aperture. It is a hexagon in this case, because the lens iris is made up of 6 regular blades.
There is no rule that it has to be a "regular" shape. If your aperture shape is irregular, then out of focus points of light will take on the irregular shape, and you can take advantage of this for creative effect, as shown here with star-shaped and heart-shaped points of light:
The origin of what you call an artifact in that photo is two-fold:
A word about safety:
Unless the sun is very low on the horizon it is dangerous, both to your equipment and your vision, to point your camera directly at the sun and look through the viewfinder or attempt to see your camera's LCD with the sun directly behind it. The higher the lens' magnifying power (the longer the focal length and the narrower the angle of view) the more this is the case. Please be careful when photographing the sun!
Unlike bokeh, there is not a direct relation between the number of blades and the number of streaks on the light source that you see. The "streaking" is caused by diffusion and diffraction. And as such a 5 bladed lens will cause 10 streaks rather than 5, as seen here: https://brtthome.files.wordpress.com/2017/02/p1350004-1.jpg
To understand this relationship, imagine drawing a line from one corner of your apeture to the opposite side. If the opposite side have a corner, the line drawn from that corner will be the same. As such a triangle aperture will have 5 lines, a square apeture will have 4, and 5 bladed will have 10. Here is a diagram to explain: http://chemaguerra.com/images/unit/ut_glare_patterns.png
But once you start to factor in things like optical misalignment, coatings and dirt on the lens you can get some patterns that are not even like this.