#include "M:/vsfx755/rsl_source/noises.h"
surface npr_woodcut01(
float lineWidth = 0.25;
float lineOffset = 0.15;
float lineBlend = 0.75;
float border = 0.12;
color outline = (0,0,0);
float outlineWidth = 0.25;
float outlineBlend = 0.25;
color black = (0,0,0);
color white = (1,1,1);
float Kd = 1;
string PSpace = "shader";
)
{
color surfcolor = 1;
/* STEP 1 - make a copy of the surface normal one unit in length */
normal n = normalize(N);
normal nf = faceforward(n, I);
normal Nn = normalize (-N);
float dot = Nn . normalize(I);
point objP = transform (PSpace, P);
float screenx = ycomp(objP);
float swidth = 0;
swidth = lineWidth;
float ss = screenx/swidth;
float sss = ss - floor(ss);
float do = smoothstep(0,lineOffset,abs((sss*2)-1));
surfcolor = mix(white,black,do);
color solidOutline = mix(outline,surfcolor,smoothstep(outlineWidth,1,dot));
color blendOutline = mix(outline,surfcolor,smoothstep(outlineWidth,outlineBlend,dot));
Oi = Os;
Ci = Oi * Cs * (solidOutline+blendOutline) * Kd;
} |