I've spent most of the week working on my light simulator / 3d renderer. One thi...
Baillehache Pascal @baillehache_pascal@hachyderm.io
I've spent most of the week working on my light simulator / 3d renderer.
One thing I've been able to reproduce and I'm happy about is the CIE chromaticity diagram.
In previous versions of that work I was already implementing conversion from light spectrum to sRgb color space, but I had never plot that particular diagram myself.
I'm glad I did this time because it allowed me to realise that it's wrong. If you know what this diagram represents you'll probably notice the spectral locus shape is wrong, in particular in low wavelengths, and even completely diverges when approaching ultraviolet.
That was interesting to understand why. It's not a bug in my implementation, it comes from approximation in the calculation. Now I'm trying to see if it can't be corrected.
If you don't know what this diagram is, it is a representation of all the colors visible by an average human eye. The triangle contains all the colors representable with the sRgb color space (the one commonly used by our elecronic devices), and the U shape extends to what a human can perceive (the U closes with a straight line at the bottom, not represented here).
Also, if you compare with the same diagram in Wikipedia for example and wonder why the sRgb colors are much brigther in mine: the color space is 3D and one can choose arbitrarily how to project the luminance dimension. In the diagram shown in Wikipedia they choose a constant luminance, while in mine I choose the maximum possible luminance for each color.