top of page
shader SEM_Edge(
color edgeColor = 1,
color faceColor = color (0.15,0.15,0.15),
float strength = 1,
output color resultRGB = 0)
{
vector i = normalize(I); // x,y,z
vector n = normalize(N);
// the angle is measured not in degrees but as the
// cosine of the angle.
// 1.0 at the front, 0.0 at the edge, -1.0 at the rear
float d = 1 - fabs(dot(n, -i));
// 0.0 at the front, 1.0 at the edge
resultRGB = mix( faceColor, edgeColor, pow(d, strength));
}
bottom of page