Hue slider

When you manipulate the hue slider on the color picker in Maya, you get output  like this in the script editor.   Here three values are being changed: R,G and B.

setAttr "lambert1.color" -type double3 0.562 0.686027 1 ;
setAttr "lambert1.color" -type double3 0.562 0.686027 1 ;
setAttr "lambert1.color" -type double3 0.704423 0.562 1 ;
setAttr "lambert1.color" -type double3 0.704423 0.562 1 ;

How would it be possible to create an input that instead  use  0 - 360  to change the hue,  so that you could input a single value instead of three,  so for instance you could have one attribute on a controller that modified the hue.

Thanks for reading!!

You dont a color is a color data can be converted into color but it cant be a noncolor. That is you can make a gui to show up a hsv slider or you can connect and recompute a output that makes for a hsv color but the elementary storage of a color is just that.

http://en.wikipedia.org/wiki/HSL\_and\_HSV#From\_HSV

Thanks, I am looking into it. The math and scripting for that may be a bit difficult for me but I will figure it out eventually.

But, seems like Maya has done the math to figure this out, with the RGBtoHSV. But I don't have access to the attributes to set up a network. And the HSV inputs are inHsvR, inHsvG, and inHsvB.

Am I missing something?

Thanks for your time!

if u want to input/change the hue value, then u shud use hsvToRgb node.

Suppose ur utility node is hsvToRgb1. then use the code below to set rgb using the given hue value:

float $hsv[] = getAttr hsvToRgb1.inHsv;

$hsv[0] = ........;      // set new hue value here

setAttr hsvToRgb1.inHsv $hsv[0] $hsv[1] $hsv[2];

then connect its output to the required mesh.
( am i right?! just thought in this way! )

mel has alo a function for the conversion. thing is you guys are mixing 2 things together

  1. raw data

  2. representation for said data.

Color can be represented in various forms HSV HSL LAB XYZ and RGB forms, among other thing. Threese are reresentations of the data. Now since the data is ALLWAYS worked on as if it rgb by the rendering engine and thw whole shebang dowsntreams it makes sense to allways tstore the data as RGB.

hence Raw data -> RGB.

representration = guis problem. In fact if you click on the color swatch maya opens up a window taht allows you tp pick colors. Amongst other things it allowa syou to set colors in HSV color mode. Ergo once you have the color yuou can choose how to set it.

Theres really no point in letting users input a raw hsv into the system theres a data doucouplig going on if you need for some reson to do thsi then you make  GUI thst does that for you. GUI not equal to internal datamodel. The only reason you would use the rgb -> hsv node is if you actually nee dto do some math runtime on the data. The node networks dont actually care one way or another how the user sees the data. Thats the gui layers job, not the node networks.

So since color is color youd STORE it as color so its interoperatable by other color hence you store it by contract in RGB. However what you make the USER see is completely different form what data you actualy store. Thats essentielly what the AE templates are there for.

Thanks all!

I understand that color data is interpreted by Maya in rgb, and I need to build an interface between the value that I want to animate, that is a single channel 0 - 360 (hue), and output three channels of data to control color in Maya.

I was directed to the docs for the HSV>RGB node by another user. Turns out that you can feed a single channel of data (any attribute that has a range of 0 - 360)  through the .inHsvR channel of a HSV>RGB node.

Docs Read: inHsvR, The first (Hue) component of In Hsv. This value ranges from 0 to 360, representing degrees of a circle.

When I feed the resulting outRgb into the color channel of a shader I get the result I want.

Yes howvever is there a significant reason why the channel has to be  hsv value? Is it important for the interpolation of color? IF not then its not the right way top thinkabout it because it does have side effect-

see channels are not about input as much as how the datas handled, now if you use a hsv datasotorage node and animate a color form red to to blue. It will prceed to animate trough the hue band trough red yellow green cyan and blue. IS this what you intend for it to do? Its not a interface its a data manipulation space.

is this what you expect to happen?

interface between the value that I want to animate, that is a single channel 0 - 360 (hue), and output three channels of
data to control color in Maya.

Yes but a conversion node is not a interface, a interface is just gui items. Nothing states that you can not make gui items that are in no way related to the data model. gui items dont live in nodes they just exist in the gui framework.

The most prominent example of this is the camera nodes. Have you ever noticed that there REALLY is no such attribute as Angle of view! Its just a gimic done gby the gui. Now NOTHING states you cant do that for any color attribute you wish. Tahts is pure interface for the user. So your talking of 2 things with terms form the different things as interchangeable. So im confused as to wether or not you understand what your asying.

To me interface says you DONT want a hsv to rgb node whereas you insistyou do, Wich is it you needing a interface or a colorspace. Choose they are mutually exlusive ideas. Either you want a inetrface or not.

When I feed the resulting outRgb into the color channel of a shader I get the result I want.

Perhaps. But thst not exactly what you are aasking with the language you use.

Thanks Joojaa!

I am trying to learn to express these ideas, any help in that area is much appreciated, so I'm taking in what you are sayng. Re-reading my original question I see that I could have been a lot clearer.

I am trying to make a "hue" attribute, because I want to be able to animate a hue cycle, smooth transition through the spectrum of colors. Pretty much the same functionality that the hue slider in the maya color picker has. So say I have a animated knob that turns from 0 - 360. I will use this knob's rotation attribute to cycle through the spectrum of colors on some shader. The network I have built does this.