Hi Eric,
I progressively made the changes to create BetterLines.amxd, including the ones to make it an effect.
The final version of BetterLines.fs is this:
/*
{
“CREDIT”: “SHOWSYNC”,
“CATEGORIES” : [
“Pattern”
],
“DESCRIPTION” : “My First ISF Shader”,
“ISFVSN” : “2”,
“INPUTS” : [
{
“NAME” : “inputImage”,
“TYPE” : “image”
},
{
“NAME” : “radians”,
“TYPE” : “float”,
“DEFAULT” : 0
},
{
“NAME” : “density”,
“TYPE” : “float”,
“DEFAULT” : 10
},
{
“NAME” : “thickness”,
“TYPE” : “float”,
“DEFAULT” : 0.5
}
]
}
*/
#define TWO_PI 6.283185
void main() {
float aspect = RENDERSIZE.y / RENDERSIZE.x;
float x = (isf_FragNormCoord.x - 0.5);
float y = (isf_FragNormCoord.y - 0.5) * aspect;
float offset = thickness * 4 - 2;
float red = sin((x * cos(radians) + y * sin(radians)) * density) + offset;
float green = sin((x * cos(radians * 2 + TWO_PI * 1/3) + y * sin(radians * 2 + TWO_PI * 1/3)) * density) + offset;
float blue = sin((x * cos(radians * 3 + TWO_PI * 2/3) + y * sin(radians * 3 + TWO_PI * 2/3)) * density) + offset;
float alpha = 1;
vec4 linesResult = vec4(red, green, blue, alpha);
vec4 incoming = IMG_THIS_PIXEL(inputImage);
float dist = distance(vec2(x, y), vec2(0, 0));
gl_FragColor = mix(incoming, linesResult, smoothstep(0.2, 0.3, dist));
}
The plugin works as it should, except for the thickness parameter, which is displayed as a value in the button, and is able to be modulated, but does not have any effect on the image. Everything else works.
ISF Editor indicates that the error is in “float offset = thickness * 4 - 2;”
and is: ‘*’ does not operate on ‘float’ and ‘int’
Naturally that flows on to ‘offset’ being undeclared, but the colour values are still functioning.
Changing the line to “float offset = thickness * x - y;” for example, ends the error for that line, but now it comes up for the green and blue lines - but not the red, which has no integers.
Replacing “*” with “+” creates the similar error.
So there seems to be an issue with using arithmetical operators with integers on ‘float’ lines?
Perhaps a change in float as a type?
Any suggestions welcome!