top of page

shader SEM_Direction(
    vector direction = vector(0,-1,0),
    color topcolor = color(1,1,1),
    color rearcolor = color(0.2,0.2,0.2),
    float strength = 2,
    string coordname = "world",
    output color resultRGB = 0)
{
normal n = normalize(transform(coordname, N));

vector vec = transform (coordname, direction);

float dp = clamp(dot(n, vec), 0, 1);

resultRGB = mix(rearcolor, topcolor, pow(dp,strength));

}

bottom of page