Maxwell's Color Experiment Revisited

From Psych 221 Image Systems Engineering
Jump to navigation Jump to search

Introduction

This project explores James Clerk Maxwell's early color experiments. Our goal is to provide an intuitive understanding of his experiment and to convey the ingenuity of his color matching experiment.

Background

In 1993, Qasim Zaidi authored a commentary on Maxwell's 1860 paper, highlighting his contributions to trichromatic theory, traditionally attributed to Helmholtz and Thomas Young. While Maxwell's original paper is detailed, it is challenging to follow.

An interactive color matching experiment from Stanford's Computer Science department provides insight, but it doesn't capture the nuances of Maxwell's use of white as the sole target color.

This project reinterprets Maxwell's experiment in an interactive style, inspired by Bartosz Ciechanowski, New York Times Interactive Stories, and 3Blue1Brown.

Methods

The webpage was written in Typescript and React.

In order to recreate Maxwell's the color matching experiment, we needed to work between different color spaces.

Specifically, the following process was followed:

  1. Convert slit position to wavelength (nm)
  2. Convert wavelength into XYZ values using CIE's Colorimetry Report
  3. Add the weighted XYZ values from the 3 slit positions in XYZ space
  4. Convert from XYZ to sRGB using a linear transformation
  5. Apply gamma correction
  6. Clip out of gamut colors
  7. Render the rgb values in the webpage

Unfortunately since the actual color experiment with colors which are at the horse-shoe shaped border of the chromaticity diagram, many of the colors are out of gamut, so we are only able to create an illusion of the experiment. Due to color gamut limitations, we adjusted the white target value from pure white to a slightly gray shade for a more realistic experiment.

Results

Screenshot of the an interactive version of Maxwell's tool

The current version of the interactive website is available at: https://maxwell-color-experiment.vercel.app/

Koh is in the process of sophisticating the content over the winter break before opening up the website to the public. Any updates will also be reflected onto this Wikipedia page.

Conclusions

I thoroughly enjoyed working on this project. A few things stood out to me in particular.

I gained quite an intuitive understanding of how color matching experiments work and the trichromatic theory. Throughout this project, I was impressed by Maxwell's ingenuity to setup this experiment, to execute, and to get results that are astonishingly close to CIE's color matching functions.

In the actual execution of this project, I got a better understanding of color spaces, converting between different color spaces, and understanding the limitations of color gamuts on our monitors. Although I worked on color space conversion during some of the class assignments, when it came to actually attempting to rebuild Maxwell's experiment, I had to think about what was going on at every step of the way, and furthermore, think about how is the most truthful way to represent certain colors to the users in the interaction.

I think that there's a lot of additional directions a similar project can go. Some ideas can include:

  • Recreating Maxwell's earlier color wheel experiment
  • Trying to actually physically build this apparatus
  • Trying to write a simulation to get an even more intuitive understanding of how the slit positions affect the light being diffracted by the prisms
  • Understanding what the lens element does in this setup
  • A more thorough explanation and investigation on why the full experiment cannot be replicated on a computer screen

References

Appendix

Source code is currently in a private repository on Github. I will make the repository public and link to this Wikipedia once the codebase is organized. (It is too messy to open to the public at the moment).

I am more than happy to share the codebase. If you would like to take a look before I make it public, please send an email to kohterai@stanford.edu I will add you as an additional contributor to the repository.