SEM Edge Code
// Measures the angle between the surface
// normal and the camera ray - called the
// viewing vector.
color frontColor = color(0.1,0.1,0.1),
color edgeColor = color(1,1,1),
float strength = 3,
output color resultRGB = 0)
vector i = normalize(I);
vector n = normalize(N);
float d = 1 - fabs(dot(n, -i)); // returns the angle expressed
// as a cosine
// front cosine 0.0, at the edge it will be 1.0
// we use fabs() to ensure that d is always in
// the range zero to positive one.
resultRGB = mix(frontColor, edgeColor, pow(d,strength));