Search code examples
color-spacecmykpovray

Plotting CMYK color space as 3D color solid


I am using the following POV-Ray loop to plot sRGB coordinates in other color spaces. The loop only generates points along the outer surface, and then connects them with triangles. Since the sRGB space is a sort of twisted cube, that means 6 outer faces and 8 vertices.

#macro cie_calc_gamut_xyz_srgb()
    #for (i, 0, cie_sample_count_srgb)
        #for (j, 0, cie_sample_count_srgb)
            // side 0 & 3
            #local cooRGB = <i/cie_sample_count_srgb,j/cie_sample_count_srgb,0>;
            #local cooXYZ = cie_convRGB2XYZ(cooRGB);
            #declare cie_point_array_srgb[0][i][j] = cooXYZ;
            #local cooRGB = <i/cie_sample_count_srgb,j/cie_sample_count_srgb,1>;
            #local cooXYZ = cie_convRGB2XYZ(cooRGB);
            #declare cie_point_array_srgb[3][i][j] = cooXYZ;
            // side 1 & 4
            #local cooRGB = <i/cie_sample_count_srgb,0,j/cie_sample_count_srgb>;
            #local cooXYZ = cie_convRGB2XYZ(cooRGB);
            #declare cie_point_array_srgb[1][i][j] = cooXYZ;
            #local cooRGB = <i/cie_sample_count_srgb,1,j/cie_sample_count_srgb>;
            #local cooXYZ = cie_convRGB2XYZ(cooRGB);
            #declare cie_point_array_srgb[4][i][j] = cooXYZ;
            // side 2 & 5
            #local cooRGB = <0,i/cie_sample_count_srgb,j/cie_sample_count_srgb>;
            #local cooXYZ = cie_convRGB2XYZ(cooRGB);
            #declare cie_point_array_srgb[2][i][j] = cooXYZ;
            #local cooRGB = <1,i/cie_sample_count_srgb,j/cie_sample_count_srgb>;
            #local cooXYZ = cie_convRGB2XYZ(cooRGB);
            #declare cie_point_array_srgb[5][i][j] = cooXYZ;
        #end
    #end
#end

This works well, since nearly all color spaces are three-dimensional. Here is an example of the output:

enter image description here

However, I want to do the same with the CMYK color space. The problem I am encountering is that it has 4 parameters instead of 3. Again, I only want to plot points on the outermost surface and connect them with triangles. I do not think the resulting color solid is four-dimensional, but I am at a total loss as to how to proceed. Does anyone have a clue what to do? Thanks.

Note that XYZ is a color space. Link.


Solution

  • The main problem here is that CMYK is not proper a color space - it is more like a Printing Process, and you have one extra degree of freedom on the coordinates to map then all to visible colors. What makes using K distinct to the eye than 100% CMY are chemical characteristics of the colorants that can't be simulated in imaging software. (I tried to google for a good reference on CMYK not being a color space - try it, and you will see that science-backed texts tend to call CMYK a "color model" instead)

    Anyway, having 4 coordinates render invalid most known imaging algorithms that deal with color, and that is the main reason GIMP never had and never considered having an internal CMYK colorspace. (It is ok to export to this space, but not work on it).

    All in all, what you should do is to take a fixed K value, and render your cube with varying CMY. Repeat for extra cubes if desired.