surface
cross_shader()
{
    color surfcolor = (1);
    if (t >= 0.2 && t <= 0.8)
        surfcolor = color .2; //(1,0.52,0);
    if (s >= 0.2 && s <= 0.8)
        surfcolor = color .2; //(1,0.52,0);
    Ci = surfcolor;
}

surface
diagonal_shader()
{
    color surfcolor = (0.36,0.28,0.0001);
    if (t >= 0.2 && t <= 0.8 && s >= 0.2 && s <= 0.8)
        surfcolor = color .2;
    Ci = surfcolor;
}

surface
quadrant_shader()
{
    color surfcolor = (1);
    if (t < sqrt(1-(s*s)))
        surfcolor = color .2;
    Ci = surfcolor;
}

surface
square_shader()
{
    color surfcolor = (1);
    if (t >= 0.2 && t <= 0.8 && s >= 0.2 && s <= 0.8)
        surfcolor = color .2;
    Ci = surfcolor;
}

surface
unique_shader()
{
    color surfcolor = (1);
    if ((s-.5)*(s-.5)+(t-.5)*(t-.5) > .30) //surrounding circle
        surfcolor = color .2; //(1,0.52,0);
    if (t > s*-6 +1.4 && t < s*-6 +2.1 && t > .1 && t < .8) //long vertical of "h"
        surfcolor = color .2;
    if (t > s*-6 +2 && t < s*-6 +2.9 && t > .445 && t < .56) //horizontal of "h"
        surfcolor = color .2;
    if (t > s*-6 +2.55 && t < s*-6 +3.21 && t > .48 && t < .8) //short vertical of "h"
        surfcolor = color .2;
    if ((s-.4)*(s-.4)+(t-.5)*(t-.5) < .003 && t < .5 && s >.4) // interior 1 quadrant circle of "h"
        surfcolor = color .2;
    if ((s-.294)*(s-.294)+(t-.6)*(t-.6) > .002 && t > .56 && t < .595 && s > .25 && s < .3) // exterior left quadrant circle of "h"
        surfcolor = color .2;
    if ((s-.285)*(s-.285)+(t-.6)*(t-.6) > .002 && t > .56 && t < .595 && s > .3 && s < .35) // exterior right quadrant circle of "h"
        surfcolor = color .2;
    if (t > s*-6 +3.9 && t < s*-6 +4.7 && t > .48 && t < .98) // long vertical of "p"
        surfcolor = color .2;
    if (t > s*-6 +5.2 && t < s*-6 +5.9 && t > .53 && t < .8) //short vertical of "p"
        surfcolor = color .2;
    if (t > s*-6 +4 && t < s*-6 +5.6 && t > .48 && t < .595) //upper horizontal of "p"
        surfcolor = color .2;
    if ((s-.84)*(s-.84)+(t-.536)*(t-.536) < .003) // interior upper quadrant circle of "p"
        surfcolor = color .2;
    if (t > s*-6 +4.5 && t < s*-6 +5.6 && t > .74 && t < .85) //lower horizontal of "p"
        surfcolor = color .2;
    if ((s-.795)*(s-.795)+(t-.795)*(t-.795) < .003) // interior lower quadrant circle of "p"
        surfcolor = color .2;
    if ((s-.725)*(s-.725)+(t-.635)*(t-.635) > .002 && t < .635 && t > .58 && s < .725 && s > .65) // exterior left top circle of "p"
        surfcolor = color .2;
    if ((s-.72)*(s-.72)+(t-.635)*(t-.635) > .002 && t < .635 && t > .58 && s > .725 && s < .8) // exterior right top circle of "p"
        surfcolor = color .2;
    if ((s-.705)*(s-.705)+(t-.7)*(t-.7) > .002 && t > .7 && t < .8 && s < .77 && s > .65) // exterior bottom circles of "p"
        surfcolor = color .2;
    Ci = surfcolor;
}

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.

Most challenging part of this project was to figure out how to get circular shapes, and as it turns out (x-x1)*(x-x1)+(y-y1)*(y-y1)+r is the way to go, since it graphs a circle centered on x1,y1 with the radius of r.

Previous Post Next Post