top of page

shader
SEM_edge(
    color edgeColor = 1,
    color faceColor = color(0.5,0.5,0.5),
    float strength = 1,
    output color resultRGB = 0)
{
vector i = normalize(I);     // x,y,z value
vector n = normalize(N);

// The angle is measured not as degrees, but as the 
// cosine of the angle
// 1.0 at the front, 0.0 at the edge, -1.0 at the back
float d = 1 - fabs(dot(n, -i));
// 0 at the front, 1.0 at the edge

resultRGB = mix(faceColor, edgeColor, pow(d, strength) );

 

}    

bottom of page