top of page

// Circle.osl

shader
Circle(
    float s = 0 
       [[
       int lockgeom = 0,
       string widget = "null",
       ]],
    float t = 0
       [[
       int lockgeom = 0,
       string widget = "null",
       ]],
   float s_center = 0.5,
   float t_center = 0.5,
   float radius_outer = 0.4,
   color bakcolor = color(1,1,1),
   color patcolor = color(1,0,0),
   output color resultRGB = 0)
{
float ss = s - floor(s);
float tt = t - floor(t);

float a = s_center - ss;
float b = tt - t_center;
float dist_sqrd = a * a + b * b;

if(dist_sqrd <= radius_outer * radius_outer)
   resultRGB = patcolor;
else
   resultRGB = bakcolor;
}

bottom of page