NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

Try It in NetLogo Web


This simulation models the probability of the number of photons absorbed by rods within the retina. The threshold of human vision is characterized by the minimum number of photons required to elicit a visual effect in the brain. Photons must enter through the layers of the eye before probabilistically triggering the visual transduction pathway. Through modelling this pathway in NetLogo, a better understanding of the variables involved in this process can be obtained, allowing the simulation to be used as a teaching tool. Our model accounts for changes in vision underwater by enabling the user to manipulate depth which alters light intensity and pupil diameter.

Our model was based on the Hecht et al. (1942) experiment, where the threshold energies for vision of the human eye were determined.

Hecht, S., Shlaer, S. and Pirenne, M.H., 1942. Energy, Quanta, and Vision. _Journal of General Physiology_, 25(6), pp.819–840.


At each tick, the photons move forward and have a chance of being absorbed, depending on the layer of the eye they are situated in. When a photon gets absorbed by a rod, it turns the rod yellow, indicating it is stimulated. If the necessary number of rods are stimulated for a given burst of photons, there is a visual response.


Before clicking any buttons on the interface, adjust sliders as desired. Set the average number of photons sent per burst using the ‘avgphotons’ slider. Adjust the width of the light beam in millimetres using the ‘beamwidth’ slider. You can also adjust the pupil diameter in millimetres using the “Pupil’ slider, which can simulate how the eye responds to different light levels. The ‘n’ slider sets the minimum number of rods that must be stimulated for a visual response to occur. The eye will need to have n photons absorbed by the retina for the burst of light to be seen. For underwater mode exclusively, you can set the depth of the eye below sea level (in metres) using the ‘depth slider’ which will also adjust pupil size and the intensity of light that reaches the eye.

Once the sliders have been adjusted, push the ‘Setup’ button to set up the model which includes drawing the structure of the eye and generating starting photons. If you would like to simulate underwater vision, select the ‘Underwater’ button after ensuring the depth is set. This button automatically sets the average number of photons to be 1000 to represent a high amount of photons from sunlight at sea level. It also sets the absorption value of the water and the pupil diameter to match the chosen depth.

There are two different go procedure buttons on the interface: ‘Burst’ or ‘Repeat’. To run the model once, press the ‘Burst’ button. This sends a single burst of photons towards the retina, the number of which is determined by a Poisson distribution centred at the average photons set on the ‘avgphotons’ slider. If you want to run this procedure again, press ‘Setup’ first. To run the model for 10 cycles, press the ‘Repeat’ button. This will reset the simulation when ticks = 600 (the length of one cycle). It will clear all paths drawn by photons, stimulated rods and variables, while maintaining the plots to allow for the collection of data when resetting the world.

This simulation also has an experiment set up using the ‘BehaviorSpace’ tool that mimics the Hecht et al., 1942 paper. First press ‘Setup’ and then go to Tools>BehaviorSpace (shift + command + B). You can then run the experiment labelled ‘Hecht et al. (150 runs)’ which runs 10 cycles of ‘Burst’ with the experimental setup. We will run 10 cycles of ‘burst’ with the experimental setup. The average photon count will start at 20 and increase by 40 until 300 photons. The diameter of the pupil was set to 8 mm, to simulate the ‘complete dark adaption’ for at least 30 minutes in the dark before the experimenters started to record data. The beam of light was set to 10 mm to simulate a large enough band of light that will consistently allow all the photons to enter the pupil. To view full plotting on the interface graphs change ‘simultaneous runs in parallel’ to 1, rather than the suggested number by NetLogo. This experiment uses the experimental setup procedure differs slightly from the regular ‘setup’ since it ‘clears-drawing’ and ‘clear-turtles’ after each burst of light sent. Within the experiment, the number of average photons was represented by ‘avgphotons’.

You can tell if a signal has been sent if a lightning bolt appears on the right side of the screen. There will also be a message displayed in the output on the output monitor in the interface saying ‘Visual Response’ if a signal has been sent, or ‘No Visual Response’ if not enough rods were stimulated.

The monitors on the interface help quantify what is occurring in the simulation. The ‘Photons Absorbed’ monitor indicates the number of photons that are absorbed and will increase during one run of the simulation. The ‘Photons at Retina’ monitor updates once the photons enter the zoomed-in retinal window on the right-side of the interface with the number of photons present. ‘Rods Stimulated’ updates with the number of rods stimulated per burst sent. When ‘Repeat’ is selected, the ‘Cycles’ monitor updates with how many cycles are completed.

The ‘Photons vs Time’ plot displays the number of photons present with respect to time. When running ‘Repeat’, the plot continues to update with each run being represented in grey and a blue line traces out the average of the runs completed. The ‘Rods Stimulated vs Average Photons’ places a point at the number of rods stimulated for a given average number of photons at the end of each cycle.


**‘Setup’ Button**
Notice how the ‘Photons Absorbed’ monitor changes as the beam moves across the interface.
Why do some photons travel straight through the eye without refracting? Think about approximations that can apply to a lens.

Given how it behaves in the model, what do you think is the purpose of the retinal epithelium layer (the darkest blue rectangle in the zoomed in window on the right)?

Watch how the number of photons change with time on the ‘Photons vs Time’ graph.

What does the blue line on the graph trace out? Think about how it changes as the simulation repeats with the ‘Repeat’ button.

**‘Underwater’ Setup Button**
Watch how the photons change direction as they enter different layers of the eye (ex. surrounding media, cornea, humours, lens). How does this vary between the regular setup and underwater setup?

How does the number of photons absorbed in the water media change with depth? Does this increase or decrease?

How do the goggles affect the incident beam of light?

Why would you need so many more initial photons for the underwater setup?


Test different depths with the slider in the ‘underwater’ mode. What do you notice? How does the pupil or absorption of photons change with depth?

Test different amounts of average photons. How does the number of photons emitted from the light source affect the production of a visual response?

Change the ‘n’ slider. How does adjusting the number of rods activated to produce a visual response, change the frequency of visual responses? How does it change the number of average photons that are required to be emitted?


Add cones to create a more accurate retinal mosaic to account for colour vision.

Consider different wavelengths of light, by adding a slider to allow for the user to change the light conditions. Also, allow the refraction and absorption patterns to be changed by an adjustment in wavelength.

Try a different test patch on the retina, with respective rod and cone densities, that may have a lower or higher sensitivity to light.

Allow the user to change the angle of the light beam.

Account for the case where two photons simultaneously stimulate the same rods. As of right now, it counts this as two rods stimulated.

Try replacing the light beam with an object. This means the lens may have to change shape (different radii of curvature) depending on the object’s distance from the eye.

Account for how the pupil diameter changes with depth according to literature values.


**Models Referenced:**
* Radioactivity: “Decay”
* “Plotting Example”

[NetLogo Library](


**This Model was Inspired by the Journal Article:**
Hecht, S., Shlaer, S. and Pirenne, M.H., 1942. Energy, Quanta, and Vision. _Journal of General Physiology_, 25(6), pp.819–840.

**NetLogo Simulation Citations:**
Wilensky, U., 1999. NetLogo (6.3.0). [computer program] Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. Available at:

For literature values, description of process, and full citation list:
[Full Model Documentation](


For use of this NetLogo model, we ask that you cite the publication following the below format.

**To cite the 'Light to Brain' model specifically:**
Davidson-Lindfors, N. and Dykstra, J. (2023). NetLogo Light to Brain model. School of Interdisciplinary Science, McMaster University, Hamilton, ON.

**To cite the NetLogo software:**
Wilensky, U. (1999). NetLogo. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

(back to the NetLogo User Community Models)