m a y a _ p a t t e r n _ a n i m a t i o n

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



This assignment enabled us to take the custom shader we made for
the ST Coloration assignment and animate it.


Here is the shader itself applied to a simple polygon.

This proved to be a challenge because of all the variables
that would have to be defined and animated.


If you recall, when I wrote the shader, I had to define all the
variables myself and wrote them into the equations themselves:

//background
if(t >= topEdge && s >= leftEdge)
surfcolor = color(0.874,0.101,0.0);

//red corners
if (sqrt ((t-.3)*(s-0.3)) <=0.18)
if (sqrt ((s*.3)*(t*0.3)) <=0.2)
surfcolor = color(0.764,0.796,0.8);

//diagonal
if(t >= s && t-.1 <= s)
surfcolor = color(0.874,0.101,0.0);
if(-t >= -s && -t-.1 <= -s)
surfcolor = color(0.874,0.101,0.0);

//silver curves
if ((s-.8)*(s-.8) + (t-.4)*(t-.4) <.05)
surfcolor = color(0.764,0.796,0.8);
if ((t-.8)*(t-.8) + (s-.4)*(s-.4) <.05)
surfcolor = color(0.764,0.796,0.8);

//red swoop
if (sqrt ((t-.4)*(s-0.4)) + .29 <=0.3)
if (sqrt ((s*.7)*(t*0.7)) <=0.3)
surfcolor = color(0.874,0.101,0.0);

//circles
if ((s-.4)*(s-.4) + (t-.4)*(t-.4) <.07)
surfcolor = color(0.764,0.796,0.8);
if ((s-.4)*(s-.4) + (t-.4)*(t-.4) <.05)
surfcolor = color(0.223,0.564,1.0);

However, in order to animate each individual element,
I had to define the variables so that they could be
adjusted in Maya using a Renderman Shader.

animated_shader1(float Ka = 1,
    Kd = 0.8,
    Ks = 1,
    roughness = 0.1,
    topEdge = 0.5,
    leftEdge = 0.5,
    pivotS = 0.5,
    pivotT = 0.5,
    angle = 0,
    bg_start = 0,
    bg_end = 1,
    blue_circle_size = 0.05,
    silver_circle_size = 0.07,
    circle_placements = 0.4,
    diagonal_thickness = 0.1,
    side_circle_size = 0.05,
    side_circle1_position = 0.4,
    side_circle2_position = 0.8,
    squiggle_position = 0.3,
    squiggle_size_1 = 0.18,
    squiggle_size_2 = 0.2,
    swoop_size = 0.3,
    swoop_top_placement = 0.29,
    swoop_top_thickness = 0.4,
    swoop_bottom_thickness = 0.7,
    freq = 10,
    amp = 0;

Also, in class we went over noise so I wanted to add
that into the animation, which is what the "freq" and "amp" are.

So when I plug in the variables into the equation, this is
what it looks like:

//background
if (t >=bg_start && t <=bg_end && s >=bg_start && s <=bg_end)
surfcolor = red;

//squiggle
if (sqrt ((tt-squiggle_position)*(s-squiggle_position)) <=squiggle_size_1)
if (sqrt ((s*squiggle_position)*(tt*squiggle_position)) <=squiggle_size_2)
surfcolor = silver;

//diagonal
if(t >= s && t-diagonal_thickness <= s)
surfcolor = red;
if(-t >= -s && -t-diagonal_thickness <= -s)
surfcolor = red;

//circles side
if ((s-side_circle2_position)*(s-side_circle2_position) + (tt-side_circle1_position)*(tt-side_circle1_position)
surfcolor = silver;
if ((tt-side_circle2_position)*(tt-side_circle2_position) + (s-side_circle1_position)*(s-side_circle1_position)
surfcolor = silver;

//squiggle 3
if (sqrt ((tt-swoop_top_thickness)*(s-swoop_top_thickness)) + swoop_top_placement <=swoop_size)
if (sqrt ((s*swoop_bottom_thickness)*(tt*swoop_bottom_thickness)) <=swoop_size)
surfcolor = red;

//circles
if ((s-circle_placements)*(s-circle_placements) + (t-circle_placements)*(t-circle_placements)
surfcolor = silver;
if ((s-circle_placements)*(s-circle_placements) + (t-circle_placements)*(t-circle_placements)
surfcolor = blue;


Here you can see some of the controllers that have been keyed.

Here is a sample animation. As you can see, the side swoops
suddenly disappear when the variable reaches a certain number.
So I had to figure out what that variable was and set the final
keyframe as to not go past it.
In the animation, I keyed the colors, the sizes, and the positions
of the different elements.



Now I applied the shader to a model I had to see how it would look.
Also, I decided to add noise to it to see how it animates.


I think it looks pretty cool. It sort of resembles frost crystallizing.

Finally, I added the shader to another model and set up a little scene.
In this final piece, I keyed the colors, sizes, positions, and noise.

 

Copyright 2008
Best viewed in Mozilla Firefox.