William Schilthuis Maya Pattern Animation  

Visual.Effects.Artist


Download files here:

- biohazard.sl

 

 

 

Reel / Blog / About

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

Breakdown

 

This project was based on the ST Coloration project. I redesigned my pattern several times before choosing one for an animation I liked. At first I wanted to choose a pattern that could mix colors.

I soon decided that I wanted to make a biohazard symbol. Below are some tests while I blocked out the shapes.

Below shows the components of the sysmbol. The only portion I am unhappy with is the center divisions, colored in blue.

Here's the original code for the center marks of the pattern (blue):

if( //Bottom

(s >= 0.49) && //Lft +

(s <= 0.51) && //Rgt +

(t >= 0.53) && //Top +

(t <= 0.59) //Bot +

)

surfcolor = cola;

if( //Bottom

(s >= 0.49) && //Lft +

(s <= 0.51) && //Rgt +

(t >= 0.53) && //Top +

(t <= 0.59) //Bot +

)

Oi = Os * trxbg;

if( //Top Left

(s >= t-0.040) && //Lft +

(s <= t-0.010) && //Rgt +

(s >= 0.88-t) && //Top +

(s <= 0.97-t) //Bot +

)

surfcolor = cola;

if( //Top Left

(s >= t-0.040) && //Lft +

(s <= t-0.010) && //Rgt +

(s >= 0.88-t) && //Top +

(s <= 0.97-t) //Bot +

)

Oi = Os * trxbg;

if( //Top Right

(s >= 1.005-t) && // Lft +

(s <= 1.035-t) && // Rgt +

(s <= t+0.11) && // Top +

(s >= t+0.03) // Bot +

)

surfcolor = cola;

if( //Top Right

(s >= 1.005-t) && // Lft +

(s <= 1.035-t) && // Rgt +

(s <= t+0.11) && // Top +

(s >= t+0.03) // Bot +

)

Oi = Os * trxbg;

This code unfortunately is based on slopes with limitedvisibility, and it is hard to align with the origin and to get teh correct angle. It looks okay, but I wanted a better way of slicing out the center divisions...

 

I then I decided to use a modified version of the outer circles. I acheived this with only 1 extra variable, essentially shifting a copy of each crescent ring to rest in the middle.

Here's the improved code for the center marks of the pattern (blue):

for (j = 0; j < c1ct; j += 1)

{

/*THIS PART SETS COLOR*/

if(

/*INNER SUBTRACTION OF CRESCENT*/

((s-(0.5+sin(c1d*j+PI)*(c1t+cio)))

*(s-(0.5+sin(c1d*j+PI)*(c1t+cio))))+//bottom edge

((t-(0.5+cos(c1d*j+PI)*(c1t+cio)))

*(t-(0.5+cos(c1d*j+PI)*(c1t+cio)))) //bottom edge

< c1r*0.25 &&

/*OUTER CIRCLE OF CRESCENT*/

((s-(0.5+sin(c1d*j+PI)*(c1t+cio*2)))

*(s-(0.5+sin(c1d*j+PI)*(c1t+cio*2))))+//top edge

((t-(0.5+cos(c1d*j+PI)*(c1t+cio*2)))

*(t-(0.5+cos(c1d*j+PI)*(c1t+cio*2)))) //top edge

> c1r*0.25

)

surfcolor = cola; // if within bounds of circle - cirlce: be this color

 

/*THIS PART SETS OPACITY (SHAPE IS DUPLICATE)*/

if(

/*INNER SUBTRACTION OF CRESCENT*/

((s-(0.5+sin(c1d*j+PI)*(c1t+cio)))

*(s-(0.5+sin(c1d*j+PI)*(c1t+cio))))+//bottom edge

((t-(0.5+cos(c1d*j+PI)*(c1t+cio)))

*(t-(0.5+cos(c1d*j+PI)*(c1t+cio)))) //bottom edge

< c1r*0.25 &&

/*OUTER CIRCLE OF CRESCENT*/

((s-(0.5+sin(c1d*j+PI)*(c1t+cio*2)))

*(s-(0.5+sin(c1d*j+PI)*(c1t+cio*2))))+//top edge

((t-(0.5+cos(c1d*j+PI)*(c1t+cio*2)))

*(t-(0.5+cos(c1d*j+PI)*(c1t+cio*2)))) //top edge

> c1r*0.25

)

Oi = Os * trxbg; // if within bounds of circle - cirlce: be this opacity

}

What this does is create a better pattern (mathmatically correct and radially summentrical), AND it give the user easier control over the parameters (not to mention a cool new shap to play with)!

 

And here is the final pattern, before animation:

Here's the code for the Outer circles (in RED). The 3 sections are for the outer circles, the inner circles (crescent shape) and the inner hole

((s-(0.5+sin(c1d*j)*c1t))*(s-(0.5+sin(c1d*j)*c1t)))+
((t-(0.5+cos(c1d*j)*c1t))*(t-(0.5+cos(c1d*j)*c1t)))
< c1r*0.25 &&


((s-(0.5+sin(c2d*j+c2o)*c2t))*(s-(0.5+sin(c2d*j+c2o)*c2t)))+
((t-(0.5+cos(c2d*j+c2o)*c2t))*(t-(0.5+cos(c2d*j+c2o)*c2t)))
> c2r*0.25 &&


((s-0.5)*(s-0.5))+((t-0.5)*(t-0.5))
> c1r*0.01

 

Here's the main code for the Inner cicle. The first two sections are simple and just define the circle, the third block of code is a modified version of the outer 3 circles, so this center circle has space between the sections.

((s-0.5)*(s-0.5))+((t-0.5)*(t-0.5))
< c1r*0.20 &&


((s-0.5)*(s-0.5))+((t-0.5)*(t-0.5))
> c2r*0.15 &&


((s-(0.5+sin(c2d*j+c2o)*c2t))*(s-(0.5+sin(c2d*j+c2o)*c2t)))+
((t-(0.5+cos(c2d*j+c2o)*c2t))*(t-(0.5+cos(c2d*j+c2o)*c2t)))
< c2r*0.20

(the lines above multiplies radius by 0.20 or less instead of 0.25, making the padding/subtraction appear smaller than the rest of the circle shape).

 

Below is the final animation, showing a few of the attribute of the shader which can be animated. I tried to keep the controls simple but allow a lot of power. several attributes are linked, such as the size of the inner and outer circles, so the user can change the sizes, but sizes are relative to other parameters instead of the user having to adjust each possible value.

 

 

here's the final code HERE.

 

I plan to improve the demonstration of this shader, but the primary work is complete. This may happen Summer 2009. In the future you can always check:

williamgs.com/renderman

Updated: June 16, 2011