A cross shader: Code sampe:

if ((s>.3333 && s<.6777) || (t>.3333 && t<.6777))
surfcolor = (0.105,0.345,0.086);

A square shader: Code Sample:

if ((s>.3 && s<.7) && (t>.3 && t<.7) )
surfcolor = (0.105,0.345,0.086);

A quadrant shader: Code Sample:

float tSquared = pow(t, 2); // t squared
float sSquared = pow(s, 2); // s squared

float value = (tSquared + sSquared); // eval. a^2 + b^2
float hypSroot = sqrt(value); // for this equation c^2 = a^2 + b^2

 

if (hypSroot < 1)
surfcolor = (0.105,0.345,0.086);

A circle shader: Here is some more code:

 

float radius = .25; // radius of circle

 

if (sqrt((pow((.5-s), 2)) + (pow((.5-t), 2)))<=radius)

surfcolor = (0.105,0.345,0.086);

Checkerboard pattern based on a square width value of 0.04
Checkerboard pattern with a square width of 0.1
Checkerboard pattern based on a square width of 0.2
Checkerboard pattern based on a square width of 0.5

 

Code Sample:

 

float i; // counter variable for checkerboard

float j; // counter variable for checkerboard

float w=.5; // Width of checkerboard square(between .04 and .5)

float q=w*2; // counter offset in order to obtain checkers

/* The following loops will create a checkerboard pattern based on width of square size */

 

surfcolor = (0.878,0.686,0.039);
for (i=0; i<=1; i+=q) {
for (j=0; j<=1; j+=q) {
if (((s>=i) && (s<(i+w))) && ((t>=j) && (t<(j+w))))
surfcolor = (0.082,0.254,0.603);
}
}
for (i=w; i<=1; i+=q) {
for (j=w; j<=1; j+=q) {
if (((s>=i) && (s<(i+w))) && ((t>=j) && (t<(j+w))))
surfcolor = (0.082,0.254,0.603);

}

}

 

Here is a random shader I was playing with, and hope to expand on in the future.

 

The Code:

 

float radius = .15; // radius of circle
float avg = (s + t)/2; // average of s and t

 

if ( (cos(s) * sin(t) > avg) || (sin(s) * cos(t) > avg))
surfcolor = (0.019,0.0,0.223);
if (sqrt((pow((.25-s), 2)) + (pow((.75-t), 2)))<=radius)
surfcolor = (0.074,0.305,0.078);
if (sqrt((pow((.75-s), 2)) + (pow((.25-t), 2)))<=radius)
surfcolor = (00.074,0.305,0.078);

A diagonal shader using the sin function. Here's the code:

float sSin = sin(s); // sin wave of s

if (sin(1-t) < sSin)

surfcolor = (0.105,0.345,0.086);

s t    c o l o r a t i o n


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.