Repository navigation
Home
Chromatophore Simulator explores how thousands of small, individually controlled pigment organs can produce a changing skin surface. It is inspired by the colour changes seen in cephalopods such as octopuses and cuttlefish.
The simulator is an experimental visual model rather than a detailed recreation of animal physiology. Its central idea is simple: each pigment organ can expand or contract, and their combined appearance creates a larger pattern.
The default patch contains 2,500 chromatophores. Each is a pigment organ whose visible size can change. The organs differ slightly in position and maximum size, with yellow, red, brown and very dark brown pigments distributed across the patch. Their positions and pigment identities stay fixed: a pattern appears because the organs expand and contract, not because they move around.
Choose a static pattern, such as spots or bands, or watch a dynamic display, such as a travelling wave or changing mottle. You can adjust how quickly organs respond, introduce a delay, and control how strongly each pigment group participates. That last control lets you change the balance of colours without changing the underlying pattern.
There are two ways to see exactly the same simulation:
- Chromatophore View shows individual pigment organs, making their changing sizes easy to follow.
- Skin View combines their colours with a pale, subtly reflective layer beneath them to suggest how the patch might look as skin.
Switch between views with Tab or the view buttons. The organs keep responding while you switch.
- Start the simulator. The cells gradually expand towards randomly chosen sizes.
- Press E to expand every cell, then C to contract them.
- Select Spots or Checkerboard and watch the pattern emerge.
- Press Tab to compare the individual cells with the skin appearance.
- Press T for Changing Mottle, which continually selects new mottled arrangements.
- Press Space to hold the current sizes.
The simulator starts with Natural timing, in which a typical organ completes about 99% of a requested change in a quarter of a second. Reduce the expansion or contraction rate to see slower transitions, or switch to Uniform timing to compare the different kinds of movement.
Buttons show their keyboard shortcuts. Settings buttons cycle through the available values; the browser explorer uses labelled selectors for some settings.
| Control | Key | Purpose |
|---|---|---|
| Expand all | E | Expand each pigment group to its selected level |
| Contract all | C | Contract all organs |
| Randomise | R | Give each organ a separate random target |
| Expansion / contraction rate | 1 / 2 | Set how quickly organs grow or shrink |
| Response delay | 3 | Delay their response to a target or moving signal |
| Display speed | 4 | Change how quickly a dynamic signal develops |
| Pigment levels | 5–8 | Adjust Yellow, Red, Brown and Black independently |
| Reset pigment levels | 0 | Return all four levels to 100% |
| Response timing | 9 | Switch between Natural and Uniform movement |
| Viewing / light angle | A / I | Change how the reflective skin layer responds |
| Reset angles | O | Restore both angles to 0° |
| Hold | Space | Stop the display and freeze organs at their current sizes |
| Switch view | Tab | Change between individual organs and skin |
| Exit | Esc | Close the desktop application |
Pigment levels range from 0% to 100% in 25% steps. They determine how strongly each pigment group responds to the chosen pattern or display. For example, reducing Brown and Black makes the warmer pigments more prominent. A level of 0% asks that group to contract; it does not remove the organs from the patch. All groups start at 100%, and the settings carry over when you choose another pattern. Reset pigment levels restores the controls, not full expansion.
Natural timing gives organs a quick, smoothly settling response, with modest differences between nearby groups. Uniform timing moves all organs at the same constant rate. Both applications begin with Natural timing and base rates of 4/s; lower rates slow the movement. The Chromatophore Model explains the distinction in more detail.
Selecting a static pattern, Expand, Contract or Randomise stops a running dynamic display. Changing a pigment level during a display does not restart it. Hold freezes the sizes the organs have actually reached, rather than saving the display for later resumption; subsequent pigment adjustments use those held sizes as their starting point. Switching views or changing reflection angles does not interrupt the display.
Skin View includes a reflective layer beneath the pigments, inspired by the iridophores in cephalopod skin. It produces a subtle blue-green sheen that can brighten, fade or shift towards blue and violet as the viewing and lighting directions change. The pigments above it still filter the light, so the effect is easier to see where the organs are contracted.
Use A to change the viewing direction and I to change the light direction, or use the corresponding controls. Each ranges from −60° to +60° in 15° steps. Imagine looking at a flat patch from the side: 0° is straight on, and positive angles point to the right. O resets both directions to 0°, the normal reference view.
Different parts of the reflective layer respond differently to these angles, but the patch itself remains flat on screen. Changing an angle doesn't rotate the patch, move any chromatophores or alter their response. You can even change the angles while Hold is active.
For a simple experiment, switch to Skin View, contract the organs with C, then adjust the viewing and light directions independently. The effect is an illustrative approximation of structural reflection, rather than a reconstruction of measured cuttlefish optics.
The application requires Python 3.14 or later and a graphical desktop. From the project folder on macOS or Linux:
python3 -m venv venv
source venv/bin/activate
python -m pip install -e .
chromatophore-simulatorOnce installed, python -m chromatophore_simulator is an alternative launch command. The graphical dependency is Pygame Community Edition, installed automatically with the project.