Converting RGB to color wheel?

Hi, so I’m trying to figure out the most elegant way to map color ranges to positions on a color wheel for a DMX moving head spot. Basically, I want to make a component that will take an RGB color value in, find the closest color on the wheel (which, unfortunately, is not arranged in RGB order), and then output the DMX channel value for that position on the color wheel. So, if i input red, it’ll give the DMX value for the red section of the color wheel, if I put in white, it’ll give the DMX value for the white section of the table, etc. Is there a simple or elegant way to do this?

Hey,

that’s a good job for a Lookup CHOP.
First convert the color to hsv space via an RgbToHsv TOP. Next use a TopTo CHOP to get the color values. While the channels say rgb, what you are actually reading out is the hue, saturation and value values of the color. You can change the channel names on the Image parameter page of the TopTo CHOP. Also, snce you are just reading in one single color, set the Crop parameter to Pixel.
In the simplest case, now having the hue channel you can look up the position of the color via a Lookup CHOP - the second input to the lookup CHOP being the positions on the color wheel.
This method requires though a special case for White. You can implement this via a switch - as soon as the saturation channel hits 0, you are looking at white or shades of it.

Hope this helps
Markus