/* * line.sl 1.0 by Andrew Osiow * * Line is based on small modification to wire.sl which is distributed with Pixar's RMS or Mtor * Instead of setting Opacity, it sets line_color based on UV space * */ #define HALF 0.5 surface line( float hwidth=0.0075,smult = 1.0,tmult = 1.0; color line_color = 0.0;) { float rim; float s_mid,t_mid,mid; color C; float val; rim = 2*hwidth; Oi = Os; C = Cs; s_mid = length(dPdu)*(HALF - abs(mod(s*smult,1.0) - HALF))/smult; t_mid = length(dPdv)*(HALF - abs(mod(t*tmult,1.0) - HALF))/tmult; mid = (s_mid > t_mid) ? t_mid : s_mid; if (mid < hwidth) C = line_color; else if ( mid < (hwidth+rim)) C = mix (line_color,Cs,(mid-hwidth)/rim); Ci = Oi * C; }