Maya Pattern Animation

The animation and notes on this page explain how custom shaders written in the RenderMan Shading Language can be animated using SLIM parameter expressions.

 

Girl Shader

For the st Coloration assignment,

I created a shader called "girl".

It has parameters to change the hair color, face color, ribbon color,

eye size, ribbon size, and mouth size, etc.

girl source code

 

We learned about adding specularity to the shader,

so I created a second "girl" shader that has specularity.

girl_spec source code

 

To add specularity, we need to add the following scripts:

normal n = normalize(N);

normal nf = faceforward(n, I);

color diffusecolor = diffuse(nf) * Kd;

Oi = Os; Ci = Oi * Cs * surfcolor * diffusecolor * Kd;

 

We also learned about how to incorporate textures into the shader

by changing to script to:

texture_test(float Kd = 0.7, /* [0 3 0.25] Controls the brightness */

Ks = 0.8, roughness = 0.1;

color hilitecolor = 1;

normal n = normalize(N);

normal nf = faceforward(n, I);

color diffusecolor = diffuse(nf) * Kd;

vector i = normalize(-I);

color speccolor = specular(nf, i, roughness) * hilitecolor * Ks;

Oi = Os; Ci = Oi * Cs * surfcolor * (diffusecolor + speccolor);

 

 

 

Candy Shaders

I created two more shaders for candies that I am going to

put into the scene. So one for candy canes, and one

for regular candies.

           

 

candy_stripes source code

 

Writing the candy cane shader was pretty difficult for me,

because I was not that familiar with the "for loop" statement,

I had to ask Gaki for help. So here are the scripts we came up with:

float i;

float offset = offset_t;

if(tangent > 0)

while (width + offset > -tangent) { offset -= gap; }

for (i = offset; i < 1; i += gap){

if(t >= tangent * s + i && t <= tangent * s + i + width)

surfcolor = color (cos(t), 0, sin (s)); }

 

For the candy canes, I created a taurus, deleted about half of it,

then extruded the edges of one side to created a cane.

And for the candies, I grouped one sphere and two cones together.

It was such a hassle to unwrap the UVs for these shapes.

 

candy_dots source code

 

My Final Animation:

I animated one of girls blinking and smiling, the other one is changing hair

and facial color on top of that, and the size and color of the ribbon are also animated.

The compression of the flash video makes the changing of hair and facial

color hard to see.

 

I was going to animate the background, but I was afraid to make the composition

look too busy and overwhelmed with colors and patterns,

so I created a image plane for the camera's environment color,

then plugged in a stripe texture file downloaded from online source.

 

As for the candies, I animated the width and gap of the stripes,

dot radius and distance, as well as colors.

 

 

Back to Top