LUT for interactive demonstration of cone wavelengths and sensitivities #1225
-
Hi everyone! I'm an artist working on a project can be a fun way to learn how human vision works. One element I'd like to include is an interactive tool that lets you play with different controls to experience how other people may see the world. It seems like this library can probably do what I want, and I'd really love some help getting started as my use case doesn't seem to be a typical one. The things I would like to do are:
I'll be implementing this in TouchDesigner, so I think the way to do this is with a cube LUT that could take the input sRGB values (likely only 8 bit per channel, but I can convert it to linear and/or 32 bit float on the way in/out) and output the intensity each cone would perceive on a different channel of the RGB output. i.e.
I can then split out the individual RGB channels in TouchDesigner and display and manipulate them from there. When controls are changed, I can use Python to re-generate a new LUT. Could anyone help get me started with how to build this LUT? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
Hello, I don't think you need to generate a LUT at all here, the Cheers, Thomas |
Beta Was this translation helpful? Give feedback.
-
OH there are |
Beta Was this translation helpful? Give feedback.
-
So I'm able to generate a 3x3 adjustment matrix based on the example code, and implemented it as a GLSL shader. It's super fast, so thank you for that suggestion! However, it's still not quite doing what I'd expect, so I have a couple more questions. I used the example code in the docs to generate the array:
|
Beta Was this translation helpful? Give feedback.
-
I'm making progress - I've implemented However, I'm still getting some really weird results from Setup with everything set to 0 If I now use the RGB transformation matrices from this: I get this output matrix:
Which makes the image look as I'd expect: (I'm using these images as reference) However, if I then use As this is best described with colours - here's an example video of me adjusting the L wavelength offset from 0 to 20 nm. You can see the image in the GLSL TOP goes wild and the colours on the scope sort of explode and reform again as I move through the scale: I have confirmed that at 15nm I'm getting the same output as the example code in the docs, so I think I've set things up correctly there. With the L offset at 20, I was expecting to get a matrix with similar values to the Protanopia one above, but instead I get:
With an output image that looks like this: And at 12 nm I'm getting extremely bizarre figures:
With an output image that looks like this: Similarly bizarre things happen when adjusting the M and S wavelengths - especially S that seems to bounce from one side of the extremes to the other every couple of nm in adjustment. Is this something to do with the MSDS_DISPLAY_PRIMARIES or MSDS_CMFS_LMS values, should there be different values I pass in there? |
Beta Was this translation helpful? Give feedback.
-
Oh wow sifting through the archives there, thanks for looking! I think you may be onto something in the log vs. linear colourspace idea, but I figured this is easier to show than describe so I made a video to show what's going on with the two different functions and their outputs: https://www.youtube.com/watch?v=ABs1xtE4Fg0 |
Beta Was this translation helpful? Give feedback.
-
Ahh you're amazing - switching both the colour spaces to Thank you so much! I also sat down with a cup of tea to read the paper and now understand which direction each of the cone wavelength changes are moving (higher is converged towards green/centre)... but now after cracking that joke about people seeing infra red I'm wondering if there are genetic mutations that shift the L cone sensitivity to longer wavelengths not just lower ones (or indeed S cones to shorter wavelengths and can see more UV), but we never test for it because we're looking for "less than normal" vision... hmm... |
Beta Was this translation helpful? Give feedback.
Hello,
I don't think you need to generate a LUT at all here, the
colour.matrix_anomalous_trichromacy_Machado2009
definition generates a 3x3 matrix for a given RGB space that you could apply directly in GLSL within TouchDesigner. It should be really really fast!Cheers,
Thomas