The pupillary light reflex (PLR) is a reflex that controls the diameter of the pupil, in response to the intensity (luminance) of light that falls on the retina of the pupil and the eye, thereby assisting in adaptation to various levels of lightness/darkness. A greater intensity of light causes the pupil to constrict (miosis/myosis) (allowing less light in), whereas a lower intensity of light causes the pupil to dilate (mydriasis, expansion) (allowing more light in). Thus, the pupillary light reflex regulates the intensity of light entering the eye.
The pupillary light reflex pathway has an afferent limb (CN II) and efferent limb (CN III). The ganglion cells of the retina project bilaterally to the pretectal nuclei. The pretectal nuclei projects crossed and uncrossed fibers to the Edinger-Westphal nucleus, which gives rise to the preganglionic parasympathetic fibers. These fibers exit the midbrain with CN III and synapse with postganglionic parasympathetic neurons of the ciliary ganglion, which innervates the sphincter muscle of the iris.
The optic nerve, or more precisely, the photosensitive ganglion cells through the retinohypothalamic tract, is responsible for the afferent limb of the pupillary reflex - it senses the incoming light. The oculomotor nerve is responsible for the efferent limb of the pupillary reflex - it drives the muscles that constrict the pupil.
The pupillary reflex pathway begins with the photosensitive retinal ganglion cells, which convey information to the optic nerve (via the optic disc). The optic nerve connects to the pretectal nucleus of the upper midbrain, bypassing the lateral geniculate nucleus and the primary visual cortex.
These "intrinsic photosensitive ganglion cells" are also referred to as "melanopsin-containing" cells, and they influence the circadian rhythms and the pupillary light reflex.
Pupillary Light Reflex is modeled as a physiologically-based non-linear delay differential equation that describes the changes in the pupil diameter as a function of the environment lighting:
where is the pupil diameter measured in millimeters and is the luminous intensity reaching the retina in a time , which can be described as : luminance reaching the eye in lumens/mm2 times the pupil area in mm2. is the pupillary latency, a time delay between the instant in which the light pulse reaches the retina and the beginning of iridal reaction due nerve transmission, neuro-muscular excitation and activation delays. , and are the derivatives for the function, pupil diameter and time .
Since the pupil constriction velocity is approximately 3 times faster than (re)dilation velocity, different step sizes in the numerical solver simulation must be used:
where and are respectively the for constriction and dilation measured in milliseconds, and are respectively the current and previous simulation times (times since the simulation started) measured in milliseconds, is a constant that affects the constriction/dilation velocity and varies among individuals. The higher the value, the smaller the time step used in the simulation and, consequently, the smaller the pupil constriction/dilation velocity.
In order to improve the realism of the resulting simulations, the hippus effect can be approximated by adding small random variations to the environment light (in the range of 0.05 Hz to 0.3 Hz) as proposed by.
In addition to controlling the amount of light that enters the eye, the pupillary light reflex provides a useful diagnostic tool. It allows for testing the integrity of the sensory and motor functions of the eye.
Under normal conditions, the pupils of both eyes respond identically to a light stimulus, regardless of which eye is being stimulated. Light entering one eye produces a constriction of the pupil of that eye, the direct response, as well as a constriction of the pupil of the unstimulated eye, the consensual response. Comparing these two responses in both eyes is helpful in locating a lesion.
For example, a direct response in the right pupil without a consensual response in the left pupil suggests a problem with the motor connection to the left pupil (perhaps as a result of damage to the oculomotor nerve or Edinger-Westphal nucleus of the brainstem). Lack of response to light stimulation of the right eye if both eyes respond normally to stimulation of the left eye indicates damage to the sensory input from the right eye (perhaps to the right retina or optic nerve).
Emergency room physicians routinely assess the pupillary reflex because it is useful for gauging brain stem function. Normally, pupils react (i.e. constrict) equally. Lack of the pupillary reflex or an abnormal pupillary reflex can be caused by optic nerve damage, oculomotor nerve damage, brain stem death and depressant drugs, such as barbiturates.
Normally, both pupils should constrict with light shone into either eye alone. On testing each reflex for each eye, several patterns are possible.
The pupillary response to light is not purely reflexive, but is modulated by cognitive factors, such as attention, awareness, and the way visual input is interpreted. For example, if a bright stimulus is presented to one eye, and a dark stimulus to the other eye, perception alternates between the two eyes (i.e. binocular rivalry): Sometimes the dark stimulus is perceived, sometimes the bright stimulus, but never both at the same time. Using this technique, it has been shown the pupil is smaller when a bright stimulus dominates awareness, relative to when a dark stimulus dominates awareness.  This shows that the pupillary light reflex is modulated by visual awareness. Similarly, it has been shown that the pupil constricts when you covertly (i.e. without looking at) pay attention to a bright stimulus, compared to a dark stimulus, even when visual input is identical.  Moreover, the magnitude of the pupil light reflex following a distracting probe is strongly correlated with the extent to which the probe captures visual attention and interferes with task performance. This shows that the pupillary light reflex is modulated by visual attention and trial-by-trial variation in visual attention. Finally, a picture that is subjectively perceived as bright (e.g. a picture of the sun), elicits a stronger pupillary constriction than an image that is perceived as less bright (e.g. a picture of an indoor scene), even when the objective brightness of both images is equal.  This shows that the pupillary light reflex is modulated by subjective (as opposed to objective) brightness.