OSL Scripting

Heart model created by Alissa Drake

shader
circle
[[
int rfm_nodeid = 3,
string rfm_classification = "rendernode/RenderMan/pattern",
string help = "Brief description goes here."
]]
(color fcolor = color(1,0,0),
output color resultRGB = 0,
float Radius = .2,
output float resultF = 0)

{
if (((u - .5) * (u - .5) + (v - .5) * (v - .5)) <= Radius)
{
resultRGB=fcolor;
resultF = 1;
}

shader

Rectangle

[[
int rfm_nodeid = 1,
string rfm_classification = "rendernode/RenderMan/pattern",
string help = "Brief description goes here."
]]
(
    float s = 0
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
    float t = 0
        [[
        int lockgeom = 0,
        string widget = "null",
        ]],
        float Horizontal = 0.5,
        float Vertical = 0.5,
        float Width = 0.4,
        float Height = 0.4,
    output color resultRGB = 0)
{
float left = Horizontal - Width/2;
float right = Horizontal + Width/2;
float top = Vertical - Width/2;
float bottom = Vertical + Width/2;
if(t >= left && t <= right ||
    s >= top && s<= bottom)
    resultRGB = color(1,0,0);
else
    resultRGB = color(1,1,1);
}

           

shader
parabola
[[
int rfm_nodeid = 2,
string rfm_classification = "rendernode/RenderMan/pattern",
string help = "Brief description goes here."
]]
(color fcolor= color (1,0,0),
output color resultRGB = 0,
output float resultF = 0)
{

if (u>= sin (v * 5))
{
resultRGB=fcolor;
resultF = 1;
}
else
{
resultRGB = 1;
resultF = 1;
}

}