Friday, 15 May 2009

Oinkfrog gets groovy pupils

One of the elements that came through in the concept sketches for the Oinkfrog Maya model was the idea that he could have ring pupils rather than the simpler solid colour he had 'til now. After creating the bled shape versions of the pupils, I decided to try and achieve this with a shader instead. The U-Ramp shader seemed like a sane choice as it comes up in tutes for cartoon eye creation. The trick was to animate the location of the ramp division.

Starting with a test, I created the material with the ramp shader. Alas the ramp's colour positions arent presented through the expression editor, so this site gave me the code base I needed. After getting the test to work, I duplicated up the shading network for the test shader I removed the link to the test attribute. I added an attribute to both the look controllers (min 0, max 1, default 1) and then ran these two commands to link things together.

connectAttr Look_L.dilate ramp_pL.colorEntryList[0].position;
connectAttr Look_R.dilate ramp_pR.colorEntryList[0].position;

It took some experimenting to get the right array value and other bits, but all is well and I like the effect.

No comments: