/* st.sl - Surface texture to see where is what * (c) Copyright 1998, Denis P. Leconte * * The RenderMan (R) Interface Procedures and RIB Protocol are: * Copyright 1988, 1989, Pixar. All rights reserved. * RenderMan (R) is a registered trademark of Pixar. * * Description: * Colors an object with a grid that follows the texture coordinates. * s-perpendicular grid lines are red * t-perpendicular grid lines are green * The "softer" edge of a grid line is towards the higher values * of the axis that line is perpendicular to. * * Parameters: * Ka, Kd: self-explanatory * gridsize: grid interval size * * 11/24/1998 Denis P. Leconte * Initial Version, from plastic.sl */ surface st ( float Ka = 1; float Kd = .5; float gridsize= 0.2; ) { color Yellow, Cyan, Magenta; float a, b, c; Cyan= (0, 1, 1); Magenta= (1, 0, 1); Yellow= (1, 1, 0); Cs= (1, 1, 1); a= s / gridsize; b= a - floor(a); c= 1 - smoothstep(0.1, 0.5, b); Cs -= Cyan * c; a= t / gridsize; b= a - floor(a); c= 1 - smoothstep(0.1, 0.5, b); Cs -= Magenta * c; normal Nf = faceforward (normalize(N),I); Oi = Os; Ci = Os * Cs * (Ka*ambient() + Kd*diffuse(Nf)); }