/* Polkadot Shader --------------- Carlos F. Hernandez 11511559 Parameters: freq dotRadius - radius of the dots dotSpacing - spacing between dots measured from the EDGE of dot, NOT CENTER bgColor - background color dotColor - dot color */ surface polkadots (float freq; color bgColor = color (1.0, 1.0, 1.0); color dotColor = color (0.0, 0.0, 0.0); float dotRadius; float dotSpacing; ) { float smod = mod(s*freq , (2*dotRadius+dotSpacing) ) - (0.5*dotSpacing); float tmod = mod(t*freq , (2*dotRadius+dotSpacing) ) - (0.5*dotSpacing); float temp = sqrt(pow(abs(smod) ,2) + pow(abs(tmod) ,2) ); if(temp <= dotRadius) { Ci=dotColor; } else Ci=bgColor; Oi = Os; }