Rendering the Visible Spectrum
141 points by signa11 4 days ago | 26 comments

mark-r 10 hours ago
There's something that tends to go unrecognized, a function of the way our monitors work. Any color that is made of multiple primaries, such as magenta, cyan, or yellow, will naturally be brighter because more photons are emitted from the display. Not twice as bright, since our eye response is non-linear, but noticeably brighter.
reply
crazygringo 9 hours ago
Yup. This is precisely why the first image seems to have oscillating brightness, with clear sharp peaks at yellow and cyan. It's because it's not just changing color, it's literally twice as much light. It goes:

  Red - 1x
  Yellow - 2x
  Green - 1x
  Cyan - 2x
  Blue - 1x
  Magenta - 2x
(Of course magenta is not part of the spectrum.)

A very first step towards a better spectrum is just to maintain constant output brightness (accounting for gamma). There will still be perceptual differences in brightness, as we naturally perceive green as brighter than blue.

Obviously this gets taken into account by the time the author gets to the CIE color model. But there are a number of "intermediate" improvements like that, which you can make.

reply
ranger_danger 6 hours ago
Most monitor reviews I've seen measure levels for black, white AND grey.
reply
quietbritishjim 13 hours ago
> The final piece of the puzzle is gamma correction. Applying gamma correction to these RGB coordinates produces a new set of values which we call (R', G', B') that are related to the original by a transfer function 6 ... The reason this is done is to account for how our eyes perceive brightness nonlinearly. We can distinguish changes in dark shades much more easily than light shades because a linear increase R in has much more of a relative effect when R is small. Switching to (R', G', B') therefore provides more resolution in dark regions of the image where the eye is more sensitive to variations in brightness.

I'm surprised that this isn't mentioned much earlier and much more prominently. Instead, it's practically a footnote.

Maybe I'm mistaken, but I would bet 90% of the awkwardness in the very first image is from averaging these values (R', G', B') for the gradients rather than switching to the true linear values, averaging, then converting back. This classic MinutePhysics video covers it well:

https://www.youtube.com/watch?v=LKnqECcg6Gw

reply
crazygringo 9 hours ago
Probably the biggest distortion in the first image comes from ignoring output brightness:

https://news.ycombinator.com/item?id=47047866

Next I'd guess is correctly mapping wavelength to raw RGB ratios, and then third would probably be gamma.

Since that would be the "good enough" approach for most people, I wish a could see a comparison of that with the author's CIE-based results.

reply
strogonoff 9 hours ago
It is very interesting that whereas an incandescent lightbulb and a white LED (e.g., that Macbook screen) appear to us the same colour, their underlying spectra are very different (a solid black body radiation spectrum from the former and a choppy one from the latter).

I vaguely recall this is also known to cause a phenomenon where certain material can appear a false colour under certain light (especially a problem in case of, say, physical paintings and their various pigments), if whatever bands it reflects would align with the spectrum of emitted light in an unfortunate way.

(NB: even though the topic is relevant to his field of work, the author of the paper is not the digital videographer and YouTuber Brandon Li.)

reply
zokier 7 hours ago
Metamerism is closely related topic: https://en.wikipedia.org/wiki/Metamerism_(color)
reply
BoxOfRain 8 hours ago
I miss the low-pressure sodium street lights that used to be ubiquitous in Britain. The light was virtually monochromatic, which created a very specific aesthetic at night. Modern white LEDs feel more like a bad approximation of day rather than embracing the idea night should look different I think.

LEDs are much more flexible with colour anyway, we should have tried to keep some visual continuity rather than going straight for the harsh high-K white in my opinion.

reply
strogonoff 8 hours ago
Not just aesthetically more pleasing but allegedly[0] healthier for wildlife.

[0] https://pubmed.ncbi.nlm.nih.gov/26311159/

reply
mncharity 2 days ago
> The right approach would have been to select a color appearance model (CIECAM02 is the standard), convert all our colors to this coordinate system, do the mixing in this coordinate system and then convert back to RGB. That being said, I did not want to deal with all the extra complexity that would have come along with this. Instead, I opted for a much simpler approach.

Python's nice `colour` package supports several color appearance models.[1]

[1] https://colour.readthedocs.io/en/master/colour.appearance.ht...

reply
mncharity 22 hours ago
But I'm glad for the ground-truthy approach taken. I suggest a pattern, of interesting data being unavailable, because it doesn't align with incentives around science or commerce. Often it exists, just sitting on someone's disk, because they think no one is likely to care.
reply
enriquto 17 hours ago
These wavelength-indexed spectra always seem a bit weird... the blue is so cramped! When you plot them by frequency they feel just right. We say "ultraviolet" and "infrared" for a reason; never "infraviolet" or "ultrared".

It's like a piano that had the high notes to the left.

reply
hallole 10 hours ago
> we write the color associated with a spectral distribution as C[S] where C is the function that takes a distribution and outputs the corresponding color.

Unrelated, but can anyone tell me the purpose of using the square bracket notation here, instead of the usual parentheses?

reply
Sharlin 9 hours ago
Square brackets are often used in contexts where the function is "higher-order" in some sense, with the type of the parameter itself being a function, distribution, or a similar object with richer structure. I think in this case C[S] is particularly supposed to evoke the expected-value notation E[X], because that's what C[S] essentially is – it gives the expected value of S if you interpret S as a random variable with that distribution.
reply
encomiast 6 hours ago
One thing peculiar about the final image is how desaturated it is. It doesn't actually represent the spectrum, which is by definition the pure, fully saturated colors. It's rather a gradient of a bunch of desaturated hues. For example, where is pure yellow on this gradient?
reply
zamadatix 7 hours ago
Very well put together set of fidgeting. I really appreciated the addition of the P3 color space sample at the end. For seeming like such a small addition in terms of area on the chromaticity diagram the extra stretch at the extremes goes a really long way.
reply
NoSalt 8 hours ago
I would say that most depictions of the visible light spectrum on the internet, and in textbooks, are not for physicists, but for "average" folk who simply want the gist of the visible light spectrum. Most of us don't need the exactness the author provides in his write up.
reply
zeristor 13 hours ago
This doesn't account for Tetrachromacy does it

https://en.wikipedia.org/wiki/Tetrachromacy

It would be interesting to learn more about colours spaces developed with Tetrachromacy in mind. I guess the rest of us should be classed as visually impaired.

reply
raverbashing 13 hours ago
Well yes I don't think anybody's monitor can render it anyway
reply
XorNot 11 hours ago
Feels like the old CRT days might've had some interesting things you could do.
reply
anonymous_user9 10 hours ago
Unfortunately no, they used RGB just like modern monitors.

The only kind I'm aware of is the Beam Index tube (aka Indextron), which used invisible UV phosphors to synchronize the beam. (Avoiding the need for a shadow mask, making the tube brighter and less sensitive to magnets.)

https://en.wikipedia.org/wiki/Beam-index_tube

https://youtube.com/watch?v=_b7omGhw7wc

reply
Sharlin 9 hours ago
But in principle the phosphors used might have some power outside the visual spectrum, making them look different to an eye that can see into the near UV or IR. A lot of UV in particular would be filtered by the thick glass though, I guess.
reply
LoganDark 12 hours ago
There is a subsection of that page that is more relevant: https://en.wikipedia.org/wiki/Tetrachromacy#Tetrachromacy_in...

I also wonder.

reply
tpoacher 5 hours ago
is nobody going to comment on the fact that this page seems to be written entirely in latex?
reply
11111011 10 hours ago
Interpolate between the spectral color and gray for existing distortion.

Designating 460nm blue in terms of the Abney affect to render a realistic spectrum.

reply
zombot 12 hours ago
Screw, me, I was reading the title as "Rendering the Vibe Spectrum". I clearly need a break.
reply