|
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. |
|
surface
center_square(float Kfb = 1, /*fake brightness*/
topEdge = 0.5,
leftEdge = 0.5;
color tint1 = color(0,0,0),
leftTint = color(0.760,0.720,0.520),
rightTint = color(0.350,0.320,0.180))
{
color surfcolor = mix(leftTint, rightTint, s);
if(t >= 0.33333 && s >= 0.33333 && t <= .66667 && s <= .66667)
surfcolor = tint1;
Oi = Os;
Ci = Oi * Cs * surfcolor * Kfb;
}
|
||
|
surface
center_square(float Kfb = 1, /*fake brightness*/
topEdge = 0.5,
leftEdge = 0.5;
color tint1 = color(0.760,0.720,0.520),
{
color surfcolor = 0;
if(t >= 0.33333 && s >= 0.33333 && t <= .66667 && s <= .66667)
surfcolor = tint1;
if(t >= 0.33333 && s >= 0.0 && t <= .66667 && s <= .33333)
surfcolor = tint1;
if(t >= 0.33333 && s >= .66667 && t <= .66667)
surfcolor =tint1;
if(s >= 0.33333 && t >= 0.0 && s <= .66667 && t <= .33333)
surfcolor = tint1;
if(s >= 0.33333 && t >= .66667 && s <= .66667)
surfcolor = tint1;
Oi = Os;
Ci = Oi * Cs * surfcolor * Kfb;
}
|
||
|
surface
diag(float Kfb = 1, /*fake brightness*/
topEdge = 0.5,
leftEdge = 0.5,
pivotS = 0.5,
pivotT = 0.5,
angle = 0,
swirlAngle = 0;
color leftTint = color(0.760,0.720,0.520),
rightTint = color(0.350,0.320,0.180),
bgcolor = color (0,0,0))
{
color surfcolor = mix(leftTint, rightTint, t);
if(t + s >= 1)
surfcolor = mix(leftTint, rightTint, s);
//Step 1 - see the apparent surface opacity */
Oi = Os;
/* Step 2 - calculate the apparent surface color */
Ci = Oi * Cs * surfcolor * Kfb;
}
|
||
|
|
||
|
surface
center_square(float Kfb = 1, /*fake brightness*/
topEdge = 0.5,
leftEdge = 0.5;
color tint1 = color(0.760,0.720,0.520),
tint2 = color(0.540,0.490,0.270),
tint3 = color(0.350,0.320,0.180))
{
color surfcolor = 0;
if(t >= 0.33333 && s >= 0.33333 && t <= .66667 && s <= .66667)
surfcolor = tint1;
if(t >= 0.33333 && s >= 0.0 && t <= .66667 && s <= .33333)
surfcolor = tint2;
if(t >= 0.33333 && s >= .66667 && t <= .66667)
surfcolor =tint2;
if(s >= 0.33333 && t >= 0.0 && s <= .66667 && t <= .33333)
surfcolor = tint3;
if(s >= 0.33333 && t >= .66667 && s <= .66667)
surfcolor = tint3;
Oi = Os;
Ci = Oi * Cs * surfcolor * Kfb;
}
|
||
|
#include "lib.h"
surface
swirl_test(float Kfb = 1,
topEdge = 0.3,
bottomEdge = 0.6,
pivotS = 0.5,
pivotT = 0.5,
angle = 0,
swirlAngle = 0;
color leftTint = color(0.172,0.764,0.933),
rightTint = color(1,0,0))
{
color surfcolor = 1;
float dist = distance(point(s,t,0), point(pivotS,pivotT,0));
float rotatedS, rotatedT;
rotateST(pivotS, pivotT, (1/dist) * swirlAngle, s, t, rotatedS, rotatedT);
if(rotatedT >= topEdge && rotatedT <= bottomEdge)
surfcolor = mix(leftTint, rightTint, rotatedS);
Oi = Os;
Ci = Oi * Cs * surfcolor * Kfb;
}
|
|
{
color surfcolor=(tint3);
normal n = normalize(N);
normal nf = faceforward(n, I);
point p = transform(coordname, P);
float nose = (noise(p * freq) - 0.5) * amp;
float tt = t + nose;
float ss = s + nose;
float x = ss - arcOriginS,
y = arcOriginT - tt,
len = sqrt((x*x) + (y*y));
/*blade circle*/
if( ( ss-0.5 )*( ss-0.5 ) + ( tt-0.5 )*( tt-0.5 ) <.25*mult )
surfcolor = color(tint1);
/*blade cutouts*/
if(len <= arcRadius) {
float xyAngle = degrees(atan(y,x));
if(y < 0)
xyAngle += 360;
if(xyAngle <= arcEnd && xyAngle >= arcStart)
surfcolor = tint2;
if(xyAngle <= arcEnd1 && xyAngle >= arcStart1)
surfcolor = tint2;
if(xyAngle <= arcEnd2 && xyAngle >= arcStart2)
surfcolor = tint2;
if(xyAngle <= arcEnd3 && xyAngle >= arcStart3)
surfcolor = tint2;
}
/*center circle*/
if( ( ss-0.5 )*( ss-0.5 ) + ( tt-0.5 )*( tt-0.5 ) |