RenderMan Normals Shader

Applying this shader to a surface will perform several of the rendering and compositing steps described in "Raytracing... in Photoshop?" in a single pass. Just composite the result over a "128" grey field, or insert a flat grey frame-filling object behind the object at render time (The first method is prefered, since it will also generate a useful alpha channel).



surface psTrace () {
    point Nf;
    point Nc;
    Nf = faceforward(normalize(N), I);
    Nc = transform("camera", (Nf + point "camera" (0,0,0)));
    Nc = normalize(Nc);
    Oi =  Os;
    setcomp(Ci, 0, clamp((0.5 - xcomp(Nc) / 2), 0, 1));
    setcomp(Ci, 1, clamp((0.5 + ycomp(Nc) / 2), 0, 1));
    setcomp(Ci, 2, clamp(abs(zcomp(Nc)), 0, 1));
}


© 1994,1995 Kevin Björke
Updated 1 Dec 95
RenderMan is a trademark of Pixar. Photoshop is a trademark of Adobe Systems.