This is the OSL material I have been trying attempting to use:
/*
Grid Lines
: Author Dealga McArdle, 2013
: modified from Sine Stripes by Thomas Dinges
example shaders:
http://www.openshading.com/osl/example-shaders/
*/
#include "stdosl.h"
shader GridShaderUV(
// input and output parameters
vector Vector = P,
color GridColor = color(0.8),
float Intensity = 1.0,
float Distance_U = 0.02,
float Distance_V = 0.02,
int Stripes_U = 10,
int Stripes_V = 10,
output float Fac = 1.0,
output color Color = color(0.8),
float World_X = 1.0,
float World_Y = 1.0
)
{
// shader code
point Pos = Vector;
Pos[0] -= World_X;
float pattern_col = 0.0;
for(int i = 0; i < Stripes_U; ++i ) {
Pos[0] += Distance_U;
pattern_col += abs(Intensity / Pos[0] / 1000.0);
}
Pos = Vector;
Pos[1] -= World_Y;
for(int i = 0; i < Stripes_V; ++i ) {
Pos[1] += Distance_V;
pattern_col += abs(Intensity / Pos[1] / 1000.0);
}
color C = transformc("hsv", GridColor);
Fac = pattern_col;
Color = color("hsv", C[0], C[1], (Fac*C[2]));
}
After some more messing around I think I was able to solve the issue I was having - thanks all!