top of page

shader 
SEM_Edge(
    color frontColor = color(1,1,1),
    color edgeColor = color(1,0,0),
    float strength = 2,
    output color resultRGB = 0)
{
vector i = normalize(-I);
vector n = normalize(N);

float cosine_angle = 1 - fabs(dot(i,n));
//fabs gives the absolute value, always a +ve number

resultRGB = mix(edgeColor, frontColor, pow(cosine_angle, strength));

}

bottom of page