ST Coloration

These images show the results of using the RenderMan Shading Language (RSL) to write a variety of special effects surface shaders. The notes and RSL code accompanying each image explain how each effect was achieved.

This is my custom st shader. I made it with four positioning variables in order to make animation easier. These variables are: Y coordinates for each of the players and X and Y coordinates for the ball. Shaded areas are drawn with if statements in RSL containing several conditions and appropriate Boolean operators. This simple animation loop is created with key-frames in Cutter. Final animation in the next assignment, however, is going to be attached to a rigid body simulation in Maya. This will allow me to create animation similar to the real game. One part of the code is explained below. The whole code for the shader is available here.

 

//left paddle - fixed vertical width, horizontal dependent on player1 variable
if(s >= 0.03 && s <= 0.05 && t>= player1-0.07 && t<= player1+0.07)
surfcolor = color(1,1,1);

//right paddle - same as previous but opposite side and uses player2 variable
if(s >= 0.95 &&s<= 0.97 && t>= player2-0.07 && t<= player2+0.07)
surfcolor = color(1,1,1);

//ball - reads ballx and bally variables and draws the ball
if(s>= ballX-0.015 &&s<= ballX+0.015 && t>= ballY-0.015 && t<= ballY+0.015)
surfcolor = color(1,1,1);

//middle line
if(s>= 0.49 &&s<= 0.51 && t>= 0.04 && t<= 0.96)
surfcolor = color(1,1,1);

//border - This loop draws a little cube every 0.04 units
float loop;
for (loop = 0.01; loop <= 1; loop += 0.04)
{
if((s>= loop &&s<= loop+0.02)&&(t>= 0.96 && t<= 0.98 || t>= 0.02 && t<= 0.04))
surfcolor = color(1,1,1);
}

//Zero - draws a solid rectangle then background color inside
float zeroPosX = 0.4;
float zeroPosY = 0.15;
if(s>= zeroPosX-0.04 &&s<= zeroPosX+0.04 && t>= zeroPosY-0.06 && t<= zeroPosY+0.06)
surfcolor = color(1,1,1);
if(s>= zeroPosX-0.02 &&s<= zeroPosX+0.02 && t>= zeroPosY-0.05 && t<= zeroPosY+0.05)
surfcolor = backcolor;

//Zero - same as previous but different positioning coordinates
zeroPosX = 0.65;
zeroPosY = 0.15;
if(s >= zeroPosX-0.04 &&s<= zeroPosX+0.04 && t>= zeroPosY-0.06 && t<= zeroPosY+0.06)
surfcolor = color(1,1,1);
if(s >= zeroPosX-0.02 &&s<= zeroPosX+0.02 && t>= zeroPosY-0.05 && t<= zeroPosY+0.05)
surfcolor = backcolor;

 

ST coloration. renderman surface shading

The shapes on the left are created with simple conditions and Boolean operators similar as in my custom shader. This was an introductory assignment with purpose to introduce the concepts of st coloration and Renderman Shading Language.