I'm trying to make a 3D chromaticity plot for the RGB coordinates. I do not want to use the predefined ChromaticityPlot function for two resons: to learn how to do it and mainly because it is based on the xy projection of the XYZ color space, which has different color matching functions than the RGB color space.
I'll explain my work so far.
First I import my RGB color matching functions RGB CMFs cie1931rgb = Import["cie1931rgb.csv"]
I then get each coordinate{\[Lambda], r, g, b} = Transpose[cie1931rgb]
.
Here they are:
I plot them in a 3D space and project them in the r+g+b=1 plane:
ListPlot3D[Transpose[{r/(r + b + g), g/(r + b + g), b/(r + b + g)}]]
There's the shape :) It can be better identified with the Above orthographic viewpoint (notice it's different from the ChromaticityPlot shape for the reason I mentioned).
Now I want to put a mesh on it and fill it with color based on the RGB coordinates, on the valid region of course. Since RGBColor is defined as 3 coordinates from 0 to 1, I want to find a middle point on each division of the mesh and if their coordinates are all positive, assign an RGB color to that division based on the actual coordinates on the plot.
I tried
ListPlot3D[Transpose[{r/(r + b + g), g/(r + b + g), b/(r + b + g)}], Mesh -> 50, MeshStyle -> Opacity[0.9], MeshShading -> If[r/(r + b + g) > 0 && g/(r + b + g) > 0 && b/(r + b + g) > 0, Dynamic@RGBColor[r/(r + b + g), g/(r + b + g), b/(r + b + g)], {{White}}], Lighting -> "Neutral", ViewPoint -> {0, 0, \[Infinity]}]
with the idea on incrementing the number of Mesh and at the same time decrease its Opacity but the MeshShading coloring part doesn't work and I'm stuck. Any help is welcome.